added bluefish install
[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 # only update hello if they've still got the file there.  we don't want to
60 # keep forcing our hellos at people.
61 if [ -f "$HOME/hello.txt" ]; then
62   # copy the most recent hello file into place for the user.
63   \cp -f "$FEISTY_MEOW_APEX/production/sites/cakelampvm.com/hello.txt" "$HOME"
64   test_or_continue "copying hello file for user"
65 fi
66
67 ##############
68
69 # install a better editor app.
70
71 echo "
72 The script is about to install the bluefish editor and some dependencies.
73 This takes about a minute on a not very fast internet connection...
74
75 "
76
77 apt-get install -y bluefish &> "/tmp/install_bluefish-$(logname).log"
78 test_or_continue "failed to install bluefish editor.  not good."
79
80 ##############
81
82
83 #hmmm: todo
84 # deploy the site updater here to fix the local cakelampvm.com site...
85
86
87 ##############
88
89 # sequel--tell them they're great and show the hello again also.
90
91 regenerate
92
93 echo "
94
95
96 Thanks for revamping your cakelampvm.  :-)
97 "
98
99 ##############
100
101