use MY_ROOT in place of PREFIX

This commit is contained in:
AJ ONeal 2017-05-08 21:47:31 +00:00
parent c75a073ce4
commit d71240a222
1 changed files with 18 additions and 16 deletions

View File

@ -2,11 +2,13 @@
# something or other about android and tmux using PREFIX
#: "${PREFIX:=''}"
if [ -z "$PREFIX" ]; then
PREFIX=""
MY_ROOT=""
if [ -z "${PREFIX-}" ]; then
MY_ROOT=""
else
MY_ROOT="$PREFIX"
fi
# Not every platform has or needs sudo, gotta save them O(1)s
# Not every platform has or needs sudo, gotta save them O(1)s...
sudo_cmd=""
((EUID)) && [[ -z "$ANDROID_ROOT" ]] && sudo_cmd="sudo"
@ -79,14 +81,14 @@ install_for_systemd()
echo "Installing as systemd service"
echo ""
dap_dl "$installer_base/$my_app_system_service" "$my_app_dir/$my_app_system_service"
$sudo_cmd mv "$my_app_dir/$my_app_system_service" "$PREFIX/$my_app_system_service"
$sudo_cmd chown -R root:root "$PREFIX/$my_app_system_service"
$sudo_cmd chmod 644 "$PREFIX/$my_app_system_service"
$sudo_cmd mv "$my_app_dir/$my_app_system_service" "$MY_ROOT/$my_app_system_service"
$sudo_cmd chown -R root:root "$MY_ROOT/$my_app_system_service"
$sudo_cmd chmod 644 "$MY_ROOT/$my_app_system_service"
dap_dl "$installer_base/$my_app_system_tmpfiles" "$my_app_dir/$my_app_system_tmpfiles"
$sudo_cmd mv "$my_app_dir/$my_app_system_tmpfiles" "$PREFIX/$my_app_system_tmpfiles"
$sudo_cmd chown -R root:root "$PREFIX/$my_app_system_tmpfiles"
$sudo_cmd chmod 644 "$PREFIX/$my_app_system_tmpfiles"
$sudo_cmd mv "$my_app_dir/$my_app_system_tmpfiles" "$MY_ROOT/$my_app_system_tmpfiles"
$sudo_cmd chown -R root:root "$MY_ROOT/$my_app_system_tmpfiles"
$sudo_cmd chmod 644 "$MY_ROOT/$my_app_system_tmpfiles"
$sudo_cmd systemctl stop "${my_app_name}.service" >/dev/null 2>/dev/null
$sudo_cmd systemctl daemon-reload
@ -103,11 +105,11 @@ install_for_launchd()
echo ""
# See http://www.launchd.info/
dap_dl "$installer_base/$my_app_launchd_service" "$my_app_dir/$my_app_launchd_service"
$sudo_cmd mv "$my_app_dir/$my_app_launchd_service" "$PREFIX/$my_app_launchd_service"
$sudo_cmd chown root:wheel "$PREFIX/$my_app_launchd_service"
$sudo_cmd chmod 0644 "$PREFIX/$my_app_launchd_service"
$sudo_cmd launchctl unload -w "$PREFIX/$my_app_launchd_service" >/dev/null 2>/dev/null
$sudo_cmd launchctl load -w "$PREFIX/$my_app_launchd_service"
$sudo_cmd mv "$my_app_dir/$my_app_launchd_service" "$MY_ROOT/$my_app_launchd_service"
$sudo_cmd chown root:wheel "$MY_ROOT/$my_app_launchd_service"
$sudo_cmd chmod 0644 "$MY_ROOT/$my_app_launchd_service"
$sudo_cmd launchctl unload -w "$MY_ROOT/$my_app_launchd_service" >/dev/null 2>/dev/null
$sudo_cmd launchctl load -w "$MY_ROOT/$my_app_launchd_service"
echo "$my_app_name started with launchd"
}
@ -115,7 +117,7 @@ install_for_launchd()
install_service()
{
installable=""
if [ -d "$PREFIX/etc/systemd/system" ]; then
if [ -d "$MY_ROOT/etc/systemd/system" ]; then
install_for_systemd
installable="true"
fi