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 exit_on_error "regenerating feisty meow configuration"
50 chown -R "$(logname)":"$(logname)" /home/$(logname)/.[a-zA-Z0-9]*
51 exit_on_error "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 # note regarding v003 of the revamp script: i am leaving the mysql code
62 # alone for the moment; it's a good example of using our password, gathered
63 # above. (a better example wouldn't pass the password on the command line
64 # but involving an "expect" script is out of scope currently.) --fred
66 #hmmm: good example here for why we need the code that "hides output unless error".
67 mysql -u root -p"$mysql_passwd" &>/dev/null <<EOF
68 create user if not exists 'root'@'%' IDENTIFIED BY '$mysql_passwd';
69 grant all privileges on *.* TO 'root'@'%' with grant option;
71 create user if not exists 'wampcake'@'%' IDENTIFIED BY 'bakecamp';
72 grant all privileges on *.* TO 'wampcake'@'%' with grant option;
74 create user if not exists 'lampcake'@'%' IDENTIFIED BY 'bakecamp';
75 grant all privileges on *.* TO 'lampcake'@'%' with grant option;
77 exit_on_error "configuring root, wampcake and lampcake users on mysql"
83 echo "Making some important permission changes..."
87 # fix up the main web storage.
88 chown -R www-data:www-data /var/www
89 exit_on_error "chown www-data"
91 exit_on_error "group_perm www-data"
95 # set up access on some important folders for the developer user.
97 # set the developer user as uber owner of many things with redeveloper alias.
98 # (must have run feisty meow "recustomize" command at some point to enable.)
100 exit_on_error "running redeveloper to fix ownership"
104 # give the developer control over the apache and bind config files, as well
105 # as giving the user ownership of the local feisty meow repository.
106 chown -R developer:developer /etc/apache2 /etc/bind
107 exit_on_error "chown apache2 and bind to developer"
108 group_perm /etc/apache2 /etc/bind
109 exit_on_error "group perms on apache2 and bind"
110 chown -R developer:developer /opt/feistymeow.org
111 exit_on_error "chown feisty meow to developer"
112 group_perm /opt/feistymeow.org
113 exit_on_error "group perms on feisty meow"
117 echo "...done with permission changes."
121 # some slightly tricky bits start here. we want to massage the vm into the
122 # best possible shape without needing to re-release it.
136 # sequel--tell them they're great and show the hello again also.
141 exit_on_error "regenerating feisty meow scripts"
142 chown -R "$(logname)":"$(logname)" /home/$(logname)/.[a-zA-Z0-9]*
143 exit_on_error "fix after regenerate as sudo"
147 Thanks for revamping your cakelampvm. :-)
149 You may want to update your current shell's feisty meow environment by typing: