Compare commits
2 commits
be9750131a
...
09ec143d68
Author | SHA1 | Date | |
---|---|---|---|
09ec143d68 | |||
eb326ce1cb |
3 changed files with 23 additions and 3 deletions
|
@ -14,7 +14,7 @@ function backupAction -V dir
|
|||
end
|
||||
|
||||
set -l deployScript (getDeploymentScript)
|
||||
initConfig --action backup
|
||||
initBackupConfig --action backup
|
||||
|
||||
runHook backupSoftware || begin
|
||||
echo "Backing up software..."
|
||||
|
|
|
@ -8,6 +8,7 @@ function runSetup
|
|||
|
||||
function setupAction -V projectRoot -V PROJECT_CLONE_ROOT
|
||||
source "$dir/../../lib/hooks.fish"
|
||||
source "$dir/../../lib/restoration.fish"
|
||||
source "$dir/../../lib/settings.fish"
|
||||
set -l mountDir (getOSConfig partition.rootDir)
|
||||
set -l script (mktemp)
|
||||
|
@ -39,6 +40,14 @@ function runSetup
|
|||
"$argv"
|
||||
end
|
||||
|
||||
initBackupConfig --action restore
|
||||
|
||||
if [ -n "$VALHALLA_BACKUP_SERVER_KEY" ]
|
||||
set -l knownHosts /root/.ssh/known_hosts
|
||||
cp "$VALHALLA_BACKUP_SERVER_KEY" "$mountDir$VALHALLA_BACKUP_SERVER_KEY"
|
||||
cp $knownHosts "$mountDir$knownHosts"
|
||||
end
|
||||
|
||||
and echo "Cloning project..."
|
||||
and source "$dir/../../lib/copy-repo.fish" "$mountDir$PROJECT_CLONE_ROOT"
|
||||
runChroot "$mountDir" git config --system --add safe.directory "$PROJECT_CLONE_ROOT"
|
||||
|
@ -52,7 +61,18 @@ function runSetup
|
|||
|
||||
wrapScript (
|
||||
string join " " \
|
||||
"CONFIG_NAME=$(string escape "$CONFIG_NAME")" \
|
||||
(begin
|
||||
for var in \
|
||||
CONFIG_NAME \
|
||||
VALHALLA_BACKUP_DISABLED \
|
||||
VALHALLA_BACKUP_DIR \
|
||||
VALHALLA_BACKUP_SERVER \
|
||||
VALHALLA_BACKUP_SERVER_PORT \
|
||||
VALHALLA_BACKUP_SERVER_USER \
|
||||
VALHALLA_BACKUP_SERVER_KEY
|
||||
echo "$var=$(string escape "$$var")"
|
||||
end
|
||||
end) \
|
||||
(string escape $script))
|
||||
|
||||
end | runChroot "$mountDir" tee /root/.bash_profile >/dev/null
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
set -l dir (status dirname)
|
||||
|
||||
function initConfig -V dir -d "Fetches the configuration by prompting the user to "
|
||||
function initBackupConfig -V dir -d "Fetches the configuration by prompting the user to "
|
||||
set -l disabled VALHALLA_BACKUP_DISABLED
|
||||
|
||||
if [ -z "$$disabled" ]
|
||||
|
|
Loading…
Reference in a new issue