X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fcustomize%2Ffred%2Frefred.sh;h=908e3bd5494be376a71abf16bc32e2007f146c4d;hb=7ec00037df7da86467d3a497d048b72e8102037e;hp=fb33e9e300dc4974c02c84bae6383e853b77726c;hpb=c5d44af5a928ffcfe0dc059e0858f57e4b7dd13c;p=feisty_meow.git diff --git a/scripts/customize/fred/refred.sh b/scripts/customize/fred/refred.sh index fb33e9e3..908e3bd5 100644 --- a/scripts/customize/fred/refred.sh +++ b/scripts/customize/fred/refred.sh @@ -1,17 +1,48 @@ #!/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 - sudo bash $FEISTY_MEOW_SCRIPTS/files/normal_perm.sh /var/log + # 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 } # this block should execute when the script is actually run, rather # 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