wok-6.x rev 17940
boxbackup-server, nagisk, privoxy: fix post_install
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Apr 15 10:26:28 2015 +0200 (2015-04-15) |
parents | 49a446459762 |
children | 600ae8f0e5e7 |
files | boxbackup-server/receipt nagisk/receipt privoxy/receipt |
line diff
1.1 --- a/boxbackup-server/receipt Wed Apr 15 09:53:08 2015 +0200 1.2 +++ b/boxbackup-server/receipt Wed Apr 15 10:26:28 2015 +0200 1.3 @@ -62,8 +62,8 @@ 1.4 post_install() 1.5 { 1.6 # default conf dir is now /etc/boxbackup 1.7 - if [ ! -e /etc/box/bbstored.conf ]; then 1.8 - mv /etc/box $CONF_DIR 1.9 + if [ ! -e $1/etc/box/bbstored.conf ]; then 1.10 + mv $1/etc/box $1$CONF_DIR 1.11 fi 1.12 1.13 # adduser BBUSER if needed 1.14 @@ -77,49 +77,55 @@ 1.15 fi 1.16 1.17 # Create config is needed 1.18 - if [ ! -e $CONF_DIR ]; then 1.19 - mkdir -p $CONF_DIR && chown $BBUSER $CONF_DIR && chmod 700 $CONF_DIR 1.20 + if [ ! -e $1$CONF_DIR ]; then 1.21 + mkdir -p $1$CONF_DIR && 1.22 + chroot $1/ chown $BBUSER $CONF_DIR && 1.23 + chmod 700 $1$CONF_DIR 1.24 fi 1.25 1.26 - if [ ! -e $DATA_DIR/backup ]; then 1.27 + if [ ! -e $1$DATA_DIR/backup ]; then 1.28 # Creating backup dir 1.29 echo -n "Creating backup directory..." 1.30 - mkdir -p $DATA_DIR/backup && chown -R $BBUSER $DATA_DIR && chmod -R 700 $DATA_DIR 1.31 + mkdir -p $1$DATA_DIR/backup && 1.32 + chroot $1/ chown -R $BBUSER $DATA_DIR && 1.33 + chmod -R 700 $1$DATA_DIR 1.34 status 1.35 fi 1.36 1.37 - if [ ! -e $CONF_DIR/raidfile.conf ]; then 1.38 + if [ ! -e $1$CONF_DIR/raidfile.conf ]; then 1.39 # RAID Setup 1.40 echo -n "Disabling deprecated userland RAID..." 1.41 - /usr/bin/raidfile-config $CONF_DIR 2048 $DATA_DIR 2>1 > /dev/null 1.42 + chroot $1/ /usr/bin/raidfile-config $CONF_DIR 2048 $DATA_DIR 2>1 > /dev/null 1.43 status 1.44 - chown -R $BBUSER $CONF_DIR/raidfile.conf && chmod 700 -R $CONF_DIR/raidfile.conf 1.45 + chroot $1/ chown -R $BBUSER $CONF_DIR/raidfile.conf && 1.46 + chmod 700 -R $1$CONF_DIR/raidfile.conf 1.47 fi 1.48 1.49 - if [ ! -e $CONF_DIR/bbstored.conf ]; then 1.50 + if [ ! -e $1$CONF_DIR/bbstored.conf ]; then 1.51 # Setting hostname 1.52 echo -n "Setting hostname... " 1.53 - if [ $(hostname -f 2>1 > /dev/null;echo $?) -eq 0 ]; then 1.54 - HOSTNAME=$(hostname -f) 1.55 + if [ $(chroot $1/ hostname -f 2>1 > /dev/null;echo $?) -eq 0 ]; then 1.56 + HOSTNAME=$(chroot $1/ hostname -f) 1.57 fi 1.58 if [ -z $HOSTNAME ]; then 1.59 HOSTNAME="127.0.0.1" 1.60 fi 1.61 + export $HOSTNAME 1.62 echo $HOSTNAME 1.63 1.64 # Setting up the CA environment 1.65 echo -n "Creating certificates..." 1.66 - /usr/bin/bbstored-certs $CA_DIR init 2>1 > /dev/null 1.67 + chroot $1/ /usr/bin/bbstored-certs $CA_DIR init 2>1 > /dev/null 1.68 status 1.69 1.70 # Generate server certificate request 1.71 echo -n "Generate server certificate request..." 1.72 - bbstored-config $CONF_DIR $HOSTNAME $BBUSER 2>1 > /dev/null 1.73 + chroot $1/ bbstored-config $CONF_DIR $HOSTNAME $BBUSER 2>1 > /dev/null 1.74 status 1.75 1.76 # Sign the server certificate 1.77 echo -n "Sign the server certificate..." 1.78 - openssl x509 -req -sha1 -extensions usr_crt \ 1.79 + chroot $1/ openssl x509 -req -sha1 -extensions usr_crt \ 1.80 -in $CONF_DIR/$BBUSER/${HOSTNAME}-csr.pem \ 1.81 -CA $CA_DIR/roots/serverCA.pem \ 1.82 -CAkey $CA_DIR/keys/serverRootKey.pem \ 1.83 @@ -129,14 +135,15 @@ 1.84 1.85 # Preparing the server certificates 1.86 echo -n "Installing server certificate..." 1.87 - cp -a $CA_DIR/servers/${HOSTNAME}-cert.pem $CONF_DIR/$BBUSER 1.88 + cp -a $1$CA_DIR/servers/${HOSTNAME}-cert.pem $1$CONF_DIR/$BBUSER 1.89 status 1.90 echo -n "Installing client certificate..." 1.91 - cp -a $CA_DIR/roots/clientCA.pem $CONF_DIR/$BBUSER 1.92 + cp -a $1$CA_DIR/roots/clientCA.pem $1$CONF_DIR/$BBUSER 1.93 status 1.94 1.95 # Securing $CONF_DIR 1.96 - chown -R $BBUSER $CONF_DIR/bbstored* && chmod 700 -R $CONF_DIR/bbstored* 1.97 + chroot $1/ chown -R $BBUSER $CONF_DIR/bbstored* &&i 1.98 + chmod 700 -R $1$CONF_DIR/bbstored* 1.99 fi 1.100 1.101 if [ -e $CA_DIR ]; then
2.1 --- a/nagisk/receipt Wed Apr 15 09:53:08 2015 +0200 2.2 +++ b/nagisk/receipt Wed Apr 15 10:26:28 2015 +0200 2.3 @@ -44,5 +44,5 @@ 2.4 cat >> $1/etc/sudoers <<EOT 2.5 nagios ALL=NOPASSWD: /usr/sbin/asterisk 2.6 EOT 2.7 - chown nagios:nagios $1/usr/share/nagios/libexec/nagisk.pl 2.8 + chroot $1/ chown nagios:nagios /usr/share/nagios/libexec/nagisk.pl 2.9 }
3.1 --- a/privoxy/receipt Wed Apr 15 09:53:08 2015 +0200 3.2 +++ b/privoxy/receipt Wed Apr 15 10:26:28 2015 +0200 3.3 @@ -65,10 +65,10 @@ 3.4 3.5 # and change file permissions 3.6 echo -n "Changing file permissions..." 3.7 - chown -R privoxy.privoxy $1/etc/privoxy 3.8 + chroot $1/ chown -R privoxy.privoxy $1/etc/privoxy 3.9 chown -R root.root $1/etc/privoxy/templates 3.10 chown root.root $1/etc/privoxy 3.11 - chown privoxy.privoxy $1/var/log/privoxy/logfile 3.12 + chroot $1/ chown privoxy.privoxy $1/var/log/privoxy/logfile 3.13 status 3.14 } 3.15