Skip to content

Commit

Permalink
better clean.sh in permission group
Browse files Browse the repository at this point in the history
  • Loading branch information
phyver committed Jun 17, 2021
1 parent 93fccd9 commit d352f5c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
19 changes: 18 additions & 1 deletion missions/permissions/01_chmod_x_dir_king_quarter/clean.sh
Original file line number Diff line number Diff line change
@@ -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
18 changes: 16 additions & 2 deletions missions/permissions/03_chmod_rw_file_dir_throne_room/clean.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit d352f5c

Please sign in to comment.