grrr, taking too long for this to work
[feisty_meow.git] / scripts / site_avenger / revamp_cakelampvm.sh
1 #!/bin/bash
2
3 # fixes the cakelampvm permissions according to the way.
4
5 ##############
6
7 if [[ $EUID != 0 ]]; then
8   echo "This script must be run as root or sudo."
9   exit 1
10 fi
11
12 ##############
13
14 export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )"  # obtain the script's working directory.
15 export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )"
16
17 source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
18
19 ##############
20
21 # fix up the main web storage.
22 chown -R www-data:www-data /var/www 
23 test_or_die "chown www-data"
24 group_perm /var/www 
25 test_or_die "group_perm www-data"
26
27 ##############
28
29 # set up access on some important folders for the developer user.
30 chown -R developer:developer /home/developer
31 test_or_die "chown developer home"
32 harsh_perm /home/developer/.ssh
33 test_or_die "harsh_perm setting on developer .ssh"
34 chown -R developer:developer /etc/apache2 /etc/bind 
35 test_or_die "chown apache2 and bind to developer"
36 group_perm /etc/apache2 /etc/bind 
37 test_or_die "group perms on apache2 and bind"
38
39 ##############
40
41 # fix perms for fred user.
42 chown -R fred:fred /home/fred /home/archives/stuffing 
43 test_or_die "chown fred home"
44 harsh_perm /home/fred/.ssh
45 test_or_die "harsh_perm setting on fred .ssh"
46 chown -R fred:fred /opt/feistymeow.org 
47 test_or_die "chown feisty meow to fred"
48 group_perm /opt/feistymeow.org 
49 test_or_die "group perms on feisty meow"
50
51 ##############
52 #
53 # some slightly tricky bits start here.  we want to massage the vm into the
54 # best possible shape without needing to re-release it.
55 #
56 ##############
57
58 # copy the most recent hello file into place for the user.
59 \cp -f "$FEISTY_MEOW_APEX/production/sites/cakelampvm.com/hello.txt" "$HOME"
60 test_or_continue "copying hello file for user"
61
62 ##############
63
64 #hmmm: todo
65 # deploy the site updater here to fix the local cakelampvm.com site...
66
67