wok-current annotate boxbackup-server/receipt @ rev 22942
updated icewm again (1.3.8 -> 1.6.4)
author | Hans-G?nter Theisgen |
---|---|
date | Thu Feb 27 17:34:50 2020 +0100 (2020-02-27) |
parents | cc177a7db8f1 |
children | 5ea0ce1cecc0 |
rev | line source |
---|---|
domcox@1357 | 1 # SliTaz package receipt. |
domcox@1357 | 2 |
domcox@1357 | 3 PACKAGE="boxbackup-server" |
Hans-G?nter@22561 | 4 VERSION="0.12" |
domcox@1357 | 5 CATEGORY="network" |
Hans-G?nter@22561 | 6 TAGS="backup automatic server network" |
Hans-G?nter@22561 | 7 SHORT_DESC="Server for the BoxBackup on-line backup system." |
domcox@12350 | 8 MAINTAINER="domcox@slitaz.org" |
pascal@15202 | 9 LICENSE="GPL2" |
pascal@21601 | 10 WEB_SITE="https://www.boxbackup.org/" |
Hans-G?nter@22561 | 11 |
domcox@1357 | 12 SOURCE="boxbackup" |
Hans-G?nter@22561 | 13 TARBALL="$SOURCE-$VERSION.tar.gz" |
Hans-G?nter@22561 | 14 WGET_URL="https://github.com/$SOURCE/$SOURCE/archive/BoxBackup-$VERSION.master.190831.9e0e93e.tar.gz" |
domcox@1357 | 15 |
Hans-G?nter@22561 | 16 DEPENDS="db gcc-lib-base libedit openssl perl zlib" |
Hans-G?nter@22562 | 17 BUILD_DEPENDS="autoconf automake db-dev libedit-dev libxslt openssl-dev zlib-dev" |
pascal@15202 | 18 |
domcox@1357 | 19 # Configuration variables |
domcox@12350 | 20 HOSTNAME=$(ifconfig | awk -F ":" '/cast/ {print substr($2,0, index($2," ")-1) }') |
domcox@12350 | 21 CONF_DIR="/etc/boxbackup" |
domcox@1357 | 22 DATA_DIR="/var/lib/bbstored" |
domcox@1357 | 23 CA_DIR="${CONF_DIR}/ca" |
domcox@1357 | 24 BBUSER="bbstored" |
domcox@1357 | 25 |
domcox@1357 | 26 # Rules to configure and make the package. |
domcox@1357 | 27 compile_rules() |
domcox@1357 | 28 { |
Hans-G?nter@22561 | 29 ./bootstrap && |
pascal@4998 | 30 ./configure --prefix=/usr $CONFIGURE_ARGS && |
Hans-G?nter@22561 | 31 make -j1 && |
Hans-G?nter@22561 | 32 { |
pascal@9047 | 33 mkdir -p $DESTDIR |
Hans-G?nter@22561 | 34 cp -a parcels/boxbackup-git_-backup-client-i486-slitaz-linux-gnu $DESTDIR |
Hans-G?nter@22561 | 35 cp -a parcels/boxbackup-git_-backup-server-i486-slitaz-linux-gnu $DESTDIR |
Hans-G?nter@22561 | 36 rm -f $DESTDIR/boxbackup-git_-backup-server-i486-slitaz-linux-gnu/*.* |
pascal@9047 | 37 } |
al@19288 | 38 cook_pick_manpages $src/docs/man/* |
domcox@1357 | 39 } |
domcox@1357 | 40 |
domcox@1357 | 41 # Rules to gen a SliTaz package suitable for Tazpkg. |
domcox@1357 | 42 genpkg_rules() |
domcox@1357 | 43 { |
domcox@1357 | 44 mkdir -p $fs/usr/bin |
domcox@1357 | 45 mkdir -p $fs/etc/init.d |
Hans-G?nter@22561 | 46 |
Hans-G?nter@22561 | 47 cp -a $install/boxbackup-git_-backup-server-i486-slitaz-linux-gnu/bb* \ |
Hans-G?nter@22561 | 48 $fs/usr/bin |
Hans-G?nter@22561 | 49 cp -a $install/boxbackup-git_-backup-server-i486-slitaz-linux-gnu/ra* \ |
Hans-G?nter@22561 | 50 $fs/usr/bin |
pankso@9697 | 51 cp -a $stuff/bbstored $fs/etc/init.d |
domcox@1357 | 52 } |
domcox@1357 | 53 |
domcox@1357 | 54 |
domcox@1357 | 55 # Pre and post install commands for Tazpkg. |
domcox@1357 | 56 |
domcox@1357 | 57 pre_install() |
domcox@1357 | 58 { |
domcox@1357 | 59 # Stop daemon |
Hans-G?nter@22561 | 60 if [ -z "$1" -a -e /var/run/bbstored.pid ] |
Hans-G?nter@22561 | 61 then |
domcox@1357 | 62 /etc/init.d/bbstored stop |
domcox@1357 | 63 fi |
domcox@1357 | 64 } |
domcox@1357 | 65 |
domcox@1357 | 66 post_install() |
domcox@1357 | 67 { |
Hans-G?nter@22561 | 68 # default configuration directory is now /etc/boxbackup |
Hans-G?nter@22561 | 69 if [ ! -e "$1/etc/box/bbstored.conf" ] |
Hans-G?nter@22561 | 70 then |
pascal@18732 | 71 mv "$1/etc/box" "$1$CONF_DIR" |
domcox@12350 | 72 fi |
domcox@12350 | 73 |
domcox@1357 | 74 # adduser BBUSER if needed |
Hans-G?nter@22561 | 75 if ! grep -q $BBUSER "$1/etc/passwd" |
Hans-G?nter@22561 | 76 then |
al@18668 | 77 echo |
al@18668 | 78 action "Adding user '$BBUSER'..." |
pascal@18730 | 79 echo $BBUSER':x:505:505:BoxBackup Network Backup:/dev/null:/bin/false' >> "$1/etc/passwd" |
pascal@18730 | 80 echo $BBUSER':!:14013:0:99999:7:::' >> "$1/etc/shadow" |
pascal@18730 | 81 echo $BBUSER':x:505:' >> "$1/etc/group" |
pascal@18730 | 82 echo $BBUSER':!::' >> "$1/etc/gshadow" |
domcox@1357 | 83 status |
domcox@1357 | 84 fi |
domcox@1357 | 85 |
Hans-G?nter@22561 | 86 # Create configuration as needed |
Hans-G?nter@22561 | 87 if [ ! -e "$1$CONF_DIR" ] |
Hans-G?nter@22561 | 88 then |
pascal@18730 | 89 mkdir -p "$1$CONF_DIR" && |
pascal@18730 | 90 chroot "$1/" chown $BBUSER $CONF_DIR && |
pascal@18730 | 91 chmod 700 "$1$CONF_DIR" |
domcox@1357 | 92 fi |
domcox@1357 | 93 |
Hans-G?nter@22561 | 94 if [ ! -e "$1$DATA_DIR/backup" ] |
Hans-G?nter@22561 | 95 then |
Hans-G?nter@22561 | 96 # Creating backup directory |
al@18668 | 97 action "Creating backup directory..." |
pascal@18730 | 98 mkdir -p "$1$DATA_DIR/backup" && |
pascal@18730 | 99 chroot "$1/" chown -R $BBUSER $DATA_DIR && |
pascal@18730 | 100 chmod -R 700 "$1$DATA_DIR" |
domcox@1357 | 101 status |
domcox@1357 | 102 fi |
domcox@1357 | 103 |
Hans-G?nter@22561 | 104 if [ ! -e "$1$CONF_DIR/raidfile.conf" ] |
Hans-G?nter@22561 | 105 then |
domcox@1357 | 106 # RAID Setup |
al@18668 | 107 action "Disabling deprecated userland RAID..." |
pascal@18730 | 108 chroot "$1/" /usr/bin/raidfile-config $CONF_DIR 2048 $DATA_DIR 2>1 > /dev/null |
domcox@1357 | 109 status |
pascal@18730 | 110 chroot "$1/" chown -R $BBUSER $CONF_DIR/raidfile.conf && |
pascal@18730 | 111 chmod 700 -R "$1$CONF_DIR/raidfile.conf" |
domcox@1357 | 112 fi |
domcox@1357 | 113 |
Hans-G?nter@22561 | 114 if [ ! -e "$1$CONF_DIR/bbstored.conf" ] |
Hans-G?nter@22561 | 115 then |
domcox@1357 | 116 # Setting hostname |
al@18668 | 117 action "Setting hostname... " |
Hans-G?nter@22561 | 118 if [ $(chroot "$1/" hostname -f 2>1 > /dev/null;echo $?) -eq 0 ] |
Hans-G?nter@22561 | 119 then |
pascal@18730 | 120 HOSTNAME=$(chroot "$1/" hostname -f) |
domcox@1357 | 121 fi |
Hans-G?nter@22561 | 122 if [ -z $HOSTNAME ] |
Hans-G?nter@22561 | 123 then |
domcox@1357 | 124 HOSTNAME="127.0.0.1" |
domcox@1357 | 125 fi |
pascal@17940 | 126 export $HOSTNAME |
domcox@1357 | 127 echo $HOSTNAME |
domcox@1357 | 128 |
domcox@1357 | 129 # Setting up the CA environment |
al@18668 | 130 action "Creating certificates..." |
pascal@18730 | 131 chroot "$1/" /usr/bin/bbstored-certs $CA_DIR init 2>1 > /dev/null |
domcox@1357 | 132 status |
domcox@1357 | 133 |
domcox@1357 | 134 # Generate server certificate request |
al@18668 | 135 action "Generate server certificate request..." |
pascal@18730 | 136 chroot "$1/" bbstored-config $CONF_DIR $HOSTNAME $BBUSER 2>1 > /dev/null |
domcox@1357 | 137 status |
domcox@1357 | 138 |
domcox@1357 | 139 # Sign the server certificate |
al@18668 | 140 action "Sign the server certificate..." |
Hans-G?nter@22561 | 141 chroot "$1/" openssl x509 -req -sha1 -extensions usr_crt \ |
Hans-G?nter@22561 | 142 -in $CONF_DIR/$BBUSER/${HOSTNAME}-csr.pem \ |
Hans-G?nter@22561 | 143 -CA $CA_DIR/roots/serverCA.pem \ |
Hans-G?nter@22561 | 144 -CAkey $CA_DIR/keys/serverRootKey.pem \ |
Hans-G?nter@22561 | 145 -out $CA_DIR/servers/${HOSTNAME}-cert.pem \ |
domcox@1357 | 146 -days 5000 2>1 > /dev/null |
domcox@1357 | 147 status |
domcox@1357 | 148 |
domcox@1357 | 149 # Preparing the server certificates |
al@18668 | 150 action "Installing server certificate..." |
Hans-G?nter@22561 | 151 cp -a "$1$CA_DIR/servers/${HOSTNAME}-cert.pem" \ |
Hans-G?nter@22561 | 152 "$1$CONF_DIR/$BBUSER" |
domcox@1357 | 153 status |
al@18668 | 154 action "Installing client certificate..." |
Hans-G?nter@22561 | 155 cp -a "$1$CA_DIR/roots/clientCA.pem" \ |
Hans-G?nter@22561 | 156 "$1$CONF_DIR/$BBUSER" |
domcox@1357 | 157 status |
domcox@1357 | 158 |
domcox@1357 | 159 # Securing $CONF_DIR |
pascal@18730 | 160 chroot "$1/" chown -R $BBUSER $CONF_DIR/bbstored* && |
pascal@18730 | 161 chmod 700 -R "$1$CONF_DIR/bbstored"* |
domcox@1357 | 162 fi |
domcox@1357 | 163 |
Hans-G?nter@22561 | 164 if [ -e "$1$CA_DIR" ] |
Hans-G?nter@22561 | 165 then |
domcox@1357 | 166 # Warning |
domcox@1357 | 167 echo |
domcox@1357 | 168 echo "IMPORTANT NOTE:" |
domcox@1357 | 169 echo "--------------" |
domcox@1357 | 170 echo "The certificate authority directory $CA_DIR is intended to be" |
domcox@1357 | 171 echo "moved to another system. It should not be kept on the backup server" |
domcox@1357 | 172 echo "to limit the impact of a server compromise." |
domcox@1357 | 173 fi |
domcox@1357 | 174 } |
domcox@1357 | 175 |
domcox@1357 | 176 # Pre and post remove commands for Tazpkg |
domcox@1357 | 177 |
domcox@1357 | 178 pre_remove() |
domcox@1357 | 179 { |
domcox@1357 | 180 /etc/init.d/bbstored stop |
domcox@1357 | 181 } |
domcox@1357 | 182 |
domcox@1357 | 183 post_remove() |
domcox@1357 | 184 { |
al@18668 | 185 echo |
Hans-G?nter@22561 | 186 if grep -q $BBUSER /etc/passwd |
Hans-G?nter@22561 | 187 then |
al@18668 | 188 action "Removing $BBUSER user..." |
domcox@1357 | 189 deluser bbstored |
domcox@1357 | 190 status |
domcox@1357 | 191 fi |
Hans-G?nter@22561 | 192 |
domcox@1357 | 193 # Delete data |
Hans-G?nter@22561 | 194 if [ -e $DATA_DIR ] |
Hans-G?nter@22561 | 195 then |
al@18668 | 196 action "Removing all backup data..." |
domcox@1357 | 197 rm -r $DATA_DIR |
domcox@1357 | 198 status |
domcox@1357 | 199 fi |
Hans-G?nter@22561 | 200 |
Hans-G?nter@22561 | 201 # Delete bbstored configuration files |
Hans-G?nter@22561 | 202 if [ -e $CONF_DIR/bbstored.conf ] |
Hans-G?nter@22561 | 203 then |
al@18668 | 204 action "Removing config files..." |
domcox@1357 | 205 rm -rf $CONF_DIR/bbstored |
domcox@1357 | 206 rm -f $CONF_DIR/raidfile.conf |
domcox@1357 | 207 rm -f $CONF_DIR/bbstored.conf |
domcox@1357 | 208 status |
domcox@1357 | 209 fi |
Hans-G?nter@22561 | 210 |
domcox@1357 | 211 # Delete certificates |
Hans-G?nter@22561 | 212 if [ -e $CA_DIR ] |
Hans-G?nter@22561 | 213 then |
al@18668 | 214 action "Removing certificates..." |
al@18668 | 215 rm -r $CA_DIR |
domcox@1357 | 216 status |
al@18668 | 217 fi |
Hans-G?nter@22561 | 218 |
domcox@1357 | 219 # Delete $CONF_DIR (if empty) |
Hans-G?nter@22561 | 220 if [ $(ls -lA $CONF_DIR | wc -l) -eq 0 ] |
Hans-G?nter@22561 | 221 then |
al@18668 | 222 action "Removing $CONF_DIR..." |
domcox@1357 | 223 rm -r $CONF_DIR |
domcox@1357 | 224 status |
domcox@1357 | 225 fi |
Hans-G?nter@22561 | 226 |
domcox@1357 | 227 # Delete PID, sock files |
domcox@1357 | 228 rm -f /var/run/bbstored.* |
jozee@3568 | 229 } |