From: Chris Koeritz Date: Sun, 7 Jan 2018 16:22:28 +0000 (-0500) Subject: Merge branch 'dev' of feistymeow.org:feisty_meow into dev X-Git-Tag: 2.140.107^2~2^2~8 X-Git-Url: https://feistymeow.org/gitweb/?p=feisty_meow.git;a=commitdiff_plain;h=438552736e670bec96145889ce3018a91e7129c7;hp=238ef5a5fdce3a479039f7560e30dea8ba665c5a Merge branch 'dev' of feistymeow.org:feisty_meow into dev --- diff --git a/production/sites/cakelampvm.com/docs/manual/cakelampvm_guide_v002.html b/production/sites/cakelampvm.com/docs/manual/cakelampvm_guide_v002.html index 33de2282..81ba2ece 100644 --- a/production/sites/cakelampvm.com/docs/manual/cakelampvm_guide_v002.html +++ b/production/sites/cakelampvm.com/docs/manual/cakelampvm_guide_v002.html @@ -11,7 +11,7 @@ Koeritz
feisty meow® concerns ltd.

Vintage: cakelampvm v002    - Updated: 2017-12-19 (rev. h)

+ Updated: 2018-1-7 (rev. i)

The cakelampvm project provides a Virtualbox VM that acts as an "internet in a bottle", serving up your web sites securely and only to your local host.  The virtual machine provides DNS services (

passwd
The 'passwd' command will ask for your current password, and then for a new password plus a verification of that new password.
+ You will probably want to change your samba password as well, which is + used when accessing the virtual machine over the network.  This is + a different, but very similar, command on Linux:
+
smbpasswd
 
  • Change your git configuration for the user and email address.  This is how we've configured it so far:
    @@ -279,7 +283,7 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com

    Setting up DNS on Windows

    The ipconfig tool will provide helpful information about your current networking and DNS configuration:

    -
    > ipconfig /all
    +
    > ipconfig /all

    The DNS configuration on Windows is somewhat byzantine.  The pipe characters ('|') below are used to separate the menus or tabs or dialogs to traverse.  Follow this path to get to the DNS config:

    @@ -297,7 +301,7 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com settings on your Host PC are right, then you may need to flush your DNS cache, and that might be sufficient to start getting the right IP address.  On Windows, the command for flushing DNS is:

    -
    > ipconfig /flushdns
    +
    > ipconfig /flushdns

    and on Linux the flush DNS command can be many different things, but try these two most common options:

    # restarts the client side DNS cache.
    sudo service dns-clean restart
    diff --git a/scripts/core/common.alias b/scripts/core/common.alias index 3c4a3fb2..9eda7788 100644 --- a/scripts/core/common.alias +++ b/scripts/core/common.alias @@ -108,6 +108,7 @@ define_yeti_alias add_domain="sudo bash \$FEISTY_MEOW_SCRIPTS/system/add_domain. define_yeti_alias remove_domain="sudo bash \$FEISTY_MEOW_SCRIPTS/system/remove_domain.sh" define_yeti_alias add_apache_site="sudo bash \$FEISTY_MEOW_SCRIPTS/system/add_apache_site.sh" define_yeti_alias remove_apache_site="sudo bash \$FEISTY_MEOW_SCRIPTS/system/remove_apache_site.sh" +define_yeti_alias add_swap_mount="sudo bash \$FEISTY_MEOW_SCRIPTS/system/add_swap_mount.sh" #hmmm: some magma intrusions from the fred customizations... define_yeti_alias revamp_cakelampvm="sudo bash \"$FEISTY_MEOW_SCRIPTS/site_avenger/revamp_cakelampvm.sh\"" diff --git a/scripts/site_avenger/revamp_cakelampvm.sh b/scripts/site_avenger/revamp_cakelampvm.sh index 9c83a588..e1c268b6 100644 --- a/scripts/site_avenger/revamp_cakelampvm.sh +++ b/scripts/site_avenger/revamp_cakelampvm.sh @@ -270,6 +270,55 @@ test_or_die "enabling the new cakelampvm environment config for apache" echo Successfully configured the apache2 environment variables needed for cakelampvm. +############## + +# add in a swap mount if not already configured. + +sep + +echo "Checking existing swap partition configuration. +" + +# check for existing swap. +free | grep -q "Swap:[[:blank:]]*[1-9][0-9]" +if [ $? -ne 0 ]; then + # no swap in current session, so add it. + echo "Enabling ramdisk swap partition... +" + add_swap_mount + echo " +Enabled ramdisk swap partition for current boot session." +fi + +# the above just gives this session a swap partition, but we want to have +# the vm boot with one also. + +# check if there is already swap mentioned in the root crontab. we will get root's +# crontab below since this script has to run as sudo. +crontab -l | grep -iq add_swap_mount +if [ $? -ne 0 ]; then + # no existing swap setup in crontab, so add it. + echo " +Adding a boot-time ramdisk swap partition... +" + # need to do it carefully, since sed won't add lines to a null file. we thus + # create a temporary file to do our work in and ignore sed as a tool for this. + tmpfile="$(mktemp junk.XXXXXX)" + crontab -l 2>/dev/null >"$tmpfile" + echo " +# need to explicitly set any variables we will use. +FEISTY_MEOW_APEX=${FEISTY_MEOW_APEX} +# add swap space to increase memory available. +@reboot bash $FEISTY_MEOW_APEX/scripts/system/add_swap_mount.sh +" >>"$tmpfile" + # now install our new version of the crontab. + crontab "$tmpfile" + rm "$tmpfile" + + echo " +Added boot-time ramdisk swap partition to crontab for root." +fi + ############## ############## diff --git a/scripts/system/add_swap_mount.sh b/scripts/system/add_swap_mount.sh index 2577f44a..608ffc5c 100644 --- a/scripts/system/add_swap_mount.sh +++ b/scripts/system/add_swap_mount.sh @@ -2,22 +2,52 @@ # auto-find the scripts, since we might want to run this as sudo. export WORKDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )" # obtain the script's working directory. -source "$WORKDIR/../core/launch_feisty_meow.sh" - -#hmmm: should be able to add a new swap drive if desired. - -#hmmm: why all the hard-coded paths below? - -/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=2048 +export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )" +source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh" + +if [[ $EUID != 0 ]]; then + echo "This script must be run as root or sudo." + exit 1 +fi + +# optional parameters: the instance number of the swap file (best as a number), +# and the size of the swap file to add. +SWAP_INSTANCE="$1"; shift +SWAP_SIZE="$1"; shift + +if [ "$SWAP_INSTANCE" == "--help" ]; then + echo "\ +$(basename $0): +This script will add a swap partition for Linux that uses hard drive space for +swap memory. This increases the amount of available memory on RAM constrained +systems. It accepts two parameters: (1) the instance of the swap file, which +should be a small number not already used for a swap partition, and (2) the +size of the swap file in megabytes." + exit 0 +fi + +# if the swap instance variable is already set, then we'll use it. +# this allows multiple different swap partitions to be added. +if [ -z "$SWAP_INSTANCE" ]; then + SWAP_INSTANCE=1 +fi + +# allow the amount of swap space to be determined from outside the script. +# this is measured in megabytes. +if [ -z "$SWAP_SIZE" ]; then + SWAP_SIZE=2048 +fi + +/bin/dd if=/dev/zero of=/var/swap.${SWAP_INSTANCE} bs=1M count=${SWAP_SIZE} test_or_die "creating swap file" -/bin/chmod 600 /var/swap.1 +/bin/chmod 600 /var/swap.${SWAP_INSTANCE} test_or_die "setting swap file permissions" -/sbin/mkswap /var/swap.1 +/sbin/mkswap /var/swap.${SWAP_INSTANCE} test_or_die "formatting swap file as swap partition" -/sbin/swapon /var/swap.1 +/sbin/swapon /var/swap.${SWAP_INSTANCE} test_or_die "enabling new swap partition" free