mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Fix hostname & liste non triée
This commit is contained in:
parent
f663f69f27
commit
ff74d283a6
1 changed files with 7 additions and 4 deletions
|
@ -19,16 +19,16 @@ create_temp_backup () {
|
||||||
# Create a temporary snapshot
|
# Create a temporary snapshot
|
||||||
|
|
||||||
# Check all the witness files, to verify if them still here
|
# Check all the witness files, to verify if them still here
|
||||||
check_witness_files
|
check_witness_files >&2
|
||||||
|
|
||||||
# Stop the container, before its snapshot
|
# Stop the container, before its snapshot
|
||||||
sudo lxc-stop --name $lxc_name
|
sudo lxc-stop --name $lxc_name >&2
|
||||||
|
|
||||||
# Create the snapshot.
|
# Create the snapshot.
|
||||||
sudo lxc-snapshot --name $lxc_name >> "$test_result" 2>&1
|
sudo lxc-snapshot --name $lxc_name >> "$test_result" 2>&1
|
||||||
|
|
||||||
# Get the last created snapshot and return it
|
# Get the last created snapshot and return it
|
||||||
echo "$(sudo lxc-snapshot --name $lxc_name --list | head --lines=1 | cut --delimiter=' ' --fields=1)"
|
sudo lxc-snapshot --name $lxc_name --list | sort | tail --lines=1 | cut --delimiter=' ' --fields=1
|
||||||
|
|
||||||
# Restart the container, after the snapshot
|
# Restart the container, after the snapshot
|
||||||
LXC_START "true" >&2
|
LXC_START "true" >&2
|
||||||
|
@ -39,6 +39,9 @@ use_temp_snapshot () {
|
||||||
# $1 = Name of the snapshot to use
|
# $1 = Name of the snapshot to use
|
||||||
local snapshot_name=$1
|
local snapshot_name=$1
|
||||||
|
|
||||||
|
# Fix the missing hostname in the hosts file...
|
||||||
|
echo "127.0.0.1 $lxc_name" | sudo tee --append "$snapshot_path/$snapshot_name/rootfs/etc/hosts" > /dev/null
|
||||||
|
|
||||||
# Restore this snapshot.
|
# Restore this snapshot.
|
||||||
sudo rsync --acls --archive --delete --executability --itemize-changes --xattrs "$snapshot_path/$snapshot_name/rootfs/" "/var/lib/lxc/$lxc_name/rootfs/" > /dev/null 2>> "$test_result"
|
sudo rsync --acls --archive --delete --executability --itemize-changes --xattrs "$snapshot_path/$snapshot_name/rootfs/" "/var/lib/lxc/$lxc_name/rootfs/" > /dev/null 2>> "$test_result"
|
||||||
|
|
||||||
|
@ -51,7 +54,7 @@ destroy_temporary_snapshot () {
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
local snapshot=$(sudo lxc-snapshot --name $lxc_name --list | head --lines=1 | cut --delimiter=' ' --fields=1)
|
local snapshot=$(sudo lxc-snapshot --name $lxc_name --list | sort | tail --lines=1 | cut --delimiter=' ' --fields=1)
|
||||||
if [ -n "$snapshot" ] && [ "$snapshot" != "snap0" ]
|
if [ -n "$snapshot" ] && [ "$snapshot" != "snap0" ]
|
||||||
then
|
then
|
||||||
echo "Destroy temporary snapshot $snapshot."
|
echo "Destroy temporary snapshot $snapshot."
|
||||||
|
|
Loading…
Add table
Reference in a new issue