31 lines
650 B
Bash
Executable File
31 lines
650 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
script_path="$(dirname "$(realpath -s "$BASH_SOURCE")")"
|
|
cd "$script_path"
|
|
chmod +x app
|
|
source app source
|
|
install_dest="${install_dest:="/opt/$de_distro"}"
|
|
|
|
if [ "$de_distro" = "" ]; then
|
|
echo "No distro name."
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$script_path" = "$install_dest" ]; then
|
|
echo "Can't install from inside destination directory."
|
|
exit 1
|
|
fi
|
|
|
|
if [ -d "$install_dest" ]; then
|
|
echo "Use $install_dest/uninstall first."
|
|
exit 1
|
|
fi
|
|
cp -r "$script_path" "$install_dest"
|
|
echo "" >"$install_dest/installed"
|
|
|
|
if [ -L "/usr/local/bin/$de_distro" ]; then
|
|
rm "/usr/local/bin/$de_distro"
|
|
fi
|
|
|
|
ln -s "$script_path/app" "/usr/local/bin/$de_distro"
|