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