From: Chris Koeritz Date: Sun, 7 Jan 2018 16:52:51 +0000 (-0500) Subject: swapped where chown is done X-Git-Tag: 2.140.107^2~2^2~6 X-Git-Url: https://feistymeow.org/gitweb/?p=feisty_meow.git;a=commitdiff_plain;h=c23e331e8872360bb47049f0da925e0a2c6fd9df swapped where chown is done powerup is not supposed to need sudo access. the chown operation does need it though. also made the code for chown more specific to folder being operated on, rather than operating on entire apps hierarchy. --- diff --git a/scripts/site_avenger/powerup.sh b/scripts/site_avenger/powerup.sh index ff2a9944..3709bc30 100644 --- a/scripts/site_avenger/powerup.sh +++ b/scripts/site_avenger/powerup.sh @@ -103,20 +103,5 @@ create_site_links "$site_store_path" "$theme_name" sep -# go with the default user running the script. -user_name=$USER -if [ ! -z "$user_name" -a "$user_name" != "root" ]; then - echo "Chowning the apps folder to be owned by: $user_name" -#hmmm: have to hope for now for standard group named after user - chown -R "$user_name:$user_name" "$BASE_APPLICATION_PATH" - test_or_die "Chowning $BASE_APPLICATION_PATH to be owned by $user_name" - -else -echo "user name failed checks for chowning, was '$user_name'" -fi - -sep - - echo "Finished powering up the site in '${app_dirname}'." diff --git a/scripts/site_avenger/shared_site_mgr.sh b/scripts/site_avenger/shared_site_mgr.sh index 3f73b3a8..a82ae98d 100644 --- a/scripts/site_avenger/shared_site_mgr.sh +++ b/scripts/site_avenger/shared_site_mgr.sh @@ -351,4 +351,26 @@ function update_composer_repository() fi } +# fixes the ownership for a site avenger or php application. +# this almost certainly will require sudo capability, if there are any ownership problems +# that need to be resolved. +function fix_ownership() +{ + local appsdir="$1"; shift + local dir="$1"; shift + + local combo="$appsdir/$dir" + + # go with the default user running the script. + user_name="$USER" + if [ ! -z "$user_name" -a "$user_name" != "root" ]; then + echo "Chowning the apps folder to be owned by: $user_name" +#hmmm: have to hope for now for standard group named after user + chown -R "$user_name:$user_name" "$combo" + test_or_die "Chowning $combo to be owned by $user_name" + else + echo "user name failed checks for chowning, was found as '$user_name'" + fi +} + diff --git a/scripts/site_avenger/standup.sh b/scripts/site_avenger/standup.sh index 5adfcc63..a9b1a91b 100644 --- a/scripts/site_avenger/standup.sh +++ b/scripts/site_avenger/standup.sh @@ -89,8 +89,12 @@ sep #echo default repo is "$DEFAULT_REPOSITORY_ROOT" powerup "$APPLICATION_NAME" "$REPO_NAME" "$THEME_NAME" -# pass the real user name who should own the files. -# "$(logname)" + +sep + +# hmmm: pass the real user name who should own the files? +# hmmm: "$(logname)" $USER works, but logname wasn't? +fix_ownership "$BASE_APPLICATION_PATH" "$APPLICATION_NAME" sep