wok annotate boxbackup-server/receipt @ rev 3584
pcmanfm: add tazpkg handler.
pcmanfm/stuff/archiver-tazpkg-support.patch HG: changed
pcmanfm/stuff/icons/Tango/32x32/mimetypes/gnome-mime-application-x-tazpkg.png
pcmanfm/stuff/icons/Tango/32x32/mimetypes/package-x-tazpkg.png HG:
changed pcmanfm/stuff/mime/packages/tazpkg.xml
pcmanfm/stuff/archiver-tazpkg-support.patch HG: changed
pcmanfm/stuff/icons/Tango/32x32/mimetypes/gnome-mime-application-x-tazpkg.png
pcmanfm/stuff/icons/Tango/32x32/mimetypes/package-x-tazpkg.png HG:
changed pcmanfm/stuff/mime/packages/tazpkg.xml
author | Eric Joseph-Alexandre <erjo@slitaz.org> |
---|---|
date | Sat Jun 27 00:24:13 2009 +0200 (2009-06-27) |
parents | a7e71267442a |
children | cf59d85c8bd5 |
rev | line source |
---|---|
domcox@1357 | 1 # SliTaz package receipt. |
domcox@1357 | 2 |
domcox@1357 | 3 PACKAGE="boxbackup-server" |
domcox@1357 | 4 VERSION="0.10" |
domcox@1357 | 5 CATEGORY="network" |
domcox@1357 | 6 SHORT_DESC="Server for the BoxBackup on-line backup system" |
domcox@1357 | 7 MAINTAINER="domcox@users.sourceforge.net" |
domcox@1357 | 8 DEPENDS="db libedit openssl perl zlib" |
domcox@1357 | 9 BUILD_DEPENDS="db-dev libedit-dev openssl-dev zlib-dev" |
domcox@1357 | 10 SOURCE="boxbackup" |
domcox@1357 | 11 TARBALL="$SOURCE-$VERSION.tgz" |
domcox@1357 | 12 WEB_SITE="http://www.boxbackup.org/" |
domcox@1357 | 13 WGET_URL="$SF_MIRROR/$SOURCE/$TARBALL" |
jozee@3568 | 14 TAGS="backup automatic server network" |
domcox@1357 | 15 |
domcox@1357 | 16 # Configuration variables |
domcox@1357 | 17 HOSTNAME=`ifconfig | awk -F ":" '/cast/ {print substr($2,0, index($2," ")-1) }'` |
domcox@1357 | 18 CONF_DIR="/etc/box" |
domcox@1357 | 19 DATA_DIR="/var/lib/bbstored" |
domcox@1357 | 20 CA_DIR="${CONF_DIR}/ca" |
domcox@1357 | 21 BBUSER="bbstored" |
domcox@1357 | 22 |
domcox@1357 | 23 # Rules to configure and make the package. |
domcox@1357 | 24 compile_rules() |
domcox@1357 | 25 { |
domcox@1357 | 26 cd $src |
domcox@1357 | 27 ./configure --prefix=/usr $CONFIGURE_ARGS |
domcox@1357 | 28 make |
domcox@1357 | 29 } |
domcox@1357 | 30 |
domcox@1357 | 31 # Rules to gen a SliTaz package suitable for Tazpkg. |
domcox@1357 | 32 genpkg_rules() |
domcox@1357 | 33 { |
domcox@1357 | 34 _pkg=$WOK/$PACKAGE/${SOURCE}-${VERSION}/parcels/boxbackup-${VERSION}-backup-server-linux-gnu |
domcox@1357 | 35 mkdir -p $fs/usr/bin |
domcox@1357 | 36 cp -a $_pkg/bb* $fs/usr/bin |
domcox@1357 | 37 cp -a $_pkg/ra* $fs/usr/bin |
domcox@1357 | 38 mkdir -p $fs/etc/init.d |
domcox@1357 | 39 cp -a stuff/bbstored $fs/etc/init.d |
domcox@1357 | 40 } |
domcox@1357 | 41 |
domcox@1357 | 42 |
domcox@1357 | 43 # Pre and post install commands for Tazpkg. |
domcox@1357 | 44 |
domcox@1357 | 45 pre_install() |
domcox@1357 | 46 { |
domcox@1357 | 47 # Stop daemon |
domcox@1357 | 48 if [ -e /var/run/bbstored.pid ]; then |
domcox@1357 | 49 /etc/init.d/bbstored stop |
domcox@1357 | 50 fi |
domcox@1357 | 51 } |
domcox@1357 | 52 |
domcox@1357 | 53 post_install() |
domcox@1357 | 54 { |
domcox@1357 | 55 # adduser BBUSER if needed |
domcox@1357 | 56 if ! grep -q $BBUSER $1/etc/passwd; then |
domcox@1357 | 57 echo -n "Adding user '$BBUSER'..." |
domcox@1357 | 58 echo $BBUSER':x:505:505:BoxBackup Network Backup:/dev/null:/bin/false' >> $1/etc/passwd |
domcox@1357 | 59 echo $BBUSER':!:14013:0:99999:7:::' >> $1/etc/shadow |
domcox@1357 | 60 echo $BBUSER':x:505:' >> $1/etc/group |
domcox@1357 | 61 echo $BBUSER':!::' >> $1/etc/gshadow |
domcox@1357 | 62 status |
domcox@1357 | 63 fi |
domcox@1357 | 64 |
domcox@1357 | 65 # Create config is needed |
domcox@1357 | 66 if [ ! -e $CONF_DIR ]; then |
domcox@1357 | 67 mkdir -p $CONF_DIR && chown $BBUSER $CONF_DIR && chmod 700 $CONF_DIR |
domcox@1357 | 68 fi |
domcox@1357 | 69 |
domcox@1357 | 70 if [ ! -e $DATA_DIR/backup ]; then |
domcox@1357 | 71 # Creating backup dir |
domcox@1357 | 72 echo -n "Creating backup directory..." |
domcox@1357 | 73 mkdir -p $DATA_DIR/backup && chown -R $BBUSER $DATA_DIR && chmod -R 700 $DATA_DIR |
domcox@1357 | 74 status |
domcox@1357 | 75 fi |
domcox@1357 | 76 |
domcox@1357 | 77 if [ ! -e $CONF_DIR/raidfile.conf ]; then |
domcox@1357 | 78 # RAID Setup |
domcox@1357 | 79 echo -n "Disabling deprecated userland RAID..." |
domcox@1357 | 80 /usr/bin/raidfile-config $CONF_DIR 2048 $DATA_DIR 2>1 > /dev/null |
domcox@1357 | 81 status |
domcox@1357 | 82 chown -R $BBUSER $CONF_DIR/raidfile.conf && chmod 700 -R $CONF_DIR/raidfile.conf |
domcox@1357 | 83 fi |
domcox@1357 | 84 |
domcox@1357 | 85 if [ ! -e $CONF_DIR/bbstored.conf ]; then |
domcox@1357 | 86 # Setting hostname |
domcox@1357 | 87 echo -n "Setting hostname... " |
domcox@1357 | 88 if [ `hostname -f 2>1 > /dev/null;echo $?` -eq 0 ]; then |
domcox@1357 | 89 HOSTNAME=`hostname -f` |
domcox@1357 | 90 fi |
domcox@1357 | 91 if [ -z $HOSTNAME ]; then |
domcox@1357 | 92 HOSTNAME="127.0.0.1" |
domcox@1357 | 93 fi |
domcox@1357 | 94 echo $HOSTNAME |
domcox@1357 | 95 |
domcox@1357 | 96 # Setting up the CA environment |
domcox@1357 | 97 echo -n "Creating certificates..." |
domcox@1357 | 98 /usr/bin/bbstored-certs $CA_DIR init 2>1 > /dev/null |
domcox@1357 | 99 status |
domcox@1357 | 100 |
domcox@1357 | 101 # Generate server certificate request |
domcox@1357 | 102 echo -n "Generate server certificate request..." |
domcox@1357 | 103 bbstored-config $CONF_DIR $HOSTNAME $BBUSER 2>1 > /dev/null |
domcox@1357 | 104 status |
domcox@1357 | 105 |
domcox@1357 | 106 # Sign the server certificate |
domcox@1357 | 107 echo -n "Sign the server certificate..." |
domcox@1357 | 108 openssl x509 -req -sha1 -extensions usr_crt \ |
domcox@1357 | 109 -in $CONF_DIR/$BBUSER/${HOSTNAME}-csr.pem \ |
domcox@1357 | 110 -CA $CA_DIR/roots/serverCA.pem \ |
domcox@1357 | 111 -CAkey $CA_DIR/keys/serverRootKey.pem \ |
domcox@1357 | 112 -out $CA_DIR/servers/${HOSTNAME}-cert.pem \ |
domcox@1357 | 113 -days 5000 2>1 > /dev/null |
domcox@1357 | 114 status |
domcox@1357 | 115 |
domcox@1357 | 116 # Preparing the server certificates |
domcox@1357 | 117 echo -n "Installing server certificate..." |
domcox@1357 | 118 cp -a $CA_DIR/servers/${HOSTNAME}-cert.pem $CONF_DIR/$BBUSER |
domcox@1357 | 119 status |
domcox@1357 | 120 echo -n "Installing client certificate..." |
domcox@1357 | 121 cp -a $CA_DIR/roots/clientCA.pem $CONF_DIR/$BBUSER |
domcox@1357 | 122 status |
domcox@1357 | 123 |
domcox@1357 | 124 # Securing $CONF_DIR |
domcox@1357 | 125 chown -R $BBUSER $CONF_DIR/bbstored* && chmod 700 -R $CONF_DIR/bbstored* |
domcox@1357 | 126 fi |
domcox@1357 | 127 |
domcox@1357 | 128 if [ -e $CA_DIR ]; then |
domcox@1357 | 129 # Warning |
domcox@1357 | 130 echo |
domcox@1357 | 131 echo "IMPORTANT NOTE:" |
domcox@1357 | 132 echo "--------------" |
domcox@1357 | 133 echo "The certificate authority directory $CA_DIR is intended to be" |
domcox@1357 | 134 echo "moved to another system. It should not be kept on the backup server" |
domcox@1357 | 135 echo "to limit the impact of a server compromise." |
domcox@1357 | 136 fi |
domcox@1357 | 137 } |
domcox@1357 | 138 |
domcox@1357 | 139 # Pre and post remove commands for Tazpkg |
domcox@1357 | 140 |
domcox@1357 | 141 pre_remove() |
domcox@1357 | 142 { |
domcox@1357 | 143 /etc/init.d/bbstored stop |
domcox@1357 | 144 } |
domcox@1357 | 145 |
domcox@1357 | 146 post_remove() |
domcox@1357 | 147 { |
domcox@1357 | 148 if grep -q $BBUSER $1/etc/passwd; then |
domcox@1357 | 149 echo -n "Removing $BBUSER user..." |
domcox@1357 | 150 deluser bbstored |
domcox@1357 | 151 status |
domcox@1357 | 152 fi |
domcox@1357 | 153 # Delete data |
domcox@1357 | 154 if [ -e $DATA_DIR ]; then |
domcox@1357 | 155 echo -n "Removing all backup data..." |
domcox@1357 | 156 rm -r $DATA_DIR |
domcox@1357 | 157 status |
domcox@1357 | 158 fi |
domcox@1357 | 159 # Delete bbstored conf files |
domcox@1357 | 160 if [ -e $CONF_DIR/bbstored.conf ]; then |
domcox@1357 | 161 echo -n "Removing config files..." |
domcox@1357 | 162 rm -rf $CONF_DIR/bbstored |
domcox@1357 | 163 rm -f $CONF_DIR/raidfile.conf |
domcox@1357 | 164 rm -f $CONF_DIR/bbstored.conf |
domcox@1357 | 165 status |
domcox@1357 | 166 fi |
domcox@1357 | 167 # Delete certificates |
domcox@1357 | 168 if [ -e $CA_DIR ]; then |
domcox@1357 | 169 echo -n "Removing certificates..." |
domcox@1357 | 170 rm -r $CA_DIR |
domcox@1357 | 171 status |
domcox@1357 | 172 fi |
domcox@1357 | 173 # Delete $CONF_DIR (if empty) |
domcox@1899 | 174 if [ `ls -lA $CONF_DIR | wc -l` -eq 0 ]; then |
domcox@1357 | 175 echo -n "Removing $CONF_DIR..." |
domcox@1357 | 176 rm -r $CONF_DIR |
domcox@1357 | 177 status |
domcox@1357 | 178 fi |
domcox@1357 | 179 # Delete PID, sock files |
domcox@1357 | 180 rm -f /var/run/bbstored.* |
jozee@3568 | 181 } |