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."
12 if [[ ! $(hostname) == *cakelampvm* ]]; then
13 echo "This script is only designed to be run on the cakelampvm host."
19 export THISDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
20 export FEISTY_MEOW_APEX="$( \cd "$THISDIR/../.." && \pwd )"
23 source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
24 # load dependencies for our script.
25 source "$FEISTY_MEOW_SCRIPTS/system/common_sysadmin.sh"
26 source "$FEISTY_MEOW_SCRIPTS/security/password_functions.sh"
30 # it's a requirement to have sql root password, since we may need some sql db configuration.
31 load_password /etc/mysql/secret_password mysql_passwd
32 if [ -z "$mysql_passwd" ]; then
33 read_password "Please enter the MySQL root account password:" mysql_passwd
35 if [ -z "$mysql_passwd" ]; then
36 echo "This script must have the sql root password to proceed."
39 store_password /etc/mysql/secret_password "$mysql_passwd"
46 echo "Regenerating feisty meow loading dock."
49 test_or_die "regenerating feisty meow configuration"
50 chown -R "$(logname)":"$(logname)" /home/$(logname)/.[a-zA-Z0-9]*
51 test_or_die "fix after reconfigured as sudo"
55 # set up some crucial users in the mysql db that we seem to have missed previously.
59 echo "Adding users to the mysql database."
61 #hmmm: good application for hiding output unless error here.
62 mysql -u root -p"$mysql_passwd" &>/dev/null <<EOF
63 create user if not exists 'root'@'%' IDENTIFIED BY '$mysql_passwd';
64 grant all privileges on *.* TO 'root'@'%' with grant option;
66 create user if not exists 'wampcake'@'%' IDENTIFIED BY 'bakecamp';
67 grant all privileges on *.* TO 'wampcake'@'%' with grant option;
69 create user if not exists 'lampcake'@'%' IDENTIFIED BY 'bakecamp';
70 grant all privileges on *.* TO 'lampcake'@'%' with grant option;
72 test_or_die "configuring root, wampcake and lampcake users on mysql"
78 echo "Making some important permission changes..."
82 # fix up the main web storage.
83 chown -R www-data:www-data /var/www
84 test_or_die "chown www-data"
86 test_or_die "group_perm www-data"
90 # set up access on some important folders for the developer user.
92 # set the developer user as uber owner of many things with redeveloper alias.
93 # (must have run feisty meow "recustomize" command at some point to enable.)
95 test_or_die "running redeveloper to fix ownership"
99 # give the developer control over the apache and bind config files, as well
100 # as giving the user ownership of the local feisty meow repository.
101 chown -R developer:developer /etc/apache2 /etc/bind
102 test_or_die "chown apache2 and bind to developer"
103 group_perm /etc/apache2 /etc/bind
104 test_or_die "group perms on apache2 and bind"
105 chown -R developer:developer /opt/feistymeow.org
106 test_or_die "chown feisty meow to developer"
107 group_perm /opt/feistymeow.org
108 test_or_die "group perms on feisty meow"
112 echo "...done with permission changes."
116 # some slightly tricky bits start here. we want to massage the vm into the
117 # best possible shape without needing to re-release it.
131 # sequel--tell them they're great and show the hello again also.
136 test_or_die "regenerating feisty meow scripts"
137 chown -R "$(logname)":"$(logname)" /home/$(logname)/.[a-zA-Z0-9]*
138 test_or_die "fix after regenerate as sudo"
142 Thanks for revamping your cakelampvm. :-)
144 You may want to update your current shell's feisty meow environment by typing: