3 # fixes the cakelampvm permissions according to the way.
7 if [[ $EUID != 0 ]]; then
8 echo "This script must be run as root or sudo."
14 export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
15 export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )"
18 source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
19 source "$FEISTY_MEOW_SCRIPTS/system/common_sysadmin.sh"
23 echo "Regenerating feisty meow loading dock."
25 reconfigure_feisty_meow
26 test_or_die "feisty meow reconfiguration"
27 chown -R "$(logname)":"$(logname)" /home/$(logname)/.[a-zA-Z0-9]*
28 test_or_die "fix after reconfigured as sudo"
32 echo "Making some important permission changes..."
34 # fix up the main web storage.
35 chown -R www-data:www-data /var/www
36 test_or_die "chown www-data"
38 test_or_die "group_perm www-data"
42 # set up access on some important folders for the developer user.
43 chown -R developer:developer /home/developer /home/developer/.[a-zA-Z0-9]*
44 test_or_die "chown developer home"
45 harsh_perm /home/developer/.ssh
46 test_or_die "harsh_perm setting on developer .ssh"
47 chown -R developer:developer /etc/apache2 /etc/bind
48 test_or_die "chown apache2 and bind to developer"
49 group_perm /etc/apache2 /etc/bind
50 test_or_die "group perms on apache2 and bind"
54 # fix perms for fred user.
55 chown -R fred:fred /home/fred /home/archives/stuffing /home/fred/.[a-zA-Z0-9]*
56 test_or_die "chown fred home"
58 test_or_die "group perms on fred's apps"
59 harsh_perm /home/fred/.ssh
60 test_or_die "harsh_perm setting on fred .ssh"
61 chown -R fred:fred /opt/feistymeow.org
62 test_or_die "chown feisty meow to fred"
63 group_perm /opt/feistymeow.org
64 test_or_die "group perms on feisty meow"
66 echo "Done with important permission changes."
70 # some slightly tricky bits start here. we want to massage the vm into the
71 # best possible shape without needing to re-release it.
75 echo "Updating developer welcome file."
77 # only update hello if they've still got the file there. we don't want to
78 # keep forcing our hellos at people.
79 if [ -f "$HOME/hello.txt" ]; then
80 # copy the most recent hello file into place for the user.
81 \cp -f "$FEISTY_MEOW_APEX/production/sites/cakelampvm.com/hello.txt" "$HOME"
82 test_or_continue "copying hello file for user"
87 # install a better editor app.
89 echo " The script is about to install the bluefish editor and some dependencies.
90 If the app is not already installed, then this process takes only about a
91 minute on a slower home DSL internet connection..."
93 apt-get install -y bluefish &> "/tmp/install_bluefish-$(logname).log"
94 test_or_continue "installing bluefish editor"
98 # deploy any site updates here to the VM's cakelampvm.com site.
100 # we want to upgrade the default apache site to the latest, since the new
101 # version mirrors the one on the internet (but with green checks instead
102 # of red X's) and since we also support https on the new default version.
103 # we can do this again later if needed, by upping the numbers on the apache
104 # site config files. our original site was 000 and the new version is 001,
105 # which we've done as a prefix on the config for some reason. makes the
106 # code below easy at least.
107 if [ -L /etc/apache2/sites-enabled/000-default.conf ]; then
108 # the old site is in place still, so let's update that.
109 echo "Updating default web sites to latest version."
112 test_or_die "enabling SSL for secure websites"
115 test_or_die "getting SSL loaded in apache"
117 a2dissite 000-default
118 test_or_die "disabling old apache site"
120 rm -f /etc/apache2/sites-available/000-default.conf
121 test_or_die "removing old apache site"
123 # copy in our new 000 version (which
124 cp $FEISTY_MEOW_APEX/production/sites/cakelampvm.com/rolling/default_page.001/* \
125 /etc/apache2/sites-available
126 test_or_die "installing new apache default sites"
128 # there should only be ours at this version level and with that prefix.
130 test_or_die "enabling new apache default sites"
139 # sequel--tell them they're great and show the hello again also.
146 test_or_die "regenerating feisty meow scripts"
147 chown -R "$(logname)":"$(logname)" /home/$(logname)/.[a-zA-Z0-9]*
148 test_or_die "fix after regenerate as sudo"
152 Thanks for revamping your cakelampvm. :-)