mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
run pre_install for restore on fresh container
This commit is contained in:
parent
c33809c737
commit
921501560b
1 changed files with 22 additions and 0 deletions
|
@ -1462,6 +1462,28 @@ CHECK_BACKUP_RESTORE () {
|
||||||
# Uses the default snapshot
|
# Uses the default snapshot
|
||||||
current_snapshot=snap0
|
current_snapshot=snap0
|
||||||
|
|
||||||
|
# Exec the pre-install instruction, if there one
|
||||||
|
if [ -n "$pre_install" ]
|
||||||
|
then
|
||||||
|
ECHO_FORMAT "Pre installation request\n" "white" "bold" clog
|
||||||
|
# Start the lxc container
|
||||||
|
LXC_START "true"
|
||||||
|
# Copy all the instructions into a script
|
||||||
|
echo "$pre_install" > "$script_dir/preinstall.sh"
|
||||||
|
chmod +x "$script_dir/preinstall.sh"
|
||||||
|
# Replace variables
|
||||||
|
sed -i "s/\$USER/$test_user/" "$script_dir/preinstall.sh"
|
||||||
|
sed -i "s/\$DOMAIN/$main_domain/" "$script_dir/preinstall.sh"
|
||||||
|
sed -i "s/\$SUBDOMAIN/$sub_domain/" "$script_dir/preinstall.sh"
|
||||||
|
sed -i "s/\$PASSWORD/$yuno_pwd/" "$script_dir/preinstall.sh"
|
||||||
|
# Copy the pre-install script into the container.
|
||||||
|
scp -rq "$script_dir/preinstall.sh" "$lxc_name":
|
||||||
|
# Then execute the script to execute the pre-install commands.
|
||||||
|
LXC_START "./preinstall.sh >&2"
|
||||||
|
# Print the log to print the results
|
||||||
|
ECHO_FORMAT "$(cat "$temp_log")\n" clog
|
||||||
|
fi
|
||||||
|
|
||||||
# Remove the previous residual backups
|
# Remove the previous residual backups
|
||||||
sudo rm -rf /var/lib/lxcsnaps/$lxc_name/$current_snapshot/rootfs/home/yunohost.backup/archives
|
sudo rm -rf /var/lib/lxcsnaps/$lxc_name/$current_snapshot/rootfs/home/yunohost.backup/archives
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue