diff options
author | runnytu | 2020-01-12 14:39:07 +0100 |
---|---|---|
committer | runnytu | 2020-01-12 14:39:07 +0100 |
commit | c5b7894a532ae956ab4990c49cf5927f00f473ee (patch) | |
tree | 0838d1a158077d57e73b586b4d691e4ab43bccaf /packettracer.install | |
parent | 2087f47d22ff3d325ba6d3253838e3f317ab3a50 (diff) | |
download | aur-c5b7894a532ae956ab4990c49cf5927f00f473ee.tar.gz |
Fix install file
Diffstat (limited to 'packettracer.install')
-rw-r--r-- | packettracer.install | 173 |
1 files changed, 8 insertions, 165 deletions
diff --git a/packettracer.install b/packettracer.install index 3369d3397fac..85f768a4b658 100644 --- a/packettracer.install +++ b/packettracer.install @@ -1,174 +1,17 @@ -pre_install() { - remove_pt () - { - if [ -e /opt/pt ]; then - echo "Removing old version of Packet Tracer from /opt/pt" - sudo rm -rf /opt/pt - sudo rm -rf /usr/share/applications/cisco-pt7.desktop - sudo rm -rf /usr/share/applications/cisco-ptsa7.desktop - sudo rm -rf /usr/share/icons/hicolor/48x48/apps/pt7.png - fi - if [ -e /opt/packettracer/ ]; then - echo "Removing old version of Packet Tracer from /opt/packettracer/" - sudo rm -rf /opt/packettracer/ - sudo rm -rf /usr/share/applications/cisco-pt7.desktop - sudo rm -rf /usr/share/applications/cisco-ptsa7.desktop - sudo rm -rf /usr/share/icons/hicolor/48x48/apps/pt7.png - fi - } -} - post_install() { - xdg-icon-resource forceupdate --theme hicolor &> /dev/null - # update icon and file assocation - sudo xdg-desktop-menu install /usr/share/applications/cisco-pt7.desktop - sudo update-mime-database /usr/share/mime - sudo gtk-update-icon-cache --force /usr/share/icons/gnome - - # sets the incoming PTDIR as a system environment variable - # sets the Qt high resolution as a system environment variable - # by modifying /etc/profile - PTDIR="/opt/packettracer/" - - # create shortcut - sudo ln -sf $PTDIR/packettracer /usr/bin/packettracer - - # check /etc/profile for existance of PT7HOME - PROFILE="/etc/profile" - - # error exit if file does not exist or unreadable - if [ ! -f $PROFILE ]; then - exit 1 - elif [ ! -r $PROFILE ]; then - exit 2 +if [ ! -f "/usr/lib/libdouble-conversion.so.1" ]; then + if [ ! -f "/opt/packettracer/bin/libdouble-conversion.so.1" ]; then + ln -s /usr/lib/libdouble-conversion.so /opt/packettracer/bin/libdouble-conversion.so.1 fi - - # read contents - CONTENTS="" - EXPORT_EXISTS=0 - PT7HOME_EXISTS=0 - PT7HOME_FOUND=0 - EXPORT_QT_EXISTS=0 - QT_EXISTS=0 - QT_FOUND=0 - exec 3<&0 - exec 0<$PROFILE - while IFS= read -r line - do - - # replace existing entries - PT7HOME_FOUND=$(expr match "$line" 'PT7HOME') - if [ "$PT7HOME_FOUND" -gt 0 ]; then - line="PT7HOME=$PTDIR" - PT7HOME_EXISTS=1 - fi - - QT_FOUND=$(expr match "$line" 'QT_DEVICE_PIXEL_RATIO') - if [ "$QT_FOUND" -gt 0 ]; then - line="QT_DEVICE_PIXEL_RATIO=auto" - QT_EXISTS=1 - fi - - # check for export statement - if [ $EXPORT_EXISTS -eq 0 ]; then - EXPORT_QT_EXISTS=$(expr match "$line" 'export QT_DEVICE_PIXEL_RATIO') - fi - - if [ "$EXPORT_QT_EXISTS" -eq 0 ]; then - EXPORT_QT_EXISTS=$(expr match "$line" 'export QT_DEVICE_PIXEL_RATIO') - fi - - #append the line to the contents - CONTENTS="$CONTENTS -$line" - done - exec 0<&3 - - if [ $PT7HOME_EXISTS -eq 0 ]; then - CONTENTS="$CONTENTS -PT7HOME=$PTDIR" - fi - - if [ $EXPORT_EXISTS -eq 0 ]; then - CONTENTS="$CONTENTS -export PT7HOME" - fi - - if [ $QT_EXISTS -eq 0 ]; then - CONTENTS="$CONTENTS -QT_DEVICE_PIXEL_RATIO=auto" - fi - - if [ $EXPORT_EXISTS -eq 0 ]; then - CONTENTS="$CONTENTS -export QT_DEVICE_PIXEL_RATIO" - fi - - sudo echo -e "$CONTENTS" | sudo tee /etc/profile > /dev/null - sudo sed '1{/^$/d}' -i /etc/profile > /dev/null - - update-desktop-database -q -} - -pre_upgrade() { - pre_install +fi } post_upgrade() { - post_install +post_install } post_remove() { - xdg-icon-resource forceupdate --theme hicolor &> /dev/null - sudo xdg-desktop-menu uninstall /usr/share/applications/cisco-pt7.desktop - sudo xdg-desktop-menu uninstall /usr/share/applications/cisco-ptsa7.desktop - sudo update-mime-database /usr/share/mime - sudo gtk-update-icon-cache --force /usr/share/icons/gnome - - sudo rm -f /usr/bin/packettracer - - # check /etc/profile for existance of PT7HOME - PROFILE="/etc/profile" - - # error exit if file does not exist or unreadable - if [ ! -f $PROFILE ]; then - true - elif [ ! -r $PROFILE ]; then - true - fi - - # read contents - exec 3<&0 - exec 0<$PROFILE - while IFS= read -r line - do - PT7HOME_FOUND=$(expr match "$line" 'PT7HOME') - if [ "$PT7HOME_FOUND" -gt 0 ]; then - continue - fi - - QT_FOUND=$(expr match "$line" 'QT_DEVICE_PIXEL_RATIO') - if [ "$QT_FOUND" -gt 0 ]; then - continue - fi - - EXPORT_FOUND=$(expr match "$line" 'export PT7HOME') - if [ "$EXPORT_FOUND" -gt 0 ]; then - continue - fi - - EXPORT_QT_FOUND=$(expr match "$line" 'export QT_DEVICE_PIXEL_RATIO') - if [ "$EXPORT_QT_FOUND" -gt 0 ]; then - continue - fi - - CONTENTS="$CONTENTS -$line" - done - exec 0<&3 - - sudo echo -e "$CONTENTS" | sudo tee /etc/profile > /dev/null - sudo sed '1{/^$/d}' -i /etc/profile > /dev/null - - update-desktop-database -q +if [ -f "/opt/packettracer/bin/libdouble-conversion.so.1" ]; then + rm /opt/packettracer/bin/libdouble-conversion.so.1 +fi } |