diff --git a/missions/permissions/01_chmod_x_dir_king_quarter/clean.sh b/missions/permissions/01_chmod_x_dir_king_quarter/clean.sh index d440118f..a64ee5e9 100644 --- a/missions/permissions/01_chmod_x_dir_king_quarter/clean.sh +++ b/missions/permissions/01_chmod_x_dir_king_quarter/clean.sh @@ -1,4 +1,21 @@ #!/bin/bash +king_quarter=$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room/Kings_quarter') + +case "$GSH_LAST_ACTION" in + "check_true") + : + ;; + *) + _PWD="$(realpath $(pwd) 2>/dev/null)" + if [ -n "$_PWD" ] && [ "$_PWD" = "$(realpath "$king_quarter" 2>/dev/null)" ] + then + cd .. + fi + unset _PWD + ;; +esac + # avoid problems when making a tar archive -chmod +x "$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room/Kings_quarter')" +chmod +x "$king_quarter" +unset king_quarter diff --git a/missions/permissions/03_chmod_rw_file_dir_throne_room/clean.sh b/missions/permissions/03_chmod_rw_file_dir_throne_room/clean.sh index 89da520f..9fe15313 100644 --- a/missions/permissions/03_chmod_rw_file_dir_throne_room/clean.sh +++ b/missions/permissions/03_chmod_rw_file_dir_throne_room/clean.sh @@ -1,8 +1,22 @@ #!/bin/bash -# avoid problems when making a tar archive safe="$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room')/$(gettext "Safe")" -mkdir -p "$safe" + +case "$GSH_LAST_ACTION" in + "check_true") + : + ;; + *) + _PWD="$(realpath $(pwd) 2>/dev/null)" + if [ -n "$_PWD" ] && [ "$_PWD" = "$(realpath "$safe" 2>/dev/null)" ] + then + cd "$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room')" + fi + unset _PWD + ;; +esac + +# avoid problems when making a tar archive chmod 755 "$safe" chmod -f 644 "$safe/$(gettext "crown")" 2>/dev/null rm -f "$GSH_VAR/crown"