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.
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}'."
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
+}
+
#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