mirror of
https://github.com/YunoHost/install_script.git
synced 2024-09-03 20:06:25 +02:00
adding rollback feature of the config files (only if install haven't started yet)
This commit is contained in:
parent
918647940e
commit
7c744aa45a
1 changed files with 7 additions and 4 deletions
|
@ -7,8 +7,10 @@ function bck {
|
|||
cp -r --preserve=all "$FULLPATH" "$DST/$(basename $FULLPATH)"
|
||||
}
|
||||
|
||||
function restore {
|
||||
# TODO
|
||||
function rst {
|
||||
[[ ! -d "$LEGACY" ]] && echo >&2 "Rollback failed : Unknown folder $LEGACY" && exit $ERR_FAIL_RESTORE
|
||||
mv -fv "$LEGACY"/* /
|
||||
[[ $? -ne 0 ]] && echo >&2 "Rollback failed" && exit $ERR_FAIL_RESTORE
|
||||
}
|
||||
|
||||
# TODO : test if the script is executed as root
|
||||
|
@ -113,8 +115,9 @@ then
|
|||
if [[ $? -ne 0 ]]
|
||||
then
|
||||
# TODO : rollback (restore legacy configuration for hostname, sources.list, ...)
|
||||
echo "Update Repo Failure"
|
||||
exit 1
|
||||
echo "Update Repo Failure : Rolling back"
|
||||
rst "$LEGACY"
|
||||
exit $ERR_FAIL_UPDATE
|
||||
fi
|
||||
|
||||
echo "======== Install ========"
|
||||
|
|
Loading…
Add table
Reference in a new issue