X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fcustomize%2Ffred%2Frefred.sh;h=908e3bd5494be376a71abf16bc32e2007f146c4d;hb=a9311019fd8802416644421ca85e7537190127a8;hp=f11d8b500cbf5325d2b3febeb47aa3f3eccbdec4;hpb=a5d7384673ab1090965ea7190fda07385220c59a;p=feisty_meow.git diff --git a/scripts/customize/fred/refred.sh b/scripts/customize/fred/refred.sh index f11d8b50..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 /usr/local/fred /home/games /home/archives/stuffing /home/archives/games + # 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 }