mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 01:26:04 -08:00
fix install script for FreeBSD, add doas priv elevation
This commit is contained in:
committed by
Christian Visintin
parent
c1b245b4c9
commit
15fffdf0c9
24
install.sh
24
install.sh
@@ -13,6 +13,8 @@ GITHUB_URL="https://github.com/veeso/termscp/releases/download/v${TERMSCP_VERSIO
|
|||||||
DEB_URL="${GITHUB_URL}/termscp_${TERMSCP_VERSION}_amd64.deb"
|
DEB_URL="${GITHUB_URL}/termscp_${TERMSCP_VERSION}_amd64.deb"
|
||||||
RPM_URL="${GITHUB_URL}/termscp-${TERMSCP_VERSION}-1.x86_64.rpm"
|
RPM_URL="${GITHUB_URL}/termscp-${TERMSCP_VERSION}-1.x86_64.rpm"
|
||||||
|
|
||||||
|
PATH="$PATH:/usr/sbin"
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
|
||||||
@@ -92,16 +94,20 @@ test_writeable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
elevate_priv() {
|
elevate_priv() {
|
||||||
if ! has sudo; then
|
if has sudo; then
|
||||||
error 'Could not find the command "sudo", needed to install termscp on your system.'
|
if ! sudo -v; then
|
||||||
info "If you are on Windows, please run your shell as an administrator, then"
|
|
||||||
info "rerun this script. Otherwise, please run this script as root, or install"
|
|
||||||
info "sudo."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if ! sudo -v; then
|
|
||||||
error "Superuser not granted, aborting installation"
|
error "Superuser not granted, aborting installation"
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
|
sudo="sudo"
|
||||||
|
elif has doas; then
|
||||||
|
sudo="doas"
|
||||||
|
else
|
||||||
|
error 'Could not find the commands "sudo" or "doas", needed to install termscp on your system.'
|
||||||
|
info "If you are on Windows, please run your shell as an administrator, then"
|
||||||
|
info "rerun this script. Otherwise, please run this script as root, or install"
|
||||||
|
info "sudo or doas."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,9 +116,7 @@ elevate_priv_ex() {
|
|||||||
if test_writeable "$check_dir"; then
|
if test_writeable "$check_dir"; then
|
||||||
sudo=""
|
sudo=""
|
||||||
else
|
else
|
||||||
warn "Root permissions are required to install dependecies"
|
|
||||||
elevate_priv
|
elevate_priv
|
||||||
sudo="sudo"
|
|
||||||
fi
|
fi
|
||||||
echo $sudo
|
echo $sudo
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user