| 1 | #!/bin/sh |
|---|
| 2 | # Filename: PBI.FirstRun.sh |
|---|
| 3 | # Place any custom installation code here. |
|---|
| 4 | # This script will be run before your program is extracted into |
|---|
| 5 | # /Programs/<ProgNameVer>/ |
|---|
| 6 | # Available variables: |
|---|
| 7 | # $PROGDIR - Directory where the files will be extracted to. |
|---|
| 8 | # $USERNAME - Username of who started the installation. |
|---|
| 9 | # $INSTALLMODE - Set to 'TEXT' or 'GUI', depending on which installer is running. |
|---|
| 10 | # |
|---|
| 11 | # Return a '2' to halt the PBI installation |
|---|
| 12 | # TIP: 'kdialog' should be used for user interaction. |
|---|
| 13 | # To interact with the progress dialog echo these flags: |
|---|
| 14 | # echo 'TOTALSTEPS: <num>' # Set the total steps of the progress bar |
|---|
| 15 | # echo 'SETSTEPS: <num>' # Set the current progress of the progress bar |
|---|
| 16 | # echo 'MSG: <text>' # Display this text above progress bar |
|---|
| 17 | ######################################### |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | if [ -e "/usr/local/bin/armagetronad" ] |
|---|
| 21 | then |
|---|
| 22 | # Looks like FF is installed, ask if they want to remove the old one |
|---|
| 23 | ls -al /usr/local/bin/armagetronad | grep Programs 2>/dev/null |
|---|
| 24 | if [ "$?" = "0" ] |
|---|
| 25 | then |
|---|
| 26 | kdialog --yesno "Armagetron is already installed, do you wish to uninstall it?" |
|---|
| 27 | if [ "$?" = "0" ] |
|---|
| 28 | then |
|---|
| 29 | FF="`ls -al /usr/local/bin/armagetronad | cut -d '>' -f 2 | cut -d "/" -f 3`" |
|---|
| 30 | echo $FF | grep Armagetron 2>/dev/null |
|---|
| 31 | if [ "$?" = "0" ] |
|---|
| 32 | then |
|---|
| 33 | PBIdelete -remove ${FF} |
|---|
| 34 | else |
|---|
| 35 | kdialog --sorry "Armagetron could not be automatically removed... Please remove it in Add / Remove Programs and try again." |
|---|
| 36 | return 2 |
|---|
| 37 | fi |
|---|
| 38 | else |
|---|
| 39 | kdialog --sorry "Armagetron is already installed, it must be uninstalled before loading this PBI" |
|---|
| 40 | return 2 |
|---|
| 41 | fi |
|---|
| 42 | |
|---|
| 43 | else |
|---|
| 44 | # Could not find a link to PBI folder |
|---|
| 45 | kdialog --sorry "Armagetron is already installed, it must be uninstalled before loading this PBI" |
|---|
| 46 | return 2 |
|---|
| 47 | fi |
|---|
| 48 | fi |
|---|