| 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 | Programs=/Programs |
|---|
| 20 | |
|---|
| 21 | if [ ! "`ls -1 $Programs/ | grep "^BaculaBat\([0-9]\.\|\>\)"`" ]; then |
|---|
| 22 | exit 0 |
|---|
| 23 | fi |
|---|
| 24 | |
|---|
| 25 | if ( kdialog --warningcontinuecancel "Previous installations of Bat will be deleted!" ); then |
|---|
| 26 | man=/usr/local/man/man1/bat.1.gz |
|---|
| 27 | bin=/usr/local/sbin/bat |
|---|
| 28 | conf=/usr/local/etc/bat.conf.sample |
|---|
| 29 | icon1=/usr/local/share/pixmaps/bat.png |
|---|
| 30 | icon2=/usr/local/share/pixmaps/bat-sh.png |
|---|
| 31 | icon3=/usr/local/share/pixmaps/bat-kommander.png |
|---|
| 32 | for l in $man $bin $conf $icon1 $icon2 $icon3; do |
|---|
| 33 | # if it is linked, it was probably created by PBI |
|---|
| 34 | if [ -h "$l" ]; then |
|---|
| 35 | rm "$l" |
|---|
| 36 | fi |
|---|
| 37 | done |
|---|
| 38 | |
|---|
| 39 | for bat in `ls -1 $Programs/ | grep "^BaculaBat\([0-9]\.\|\>\)"`; do |
|---|
| 40 | version="`echo $bat | sed "s/^BaculaBat//"`" |
|---|
| 41 | if [ "$version" != "" ]; then |
|---|
| 42 | versions="$versions $version" |
|---|
| 43 | else |
|---|
| 44 | versions="$versions $bat" |
|---|
| 45 | fi |
|---|
| 46 | rm -rf "$Programs/$bat" |
|---|
| 47 | done |
|---|
| 48 | |
|---|
| 49 | if [ "$versions" ]; then |
|---|
| 50 | kdialog --passivepopup "Removed Bacula Bat versions:$versions" 1 |
|---|
| 51 | fi |
|---|
| 52 | else |
|---|
| 53 | exit 2 |
|---|
| 54 | fi |
|---|