wok-current annotate boxbackup-client/receipt @ rev 18707

fix some post_install status
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Dec 16 15:49:50 2015 +0100 (2015-12-16)
parents fca172c323cf
children 9e01bc6321ea
rev   line source
domcox@1357 1 # SliTaz package receipt.
domcox@1357 2
domcox@1357 3 PACKAGE="boxbackup-client"
domcox@10920 4 VERSION="0.11.1"
domcox@1357 5 CATEGORY="network"
domcox@1357 6 SHORT_DESC="Client for the BoxBackup on-line backup system"
domcox@12351 7 MAINTAINER="domcox@slitaz.org"
pascal@15202 8 LICENSE="GPL2"
domcox@1357 9 SOURCE="boxbackup"
domcox@1357 10 WANTED="boxbackup-server"
domcox@1357 11 WEB_SITE="http://www.boxbackup.org/"
jozee@3568 12 TAGS="backup automatic client"
domcox@1357 13
pascal@15202 14 DEPENDS="db libedit libssl perl zlib gcc-lib-base"
pascal@15202 15
al@18668 16 # Configuration variables
domcox@12351 17 CONF_DIR="/etc/boxbackup"
domcox@1357 18 DATA_DIR="/var/lib/bbackupd"
domcox@1357 19 RUN_DMON=0
domcox@1357 20
domcox@1357 21 # Rules to gen a SliTaz package suitable for Tazpkg
domcox@1357 22 genpkg_rules()
domcox@1357 23 {
domcox@1357 24 mkdir -p $fs/usr/bin
pascal@15202 25 cp -a $install/boxbackup-${VERSION}-backup-client-linux-gnu/bb* $fs/usr/bin
pascal@9100 26 rm -f $fs/usr/bin/*.*
domcox@1357 27 mkdir -p $fs/etc/init.d
pankso@9697 28 cp -a $stuff/bbackupd $fs/etc/init.d
domcox@1357 29 }
domcox@1357 30
domcox@1357 31 # Pre and post install commands for Tazpkg
domcox@1357 32
domcox@1357 33 pre_install()
domcox@1357 34 {
domcox@1357 35 # Stop daemon
al@18668 36 if [ -z "$1" -a -e /var/run/bbackupd.pid ]; then
domcox@1357 37 /etc/init.d/bbackupd stop
domcox@1357 38 RUN_DMON=1
domcox@1357 39 fi
domcox@1357 40 }
domcox@1357 41
domcox@1357 42 post_install()
domcox@1357 43 {
domcox@1357 44 # Creating conf dir
al@18668 45 if [ ! -e "$1/$CONF_DIR" ]; then
al@18668 46 mkdir -p "$1/$CONF_DIR" && chmod 755 "$1/$CONF_DIR"
domcox@1357 47 fi
al@18668 48 if [ ! -e "$1/$DATA_DIR" ]; then
al@18668 49 mkdir -p "$1/$DATA_DIR" && chmod 700 "$1/$DATA_DIR"
domcox@1357 50 fi
al@18668 51 if [ -z "$1" ]; then
slaxemulator@8751 52 # Start daemon (if stopped by install)
slaxemulator@8751 53 if [ $RUN_DMON -eq 1 ]; then
slaxemulator@8751 54 /etc/init.d/bbackupd start
slaxemulator@8751 55 fi
domcox@1357 56 fi
pascal@18707 57 true
domcox@1357 58 }
domcox@1357 59
domcox@1357 60 # Pre and post remove commands for Tazpkg
domcox@1357 61
domcox@1357 62 pre_remove()
domcox@1357 63 {
al@18668 64 # Stop daemon
al@18668 65 if [ -z "$1" ]; then
slaxemulator@8751 66 if [ -e /var/run/bbackupd.pid ]; then
slaxemulator@8751 67 /etc/init.d/bbackupd stop
slaxemulator@8751 68 fi
domcox@1357 69 fi
domcox@1357 70 }
domcox@1357 71
domcox@1357 72 post_remove()
domcox@1357 73 {
domcox@1357 74 # Delete DATA directory
al@18668 75 rm -rf "$1/$DATA_DIR"
domcox@1357 76
domcox@1357 77 # Delete Client config files
al@18668 78 rm -rf "$1/$CONF_DIR"/bbackupd*
domcox@1357 79
domcox@1357 80 # Delete CONF dir (if empty)
domcox@12351 81 if [ $(ls -lA $CONF_DIR | wc -l) -eq 0 ]; then
al@18668 82 echo
al@18668 83 action "Removing $CONF_DIR..."
slaxemulator@8751 84 rm -rf $1/$CONF_DIR
domcox@1357 85 status
domcox@1357 86 fi
domcox@1357 87 # Delete PID, sock files
slaxemulator@8751 88 rm -f $1/var/run/bbackupd.*
jozee@3568 89 }