a220364279a4c001776d29ff945cc8ca51bd34a3
[feisty_meow.git] / scripts / customize / fred / refred.sh
1 #!/bin/bash
2
3 # cleans up the ownership for all my files and dirs.
4 function refred()
5 {
6   # first build a list of dirs based on their location in /home/archives.
7   local arch_builder="archons basement codebarn games imaginations musix pooling prewar_toaster stuffing toaster walrus"
8   local ARCHIVE_HOME=/home/archives
9   local dirname
10   local arch_addin
11   for dirname in $arch_builder; do
12     arch_addin+="$ARCHIVE_HOME/$dirname "
13   done
14 #echo arch addin now is: $arch_addin
15
16   # iterate across the list of dirs we want fred to own and change their ownership.
17   for dirname in /home/fred /usr/local/fred /home/games $arch_addin; do
18     if [ -d "$dirname" ]; then
19       echo "refred on '$dirname'"
20       sudo chown -R fred:fred $dirname
21     fi
22   done
23
24   # make the logs readable by normal humans.
25   sudo bash $FEISTY_MEOW_SCRIPTS/security/normal_perm.sh /var/log
26 }
27
28 # this block should execute when the script is actually run, rather
29 # than when it's just being sourced.
30 if [[ $0 =~ .*refred\.sh.* ]]; then
31   THISDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )"
32   source "$THISDIR/../../core/launch_feisty_meow.sh"
33   refred
34 fi
35