Skip to content
Snippets Groups Projects
Commit 812d27ce authored by efer's avatar efer
Browse files

linux distro install rclone/age

parent 85125e48
No related branches found
No related tags found
No related merge requests found
...@@ -101,22 +101,35 @@ elif [ $HOST_OS = 'Linux' ]; then ...@@ -101,22 +101,35 @@ elif [ $HOST_OS = 'Linux' ]; then
HOST=$(hostname -s) HOST=$(hostname -s)
NOTIFY0='notify-send -a "DTU Compute backup script" -i network-transmit "Backup done"' NOTIFY0='notify-send -a "DTU Compute backup script" -i network-transmit "Backup done"'
NOTIFY1='notify-send -a "DTU Compute backup script" -i network-error "Backup did not complete"' NOTIFY1='notify-send -a "DTU Compute backup script" -i network-error "Backup did not complete"'
DISTRO=$(grep -Ew "ID|ID_LIKE" /etc/os-release |cut -d '=' -f 2)
if [[ ${DISTRO[*]} =~ debian ]] || [[ ${DISTRO[*]} =~ ubuntu ]]; then
PKGMAN="apt"
elif [[ ${DISTRO[*]} =~ fedora ]]; then
PKGMAN="dnf"
fi
# Check for necessary programs # Check for necessary programs
which rclone &>/dev/null for prog in rclone age; do
which $prog &>/dev/null
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
if [[ -z $PKGMAN ]]; then
echo -e $R_"rclone command not installed"$_N echo -e $R_"rclone command not installed"$_N
echo -e "Install it using your distro package manager:" $G_"<package_manager> install rclone"$_N echo -e "Install it using your distro package manager or manually from $prog project website"
echo -e "and run this script again afterwards\n" echo -e "Then run this script again afterwards\n"
exit 1 exit 1
fi else
echo -e $Y_"Installing $prog using $PKGMAN"$_N "- you may be asked for your password"
which age &>/dev/null chksudo
sudo $PKGMAN install $prog &>/dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo -e $R_"age command not installed"$_N echo -e $R_"\nCould not find $prog in distro repo"$_N
echo -e "Install it using your distro package manager:" $G_"<package_manager> install age"$_N echo -e "Please install manually from $prog project website and run this script again afterwards\n"
echo -e "and run this script again afterwards\n"
exit 1 exit 1
else
echo -e "[$prog]" $G_"OK"$_N
fi
fi fi
fi
done
# SYSTEMD # SYSTEMD
which systemctl &>/dev/null which systemctl &>/dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
...@@ -137,7 +150,7 @@ fi ...@@ -137,7 +150,7 @@ fi
# User Specific Variables # User Specific Variables
# #
USER=$(whoami) USER=$(whoami)
echo -n "Enter your DTU username [$USER]: " echo -n "\nEnter your DTU username [$USER]: "
read ANS read ANS
case $ANS in case $ANS in
"") "")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment