Skip to content

Commit

Permalink
(Linux) Installer: Binaries location changed to /usr/bin
Browse files Browse the repository at this point in the history
Updated installation scripts
#57
  • Loading branch information
stenya committed Aug 30, 2021
1 parent b2457e0 commit 44272da
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 23 deletions.
9 changes: 4 additions & 5 deletions cli/References/Linux/package_scripts/after-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ INSTRUCTIONS_FILE="$IVPN_TMP/service_install.txt"
mkdir -p $IVPN_TMP
[ -e $INSTRUCTIONS_FILE ] && rm $INSTRUCTIONS_FILE


silent() {
"$@" > /dev/null 2>&1
}
Expand Down Expand Up @@ -42,8 +41,8 @@ silent chmod 0600 $IVPN_ETC/servers.json # can read/wrire only owner (root)
silent chmod 0700 $IVPN_ETC/*.sh # can execute only owner (root)
silent chmod 0700 $IVPN_ETC/*.up # can execute only owner (root)
silent chmod 0700 $IVPN_ETC/*.down # can execute only owner (root)
silent chmod 0755 /usr/local/bin/ivpn # can change only owner (root)
silent chmod 0755 /usr/local/bin/ivpn-service # can change only owner (root)
silent chmod 0755 /usr/bin/ivpn # can change only owner (root)
silent chmod 0755 /usr/bin/ivpn-service # can change only owner (root)


IVPN_SAVED_DNS_FILE="/etc/resolv.conf.ivpnsave"
Expand Down Expand Up @@ -95,12 +94,12 @@ if [ -f $FILE_ACCID_TO_UPGRADE ]; then
# giving a chance for a daemon to fully start
sleep 1
echo "[+] Logging in ..."
/usr/local/bin/ivpn login $ACCID #|| echo "[-] Finishing installation: Failed to to re-login (try#1)"
/usr/bin/ivpn login $ACCID #|| echo "[-] Finishing installation: Failed to to re-login (try#1)"
if [ ! $? -eq 0 ]; then
echo "[-] Finishing installation: Failed to to re-login (try#1)"
echo "[ ] Retry ..."
sleep 3
/usr/local/bin/ivpn login $ACCID || echo "[-] Finishing installation: Failed to to re-login (try#2)"
/usr/bin/ivpn login $ACCID || echo "[-] Finishing installation: Failed to to re-login (try#2)"
fi
fi
fi
26 changes: 11 additions & 15 deletions cli/References/Linux/package_scripts/before-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@

echo "[*] Before install (<%= version %> : <%= pkg %> : $1)"

INSTALLED_BIN_FOLDER="/usr/bin/"
if [ ! -f ${INSTALLED_BIN_FOLDER}/ivpn ] && [ -f /usr/local/bin/ivpn ]; then
# old installation path (used till v3.3.20)
INSTALLED_BIN_FOLDER="/usr/local/bin/"
echo "[ ] Detected old installation path: '$INSTALLED_BIN_FOLDER'"
fi

PKG_TYPE=<%= pkg %>
if [ "$PKG_TYPE" = "rpm" ]; then
if [ -f /usr/local/bin/ivpn ]; then
# Necessary to check if the previous version can be upgraded.
# Old versions have broken installer. It is not possible to upgrade correctly.
BUILD_DATE=$(/usr/local/bin/ivpn -h | grep -o date:[0-9]*-[0-9]*-[0-9]* | cut -d ':' -f 2) || echo "[-] Failed to determine build date of the old version"
if [ $BUILD_DATE \< "2020-05-29" ]; then
echo "[!] Old version detected (date:$BUILD_DATE)"
echo "**************************************************"
echo "* PLEASE, UNINSTALL THE OLD VERSION FIRST! *"
echo "**************************************************"
exit 1
fi

if [ -f ${INSTALLED_BIN_FOLDER}/ivpn ]; then
# Skip running 'remove' scripts when upgrading
mkdir -p /opt/ivpn/mutable
echo "upgrade" > /opt/ivpn/mutable/rpm_upgrade.lock || echo "[-] Failed to save rpm_upgrade.lock"
Expand All @@ -34,10 +30,10 @@ if [ -f /opt/ivpn/mutable/upgradeID.tmp ]; then
mv /opt/ivpn/mutable/upgradeID.tmp /opt/ivpn/mutable/toUpgradeID.tmp || echo "[-] Failed to prepare accountID to re-login"
fi

if [ -f /usr/local/bin/ivpn ]; then
if [ -f ${INSTALLED_BIN_FOLDER}/ivpn ]; then
echo "[+] Trying to disable firewall (before install)..."
/usr/local/bin/ivpn firewall -off || echo "[-] Failed to disable firewall"
${INSTALLED_BIN_FOLDER}/ivpn firewall -off || echo "[-] Failed to disable firewall"

echo "[+] Trying to disconnect (before install) ..."
/usr/local/bin/ivpn disconnect || echo "[-] Failed to disconnect"
${INSTALLED_BIN_FOLDER}/ivpn disconnect || echo "[-] Failed to disconnect"
fi
6 changes: 3 additions & 3 deletions cli/References/Linux/package_scripts/before-remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ echo "[*] Before remove (<%= version %> : <%= pkg %> : $1)"
PKG_TYPE=<%= pkg %>

echo "[+] Disabling firewall (before remove) ..."
/usr/local/bin/ivpn firewall -off || echo "[-] Failed to disable firewall"
/usr/bin/ivpn firewall -off || echo "[-] Failed to disable firewall"

echo "[+] Disconnecting (before remove) ..."
/usr/local/bin/ivpn disconnect || echo "[-] Failed to disconnect"
/usr/bin/ivpn disconnect || echo "[-] Failed to disconnect"

if [ "$PKG_TYPE" = "rpm" ]; then
if [ -f /opt/ivpn/mutable/rpm_upgrade.lock ]; then
Expand All @@ -28,7 +28,7 @@ if [ -f /opt/ivpn/mutable/settings.json ]; then
fi

echo "[+] Logging out ..."
/usr/local/bin/ivpn logout || echo "[-] Failed to log out"
/usr/bin/ivpn logout || echo "[-] Failed to log out"

echo "[+] Service cleanup (pleaserun) ..."
sh /usr/share/pleaserun/ivpn-service/generate-cleanup.sh || echo "[-] Service cleanup FAILED!"

0 comments on commit 44272da

Please sign in to comment.