Skip to content

Commit

Permalink
Merge pull request #93 from amnezia-vpn/Linux_install_scripts
Browse files Browse the repository at this point in the history
Fixed installing scripts for Linux
  • Loading branch information
pokamest authored Aug 16, 2022
2 parents 13e2c32 + d36378f commit 2e9cfa6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 45 deletions.
23 changes: 7 additions & 16 deletions deploy/data/linux/post_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,18 @@ fi

sudo chmod -R a-w $APP_PATH/

sudo cp $APP_PATH/service/$APP_NAME.service /etc/systemd/system/ >> $LOG_FILE
sudo cp $APP_PATH/$APP_NAME.service /etc/systemd/system/ >> $LOG_FILE

sudo systemctl start $APP_NAME >> $LOG_FILE
sudo systemctl enable $APP_NAME >> $LOG_FILE
sudo ln -s $APP_PATH/client/$APP_NAME.sh /usr/sbin/$APP_NAME >> $LOG_FILE

sudo chmod 555 $APP_PATH/client/$APP_NAME.sh >> $LOG_FILE
sudo ln -s $APP_PATH/client/$APP_NAME.sh /usr/local/sbin/$APP_NAME >> $LOG_FILE
sudo ln -s $APP_PATH/client/$APP_NAME.sh /usr/local/bin/$APP_NAME >> $LOG_FILE

echo "user desktop creation loop started" >> $LOG_FILE
getent passwd {1000..6000} | while IFS=: read -r name password uid gid gecos home shell; do
echo "name: $name"
if ! test -f /home/$name/.icons; then
mkdir /home/$name/.icons/ >> $LOG_FILE
fi

cp -f $APP_PATH/client/share/icons/AmneziaVPN_Logo.png /home/$name/.icons/ >> $LOG_FILE
cp $APP_PATH/client/$APP_NAME.desktop /home/$name/Desktop/ >> $LOG_FILE

sudo chown $name:$name /home/$name/.local/share/gvfs-metadata/home* >> $LOG_FILE
sudo -u $name dbus-launch gio set /home/$name/Desktop/AmneziaVPN.desktop "metadata::trusted" yes >> $LOG_FILE
sudo chown $name:$name /home/$name/Desktop/AmneziaVPN.desktop >> $LOG_FILE
done
sudo cp $APP_PATH/$APP_NAME.desktop /usr/share/applications/ >> $LOG_FILE
sudo chmod 555 /usr/share/applications/$APP_NAME.desktop >> $LOG_FILE

echo "user desktop creation loop ended" >> $LOG_FILE

date >> $LOG_FILE
Expand Down
41 changes: 12 additions & 29 deletions deploy/data/linux/post_uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,47 +29,30 @@ if test -f /etc/systemd/system/$APP_NAME.service; then
sudo rm -rf /etc/systemd/system/$APP_NAME.service >> $LOG_FILE
fi

if test -f /usr/bin/$APP_NAME; then
sudo rm -rf /usr/sbin/$APP_NAME >> $LOG_FILE
fi

if test -f $APP_PATH; then
sudo rm -rf $APP_PATH >> $LOG_FILE
fi

if test -f /usr/sbin/$APP_NAME; then
sudo rm -rf /usr/sbin/$APP_NAME >> $LOG_FILE
sudo rm -f /usr/sbin/$APP_NAME >> $LOG_FILE
fi

if test -f /usr/sbin/$APP_NAME-service; then
sudo rm -rf /usr/sbin/$APP_NAME-service >> $LOG_FILE
if test -f /usr/bin/$APP_NAME; then
sudo rm -f /usr/bin/$APP_NAME >> $LOG_FILE
fi

getent passwd {1000..6000} | while IFS=: read -r name password uid gid gecos home shell; do
if test -f /home/$name/Desktop/$APP_NAME\ client.desktop; then
sudo rm -rf /home/$name/Desktop/$APP_NAME\ client.desktop >> $LOG_FILE
fi

if test -f /home/$name/Desktop/$APP_NAME.desktop; then
sudo rm -rf /home/$name/Desktop/$APP_NAME.desktop >> $LOG_FILE
fi

if test -f /home/$name/.config/$APP_NAME.ORG; then
sudo rm -rf /home/$name/.config/$APP_NAME.ORG >> $LOG_FILE
fi
if test -f /usr/local/bin/$APP_NAME; then
sudo rm -f /usr/local/bin/$APP_NAME >> $LOG_FILE
fi

if test -f /home/$name/.local/share/$APP_NAME.ORG; then
sudo rm -rf /home/$name/.local/share/$APP_NAME.ORG >> $LOG_FILE
fi
if test -f /usr/local/sbin/$APP_NAME; then
sudo rm -f /usr/local/sbin/$APP_NAME >> $LOG_FILE
fi

if test -f /home/$name/.local/share/$APP_NAME; then
sudo rm -rf /home/$name/.local/share/$APP_NAME >> $LOG_FILE
fi
if test -f /usr/share/applications/$APP_NAME.desktop; then
sudo rm -f /usr/share/applications/$APP_NAME.desktop >> $LOG_FILE

if test -f /home/$name/.icons/AmneziaVPN_Logo.png; then
sudo rm -rf /home/$name/.icons/AmneziaVPN_Logo.png >> $LOG_FILE
fi
done
fi

date >> $LOG_FILE
echo "Service after uninstall status:" >> $LOG_FILE
Expand Down

0 comments on commit 2e9cfa6

Please sign in to comment.