cleaner approach to hello file
[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 export NO_HELLO=right
18 source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
19
20 ##############
21
22 # fix up the main web storage.
23 chown -R www-data:www-data /var/www 
24 test_or_die "chown www-data"
25 group_perm /var/www 
26 test_or_die "group_perm www-data"
27
28 ##############
29
30 # set up access on some important folders for the developer user.
31 chown -R developer:developer /home/developer
32 test_or_die "chown developer home"
33 harsh_perm /home/developer/.ssh
34 test_or_die "harsh_perm setting on developer .ssh"
35 chown -R developer:developer /etc/apache2 /etc/bind 
36 test_or_die "chown apache2 and bind to developer"
37 group_perm /etc/apache2 /etc/bind 
38 test_or_die "group perms on apache2 and bind"
39
40 ##############
41
42 # fix perms for fred user.
43 chown -R fred:fred /home/fred /home/archives/stuffing 
44 test_or_die "chown fred home"
45 harsh_perm /home/fred/.ssh
46 test_or_die "harsh_perm setting on fred .ssh"
47 chown -R fred:fred /opt/feistymeow.org 
48 test_or_die "chown feisty meow to fred"
49 group_perm /opt/feistymeow.org 
50 test_or_die "group perms on feisty meow"
51
52 ##############
53 #
54 # some slightly tricky bits start here.  we want to massage the vm into the
55 # best possible shape without needing to re-release it.
56 #
57 ##############
58
59 # copy the most recent hello file into place for the user.
60 \cp -f "$FEISTY_MEOW_APEX/production/sites/cakelampvm.com/hello.txt" "$HOME"
61 test_or_continue "copying hello file for user"
62
63 ##############
64
65 #hmmm: todo
66 # deploy the site updater here to fix the local cakelampvm.com site...
67
68
69 ##############
70
71 # sequel--tell them they're great and show the hello again also.
72
73 regenerate
74
75 echo "
76
77
78 Thanks for revamping your cakelampvm.  :-)
79 "
80
81 ##############
82
83