Files
api/plugin/source/dynamix.unraid.net/install/doinst.sh
Eli Bosley 514a0ef560 fix(connect): remove unraid-api folder before creating symlink (#1556)
During plugin installation, if `/usr/local/bin/unraid-api` exists as a
directory, the installation fails because `rm -f` cannot remove a
directory. This change replaces `rm -f` with `rm -rf` to ensure that the
path is removed regardless of whether it is a file or a directory,
allowing the symlink to be created successfully.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-08-01 11:01:13 -04:00

28 lines
819 B
Bash

#!/bin/sh
backup_file_if_exists() {
if [ -f "$1" ]; then
mv "$1" "$1.old"
fi
}
for f in etc/rc.d/rc6.d/K*unraid-api etc/rc.d/rc6.d/K*flash-backup; do
[ -e "$f" ] && chmod 755 "$f"
done
chmod +x usr/local/unraid-api/dist/cli.js
chmod +x usr/local/unraid-api/dist/main.js
rm -rf usr/local/bin/unraid-api
ln -sf ../unraid-api/dist/cli.js usr/local/bin/unraid-api
# deprecated
ln -sf ../bin/unraid-api usr/local/sbin/unraid-api
ln -sf ../local/bin/unraid-api usr/bin/unraid-api
# By default, we want to overwrite the active api-specific .env configuration on every install.
# We keep a backup in case a user needs to revert to their prior configuration.
backup_file_if_exists usr/local/unraid-api/.env
cp usr/local/unraid-api/.env.production usr/local/unraid-api/.env
# auto-generated actions from makepkg: