Introducer directory

This commit is contained in:
Bob Mottram 2017-03-04 21:02:02 +00:00
parent fcd30ceef1
commit 22c6850300
1 changed files with 13 additions and 18 deletions

View File

@ -108,7 +108,7 @@ function upgrade_tahoelafs {
} }
function backup_local_tahoelafs { function backup_local_tahoelafs {
source_directory=/home/tahoelafs/.tahoe-introducer source_directory=/home/tahoelafs/data
if [ ! -d $source_directory ]; then if [ ! -d $source_directory ]; then
return return
fi fi
@ -124,20 +124,20 @@ function restore_local_tahoelafs {
systemctl stop tahoelafs systemctl stop tahoelafs
temp_restore_dir=/root/temptahoelafs temp_restore_dir=/root/temptahoelafs
restore_directory_from_usb $temp_restore_dir tahoelafs restore_directory_from_usb $temp_restore_dir tahoelafs
mv /home/tahoelafs/.tahoe-introducer /home/tahoelafs/.tahoe-introducer-old mv /home/tahoelafs/data /home/tahoelafs/data-old
cp -r $temp_restore_dir/home/tahoelafs/.tahoe-introducer /home/tahoelafs/ cp -r $temp_restore_dir/home/tahoelafs/data /home/tahoelafs/data
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
mv /home/tahoelafs/.tahoe-introducer-old /home/tahoelafs/.tahoe-introducer mv /home/tahoelafs/data-old /home/tahoelafs/data
exit 246833 exit 246833
fi fi
rm -rf /home/tahoelafs/.tahoe-introducer rm -rf /home/tahoelafs/data
chown -R tahoelafs:tahoelafs /home/tahoelafs chown -R tahoelafs:tahoelafs /home/tahoelafs
systemctl start tahoelafs systemctl start tahoelafs
echo $"Restore complete" echo $"Restore complete"
} }
function backup_remote_tahoelafs { function backup_remote_tahoelafs {
source_directory=/home/tahoelafs/.tahoe-introducer source_directory=/home/tahoelafs/data
if [ ! -d $source_directory ]; then if [ ! -d $source_directory ]; then
return return
fi fi
@ -153,13 +153,13 @@ function restore_remote_tahoelafs {
systemctl stop tahoelafs systemctl stop tahoelafs
temp_restore_dir=/root/temptahoelafs temp_restore_dir=/root/temptahoelafs
restore_directory_from_friend $temp_restore_dir tahoelafs restore_directory_from_friend $temp_restore_dir tahoelafs
mv /home/tahoelafs/.tahoe-introducer /home/tahoelafs/.tahoe-introducer-old mv /home/tahoelafs/data /home/tahoelafs/data-old
cp -r $temp_restore_dir/home/tahoelafs/.tahoe-introducer /home/tahoelafs/ cp -r $temp_restore_dir/home/tahoelafs/data /home/tahoelafs/data
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
mv /home/tahoelafs/.tahoe-introducer-old /home/tahoelafs/.tahoe-introducer mv /home/tahoelafs/data-old /home/tahoelafs/data
exit 623925 exit 623925
fi fi
rm -rf /home/tahoelafs/.tahoe-introducer-old rm -rf /home/tahoelafs/data-old
chown -R tahoelafs:tahoelafs /home/tahoelafs chown -R tahoelafs:tahoelafs /home/tahoelafs
systemctl start tahoelafs systemctl start tahoelafs
echo $"Restore complete" echo $"Restore complete"
@ -213,10 +213,6 @@ function install_tahoelafs {
rm -rf /home/tahoelafs/Maildir rm -rf /home/tahoelafs/Maildir
fi fi
if [ ! -d /home/tahoelafs/.tahoe-introducer ]; then
mkdir /home/tahoelafs/.tahoe-introducer
fi
git_clone $TAHOELAFS_REPO /home/tahoelafs/tahoelafs git_clone $TAHOELAFS_REPO /home/tahoelafs/tahoelafs
cd /home/tahoelafs/tahoelafs cd /home/tahoelafs/tahoelafs
git checkout $TAHOELAFS_COMMIT -b $TAHOELAFS_COMMIT git checkout $TAHOELAFS_COMMIT -b $TAHOELAFS_COMMIT
@ -246,7 +242,7 @@ function install_tahoelafs {
# create the introducer config # create the introducer config
su -c "$TAHOE_COMMAND create-introducer -C /home/tahoelafs/data --hide-ip --hostname=127.0.0.1" - tahoelafs su -c "$TAHOE_COMMAND create-introducer -C /home/tahoelafs/data --hide-ip --hostname=127.0.0.1" - tahoelafs
TAHOELAFS_CONFIG=/home/tahoelafs/.tahoe-introducer/tahoe.cfg TAHOELAFS_CONFIG=/home/tahoelafs/data/tahoe.cfg
if [ ! -f $TAHOELAFS_CONFIG ]; then if [ ! -f $TAHOELAFS_CONFIG ]; then
exit 62831 exit 62831
fi fi
@ -267,8 +263,8 @@ function install_tahoelafs {
echo "User=tahoelafs" >> $TAHOELAFS_DAEMON_FILE echo "User=tahoelafs" >> $TAHOELAFS_DAEMON_FILE
echo "Group=tahoelafs" >> $TAHOELAFS_DAEMON_FILE echo "Group=tahoelafs" >> $TAHOELAFS_DAEMON_FILE
echo "WorkingDirectory=/home/tahoelafs/tahoelafs" >> $TAHOELAFS_DAEMON_FILE echo "WorkingDirectory=/home/tahoelafs/tahoelafs" >> $TAHOELAFS_DAEMON_FILE
echo "ExecStart=/home/tahoelafs/tahoelafs/venv/bin/tahoe start /home/tahoelafs/data/.tahoe-introducer" >> $TAHOELAFS_DAEMON_FILE echo "ExecStart=/home/tahoelafs/tahoelafs/venv/bin/tahoe start /home/tahoelafs/data" >> $TAHOELAFS_DAEMON_FILE
echo "ExecStop=/home/tahoelafs/tahoelafs/venv/bin/tahoe stop /home/tahoelafs/data/.tahoe-introducer" >> $TAHOELAFS_DAEMON_FILE echo "ExecStop=/home/tahoelafs/tahoelafs/venv/bin/tahoe stop /home/tahoelafs/data" >> $TAHOELAFS_DAEMON_FILE
echo 'Restart=on-failure' >> $TAHOELAFS_DAEMON_FILE echo 'Restart=on-failure' >> $TAHOELAFS_DAEMON_FILE
echo "Environment=\"USER=tahoelafs\" \"HOME=/home/tahoelafs\"" >> $TAHOELAFS_DAEMON_FILE echo "Environment=\"USER=tahoelafs\" \"HOME=/home/tahoelafs\"" >> $TAHOELAFS_DAEMON_FILE
echo '' >> $TAHOELAFS_DAEMON_FILE echo '' >> $TAHOELAFS_DAEMON_FILE
@ -279,7 +275,6 @@ function install_tahoelafs {
systemctl start tahoelafs systemctl start tahoelafs
set_completion_param "tahoelafs commit" "$TAHOELAFS_COMMIT" set_completion_param "tahoelafs commit" "$TAHOELAFS_COMMIT"
install_completed tahoelafs
APP_INSTALLED=1 APP_INSTALLED=1
} }