wok diff boxbackup-server/receipt @ rev 18668

Change messaging... (again); libgtop-dev, libsecret-dev: implicit dependencies don't works?
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Dec 04 17:18:44 2015 +0200 (2015-12-04)
parents 600ae8f0e5e7
children 9e01bc6321ea
line diff
     1.1 --- a/boxbackup-server/receipt	Wed Apr 15 10:45:00 2015 +0200
     1.2 +++ b/boxbackup-server/receipt	Fri Dec 04 17:18:44 2015 +0200
     1.3 @@ -53,7 +53,7 @@
     1.4  pre_install()
     1.5  {
     1.6  	# Stop daemon
     1.7 -	if [ -e /var/run/bbstored.pid ]; then
     1.8 +	if [ -z "$1" -a -e /var/run/bbstored.pid ]; then
     1.9  		/etc/init.d/bbstored stop
    1.10  	fi
    1.11  }
    1.12 @@ -67,7 +67,8 @@
    1.13  
    1.14  	# adduser BBUSER if needed
    1.15  	if  ! grep -q $BBUSER $1/etc/passwd; then
    1.16 -		echo -n "Adding user '$BBUSER'..."
    1.17 +		echo
    1.18 +		action "Adding user '$BBUSER'..."
    1.19  		echo $BBUSER':x:505:505:BoxBackup Network Backup:/dev/null:/bin/false' >> $1/etc/passwd
    1.20  		echo $BBUSER':!:14013:0:99999:7:::' >> $1/etc/shadow
    1.21  		echo $BBUSER':x:505:' >> $1/etc/group
    1.22 @@ -84,7 +85,7 @@
    1.23  
    1.24  	if [ ! -e $1$DATA_DIR/backup ]; then
    1.25  		# Creating backup dir
    1.26 -		echo -n "Creating backup directory..."
    1.27 +		action "Creating backup directory..."
    1.28  		mkdir -p $1$DATA_DIR/backup &&
    1.29  		chroot $1/ chown -R $BBUSER $DATA_DIR &&
    1.30  		chmod -R 700 $1$DATA_DIR
    1.31 @@ -93,7 +94,7 @@
    1.32  
    1.33  	if [ ! -e $1$CONF_DIR/raidfile.conf ]; then
    1.34  		# RAID Setup
    1.35 -		echo -n "Disabling deprecated userland RAID..."
    1.36 +		action "Disabling deprecated userland RAID..."
    1.37  		chroot $1/ /usr/bin/raidfile-config $CONF_DIR 2048 $DATA_DIR 2>1 > /dev/null
    1.38  		status
    1.39  		chroot $1/ chown -R $BBUSER $CONF_DIR/raidfile.conf &&
    1.40 @@ -102,7 +103,7 @@
    1.41  
    1.42  	if [ ! -e $1$CONF_DIR/bbstored.conf ]; then
    1.43  		# Setting hostname
    1.44 -		echo -n "Setting hostname... "
    1.45 +		action "Setting hostname... "
    1.46  		if [ $(chroot $1/ hostname -f 2>1 > /dev/null;echo $?) -eq 0 ]; then
    1.47  			HOSTNAME=$(chroot $1/ hostname -f)
    1.48  		fi
    1.49 @@ -113,17 +114,17 @@
    1.50  		echo $HOSTNAME
    1.51  
    1.52  		# Setting up the CA environment
    1.53 -		echo -n "Creating certificates..."
    1.54 +		action "Creating certificates..."
    1.55  		chroot $1/ /usr/bin/bbstored-certs $CA_DIR init 2>1 > /dev/null
    1.56  		status
    1.57  
    1.58  		# Generate server certificate request
    1.59 -		echo -n "Generate server certificate request..."
    1.60 +		action "Generate server certificate request..."
    1.61  		chroot $1/ bbstored-config $CONF_DIR $HOSTNAME $BBUSER 2>1 > /dev/null
    1.62  		status
    1.63  
    1.64  		# Sign the server certificate
    1.65 -		echo -n "Sign the server certificate..."
    1.66 +		action "Sign the server certificate..."
    1.67  		chroot $1/ openssl x509 -req -sha1 -extensions usr_crt \
    1.68  			-in $CONF_DIR/$BBUSER/${HOSTNAME}-csr.pem \
    1.69  			-CA $CA_DIR/roots/serverCA.pem \
    1.70 @@ -133,10 +134,10 @@
    1.71  		status
    1.72  
    1.73  		# Preparing the server certificates
    1.74 -		echo -n "Installing server certificate..."
    1.75 +		action "Installing server certificate..."
    1.76  		cp -a $1$CA_DIR/servers/${HOSTNAME}-cert.pem $1$CONF_DIR/$BBUSER
    1.77  		status
    1.78 -		echo -n "Installing client certificate..."
    1.79 +		action "Installing client certificate..."
    1.80  		cp -a $1$CA_DIR/roots/clientCA.pem $1$CONF_DIR/$BBUSER
    1.81  		status
    1.82  
    1.83 @@ -165,20 +166,21 @@
    1.84  
    1.85  post_remove()
    1.86  {
    1.87 +	echo
    1.88  	if  grep -q $BBUSER $1/etc/passwd; then
    1.89 -		echo -n "Removing $BBUSER user..."
    1.90 +		action "Removing $BBUSER user..."
    1.91  		deluser bbstored
    1.92  		status
    1.93  	fi
    1.94  	# Delete data
    1.95  	if [ -e $DATA_DIR ]; then
    1.96 -		echo -n "Removing all backup data..."
    1.97 +		action "Removing all backup data..."
    1.98  		rm -r $DATA_DIR
    1.99  		status
   1.100  	fi
   1.101  	# Delete bbstored conf files
   1.102  	if [ -e $CONF_DIR/bbstored.conf ]; then
   1.103 -		echo -n "Removing config files..."
   1.104 +		action "Removing config files..."
   1.105  		rm -rf $CONF_DIR/bbstored
   1.106  		rm -f $CONF_DIR/raidfile.conf
   1.107  		rm -f $CONF_DIR/bbstored.conf
   1.108 @@ -186,13 +188,13 @@
   1.109  	fi
   1.110  	# Delete certificates
   1.111  	if [ -e $CA_DIR ]; then
   1.112 -		echo -n "Removing certificates..."
   1.113 -        rm -r $CA_DIR
   1.114 +		action "Removing certificates..."
   1.115 +		rm -r $CA_DIR
   1.116  		status
   1.117 -    fi
   1.118 +	fi
   1.119  	# Delete $CONF_DIR (if empty)
   1.120  	if [ $(ls -lA $CONF_DIR | wc -l) -eq 0 ]; then
   1.121 -		echo -n "Removing $CONF_DIR..."
   1.122 +		action "Removing $CONF_DIR..."
   1.123  		rm -r $CONF_DIR
   1.124  		status
   1.125  	fi