X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fcustomize%2Ffred%2Frefred.sh;h=908e3bd5494be376a71abf16bc32e2007f146c4d;hb=7ec00037df7da86467d3a497d048b72e8102037e;hp=8d951919b0b671905e728b7314fbda99c1c38be0;hpb=36787833c69e28f8238dbffa439a7d347b136859;p=feisty_meow.git diff --git a/scripts/customize/fred/refred.sh b/scripts/customize/fred/refred.sh index 8d951919..908e3bd5 100644 --- a/scripts/customize/fred/refred.sh +++ b/scripts/customize/fred/refred.sh @@ -1,9 +1,41 @@ #!/bin/bash -# cleans up the ownership for all my files. +#source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" + +# cleans up the ownership for all my files and dirs. function refred() { - sudo chown -R fred:fred /home/fred /home/games /home/archives /usr/local/fred + # first build a list of dirs based on their location in /home/archives. + local arch_builder="archons basement codebarn games imaginations musix pooling prewar_toaster stuffing toaster walrus" + local ARCHIVE_HOME=/home/archives + local dirname + local arch_addin + for dirname in $arch_builder; do + arch_addin+="$ARCHIVE_HOME/$dirname " + done +#echo arch addin now is: $arch_addin + + # iterate across the list of dirs we want fred to own and change their ownership. + for dirname in /home/fred /usr/local/fred /home/games $arch_addin; do + if [ -d "$dirname" ]; then + echo "refred on '$dirname'" + sudo chown -R fred:fred $dirname + fi + done + + # special case for archives directory. + if [ -d /z/stuffing -o -L /z/stuffing ]; then + sudo chown fred:fred /z; sudo chmod g+rx,o+rx /z + sudo chown fred:fred /z/stuffing; sudo chmod g+rx,o-rwx /z/stuffing + pushd /z/stuffing &>/dev/null + if [ -d archives -o -L archives ]; then + sudo chown fred:fred archives + sudo chmod -R g+rwx archives + fi + popd &>/dev/null + fi + + # make the logs readable by normal humans. sudo bash $FEISTY_MEOW_SCRIPTS/security/normal_perm.sh /var/log } @@ -11,7 +43,6 @@ function refred() # than when it's just being sourced. if [[ $0 =~ .*refred\.sh.* ]]; then THISDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )" - export LIGHTWEIGHT_INIT=true source "$THISDIR/../../core/launch_feisty_meow.sh" refred fi