From: Chris Koeritz Date: Wed, 10 Jan 2018 19:56:24 +0000 (-0500) Subject: Merge branch 'release-2.140.107' X-Git-Tag: 2.140.107^0 X-Git-Url: https://feistymeow.org/gitweb/?p=feisty_meow.git;a=commitdiff_plain;h=30a49a33d2ebc388f4bd1fa5cd8261e5395ecc4c;hp=2e61eaff94964e16a6b405bc01db686a31cd1f42 Merge branch 'release-2.140.107' bringing in changes for revamp and other improvements. --- diff --git a/documentation/feisty_meow_command_reference.txt b/documentation/feisty_meow_command_reference.txt index ebe9d02c..e7f3382f 100644 --- a/documentation/feisty_meow_command_reference.txt +++ b/documentation/feisty_meow_command_reference.txt @@ -29,6 +29,9 @@ generally useful commands show the directory with a "summing" feature that calculates the full size consumed by all files in the listing, with somewhat esthetic output. + ll: + like 'dir' but also includes hidden files (e.g. those starting with a dot). + ls: the standard ls command (not the summing directory), but with ls colors enabled. @@ -38,6 +41,10 @@ generally useful commands deleted files in "$TMP/zz_safedel_keep" and writes a report of the deletion history in "$TMP/zz_safedel_report.txt". + get_feisty: + update the feisty meow codebase from its origin and run the reconfigure + script to update the current user's feisty meow configuration. + note: currently there is no "empty the trash" function aside from running a command such as: # \rm -rf $TMP/zz_safedel* diff --git a/production/feisty_meow_config.ini b/production/feisty_meow_config.ini index eec83fb4..fc69a177 100644 --- a/production/feisty_meow_config.ini +++ b/production/feisty_meow_config.ini @@ -3,7 +3,7 @@ # specifies the version of the code that is being constructed here. major=2 minor=140 -revision=106 +revision=107 build=420 # specifies the remainder of the version record info. 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 2b285a6d..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-11-20 (rev. g)

+ 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 (Saco Design of Winterport, Maine.

-

Commands preceded by an octothorpe ('#') below are intended to be typed - into a bash shell running on the cakelampvm virtual machine.  The - bash shell can be obtained either by logging into the VM through ssh or by - logging in directly to the Virtualbox VM console.  You may find the - ssh session more convenient, because copy & paste features work as - expected.

+

Commands in fixed-width bold below are intended to be typed into a bash + shell running on the cakelampvm virtual machine.  The bash shell can + be obtained either by logging into the VM through ssh or by logging in + directly to the Virtualbox VM console.  You may find the ssh session + more convenient, because copy & paste features work as expected.

Commands preceded by a greater-than symbol ('>') are intended to be run on the Host PC in a Windows command prompt (or in a bash prompt running on the Host PC).

@@ -99,7 +98,8 @@ IPv4 Network Mask: 255.255.255.0
IPv6 Address: (leave blank)
IPv6 Prefix Length: 0
- Virtualbox will fill in the other details like so:
+ Virtualbox will fill in the other details like so (this dialog may + differ between versions of virtualbox):

host only network adapter

  • Set the "DHCP Server Settings" to disabled, e.g.
    @@ -129,7 +129,8 @@ Network CIDR: 10.0.2.0/24
    Supports DHCP: checked
    Supports IPv6: optionally checked
    - These are my settings, with IPv6 left disabled:
    + These are my settings, with IPv6 left disabled (this dialog may differ + between versions of virtualbox):
    nat net config
  • Starting up the VM and Connecting to It

    @@ -150,16 +151,16 @@ is generally more useful to connect to the cakelampvm over ssh.  If the networking has been established properly, you should be able to do this with: -
    # ssh developer@10.28.42.20   # or the equivalent with your ssh client
    +
    ssh developer@10.28.42.20
    # or perform the equivalent connection with your ssh client.

    And then provide the password to log in.

    Once the DNS services are set up (discussed in detail below), you will be able to run the much friendlier command:

    -
    # ssh developer@cakelampvm.com
    +
    ssh developer@cakelampvm.com

    Key Forwarding to the VM

    It is important to set up ssh key forwarding to enable your use of git repositories while logged into the VM.  Key forwarding should be enabled for the VM's two fake host identities:

    -
    cakelampvm.com
    10.28.42.20
    +
    cakelampvm.com
    10.28.42.20

    Updating cakelampvm to the Latest Model

    The cakelampvm v002 is released with the intention that it not need to be released again.  Version 001 was not built with that explicit @@ -168,30 +169,49 @@

    There is an update feature built into the VM that is quite easy to use.  The updates are driven by the feisty meow script repository in conjunction with a local scripted command.  To activate the "update - process" for your VM, run the following commands on the VM (without the - initial '#' symbol):

    -
    # rpuffer $FEISTY_MEOW_APEX   # updates to the latest version of feisty meow
    -# revamp_cakelampvm           # enacts any configuration changes needed,
    # plus fixes web folder and other permissions.
    + process" for your VM, run the following commands on the VM:

    +
    # update to the latest version of feisty meow.
    rpuffer $FEISTY_MEOW_APEX; reconfigure_feisty_meow
    # enact any configuration changes needed, such as permissions and account setup. +revamp_cakelampvm
    +

    These two commands can be run at any time to patch up your VM to the latest.

    -

    The first command ("rpuffer ...") is also useful on its own for getting - the latest version of the feisty meow code.  Run it again if there - are bug fixes you need for any of the scripts or if you would like the - most up-to-date cakelampvm documentation.

    +

    Recent versions of feisty meow support a new "get_feisty" + command, which will behave the same as the first line above.  Once + you have run the "puffer..." command above for the first time (on + cakelampvm v002), this new command becomes available.

    +

    First Tasks as the Developer User

    Here are some first steps that will make the vm your own:

    1. Change your password for the developer account.  (This may eventually be required and automatic.)  First, log into the VM with ssh.  Then type this command:
      -
      # passwd
      +
      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
       
    2. Change your git configuration for the user and email address.  This is how we've configured it so far:
      -
      # git config --global user.email "developer@cakelampvm.com"
      -
      # git config --global user.name "Developer J. Cakemo"
      +
        +
      • +
        git config --global user.email "developer@cakelampvm.com"
        +
      • +
      • +
        git config --global user.name "Developer J. Cakemo"
        +
      • +
      If you're developing on a real project, you probably don't want the bogus email and even more bogus name above attached to your commits.  Just run the two commands again but with proper values.
    3. @@ -219,15 +239,6 @@ meow meow command reference file.

      (The feisty meow codebase is already configured for the developer account on the cakelampvm virtual machine.)

      -

      X11 applications launched from the VM

      -

      [incomplete section]

      -

      If a feature called "X forwarding" is enabled in your ssh client, then - you can start graphical applications on the VM and display them on your - local machine.  This works right away on most Linux hosts, but can - also work on PCs with X window system installed.  This section - describes how to set up Cygwin to run X server, which enables X11 - forwarding to your local display.

      -

      ...{insert that info}...

      Using the guest VM's DNS services

      The cakelampvm has been set up to provide a DNS server which will answer name lookup requests on any of the sites that the cakelampvm is hosting @@ -239,11 +250,11 @@ meow 10.28.42.20.  (The DNS server can be tested with nslookup, dig and other tools.)

      Note that the cakelampvm DNS should be listed first, if one intends to - override any DNS names that actually exist out on the internet.  Further, - we have found it most effective to have *only* the cakelampvm as your DNS - server, because a secondary DNS server can "take over" providing the name - lookups, and thus foul up DNS requests that should succeed for your - VM-hosted sites.

      + override any DNS names that actually exist out on the internet.  + Further, we have found it most effective to have *only* the cakelampvm as + your DNS server, because a secondary DNS server can "take over" providing + the name lookups, and thus foul up DNS requests that should succeed for + your VM-hosted sites.

      If your Host PC is running Windows, see the DNS configuration section below that is tailored to that operating system.

      Important Note: It behooves you to remember to switch back to a normal @@ -255,8 +266,9 @@ meow both the cakelampvm VM and on your host PC.  Note: ping on Linux keeps going forever, so hit control-C when you are tired of seeing the pings:

      -
      # ping cakelampvm.com
      -
      # ping mapsdemo.cakelampvm.com
      +
      ping cakelampvm.com
      + +
      ping www.cakelampvm.com

      Note that any other answer than 10.28.42.20 for the address is *bzzzt* wrong, and means something needs to be fixed.

      If these pings succeed (which hopefully they will!), then try accessing @@ -271,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:

      @@ -289,12 +301,12 @@ 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:

      -
      # sudo service dns-clean restart   # restarts the client side DNS cache.
      +
      # restarts the client side DNS cache.
      sudo service dns-clean restart

      or

      -
      # sudo service nscd restart   # restarts the nscd caching server.
      +
      # restarts the nscd caching server.
      sudo service nscd restart
      After, this try the pings again.  If they still fail, please go back over your DNS configuration very carefully.  The cakelampvm's DNS feature *does* actually work, but operating systems sometimes do their best @@ -357,7 +369,7 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com

      If you run into any permission problems that prevent file access, either remotely or within the VM itself, then try running this command to fix them (repeated from the section above about updating the cakelampvm):

      -
      # revamp_cakelampvm
      +
      revamp_cakelampvm

      Afterwards, the www folder and others should allow the developer user to create new folders at will.

      Accessing files on the host PC from the guest VM

      @@ -373,9 +385,18 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com shared, and give it a name for the guest.  We assume the folder name will be "myshare".
    4. On the guest vm, run the following commands to mount the share:
      -
      # mkdir ~/shared    # for the guest's version of the shared folder
      # sudo mount -t vboxsf myshare ~/shared    # mount the vm's share name onto the folder on the vm.
      +
      # make the guest's version of the shared folder
      mkdir ~/shared
      # mount the vm's share name onto the folder on the vm.
      sudo mount -t vboxsf myshare ~/shared
    +

    X11 applications launched from the VM

    +

    [incomplete section]

    +

    If a feature called "X forwarding" is enabled in your ssh client, then + you can start graphical applications on the VM and display them on your + local machine.  This works right away on most Linux hosts, but can + also work on PCs with X window system installed.  This section + describes how to set up Cygwin to run X server, which enables X11 + forwarding to your local display.

    +

    ...{insert that info}...

    Adding a new website and domain on the guest VM

    Note: these instructions, even the quick approaches below, pale in comparison to the ease of use of the "standup" command in feisty meow's @@ -404,18 +425,18 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com details on how to add a containing domain for the first time.

    Quick approach: Use the feisty meow "add_domain" command.

    Run this command in a bash shell on the VM:

    -
    # add_domain excalibur.cakelampvm.com
    +
    add_domain excalibur.cakelampvm.com

    Done.

    Manual approach: Edit the bind9 configuration.

    Note: the manual approach is not compatible with later use of feisty meow's "remove_domain".

    Execute the following command to edit the DNS file for the cakelampvm domain: -
    # sudo vi /etc/bind/cakelampvm.com.conf
    +
    sudo vi /etc/bind/cakelampvm.com.conf

    Add a stanza for the new site at the end of this file:

    excalibur.cakelampvm.com.    IN A    10.28.42.20
            IN HINFO "linux server" "ubuntu"

    Restart the DNS server:

    -
    # sudo service bind9 restart
    +
    sudo service bind9 restart

    Afterwards, pinging excalibur.cakelampvm.com should work from both the guest VM and the host PC.

    DNS Option B: Using an entirely new domain for the site

    @@ -424,7 +445,7 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com this example, we need to add the site "excalibur.tv" into the DNS.

    Quick approach: Use the feisty meow "add_domain" command.

    Run this command in a bash shell on the VM: -
    # add_domain excalibur.tv
    +
    add_domain excalibur.tv

    Done.

    Manual approach: Edit a new DNS config file

    Note: the manual approach is not compatible with later use of feisty @@ -441,7 +462,7 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com to add the new file by adding this bit of configuration at the end:

    zone "excalibur.tv" in {
            file "/etc/bind/excalibur.tv.conf";
            type master;
            allow-query { any; };
    };

    Restart the DNS server:

    -
    # sudo service bind9 restart
    +
    sudo service bind9 restart

    Afterwards, pinging excalibur.tv should work from both the guest and the host.

    Creating a New Apache Site

    @@ -449,7 +470,7 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com developer@cakelampvm.com

    Quick approach: Use the feisty meow "add_apache_site" command.

    Run this command in a bash shell on the VM:

    -
    # add_apache_site excalibur excalibur.tv
    +
    add_apache_site excalibur excalibur.tv

    (The first parameter is the application name, the second is the domain name.)

    Done.

    @@ -471,21 +492,21 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com appropriate file name that includes the site's domain name.  We will call our config file "excalibur.tv.conf".  If you developed the file in your home folder, this would be the command to move it up to Apache:

    -
    # sudo cp ~/excalibur.tv.conf /etc/apache2/sites-available
    +
    sudo cp ~/excalibur.tv.conf /etc/apache2/sites-available

    Then tell apache to use the new file:

    -
    # sudo a2ensite excalibur.tv  # the '.conf' portion of the filename is unnecessary for this command.
    +    
    sudo a2ensite excalibur.tv
    # the '.conf' portion of the filename is unnecessary for this command.

    Finally, restart apache to get it to begin serving the site:

    -
    # sudo service apache2 restart
    +
    sudo service apache2 restart

    Test the new web site

    Given the configuration above, your host PC should now be able to access the new website on the domain "excalibur.tv".

    To test this, first try pinging the new DNS name:

    -
    # ping excalibur.tv
    -

    If there are responses to the ping *and* the answer is 10.28.42.20, then - it means the DNS is working.  If there are no responses or it's some - other IP address talking back, check the instructions in the above DNS - sections.

    +
    ping excalibur.tv
    +

    If there are responses to the ping *and* + the answer is 10.28.42.20, then it means the DNS is working.

    +

    If there are no responses or it's some other IP address talking back, + check the instructions in the above DNS sections.

    Once the DNS is working, try browsing to the site at "http://excalibur.tv".  That should at least bring up the configured site storage path, even if nothing is @@ -502,23 +523,22 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com

    href="http://nvie.com/posts/a-successful-git-branching-model/">http://nvie.com/posts/a-successful-git-branching-model/

    This is a basic guide to the Google Developer Console and API Key management: Google - API Docs

    -

     

    + API Docs 

    Using the "meld" Tool to Compare Files & Directories

    Meld is a great comparison tool that displays differences between two files or directories or directory trees in a graphical view.  Meld is pre-installed on the VM.  This tool can be launched either in the VM's X Windowing System (on the console) or if X11 forwarding is enabled.

    To run meld, just type this command:

    -

    #meld A B

    -

    where A and B are either both file names or they are both directory names.  - If A and B are directories, meld will compare the entire tree structure - between the two directories.  It allows one to copy from one side to - the other, even if the item that needs to be copied is an entire - subdirectory.

    +
    meld A B
    +

    where A and B are either both file names or they are both directory + names.  If A and B are directories, meld will compare the entire tree + structure between the two directories.  It allows one to copy from + one side to the other, even if the item that needs to be copied is an + entire subdirectory.

    Get the network address on the guest vm

    Run this command:

    -
    # ifconfig
    +
    ifconfig

    In the results, look for "inet addr".  There may be more than one, if there are multiple network interfaces.

    The standard IP address is 10.28.42.20 for the cakelampvm.

    @@ -526,11 +546,11 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com

    When you've got the DNS and everything integrated, these commands will manage the vm's state:

    First, log into the guest VM:

    -
    # ssh developer@cakelampvm.com
    +
    ssh developer@cakelampvm.com

    Then, to reboot the guest VM:

    -
    # sudo reboot
    +
    sudo reboot

    Or, to halt the guest VM:

    -
    # sudo shutdown -h now
    +
    sudo shutdown -h now

    Using these commands is kinder to the VM than just cycling the power from the Virtualbox control panel.

    Gritty Details of the Nitty Variety

    @@ -554,12 +574,12 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com Image".  This will mount the CD's ISO image on the VM.
  • On the guest VM, it may be necessary to mount the CD image that's now available:
    -
    # sudo mount /dev/sr0 /media/cdrom
    +
    sudo mount /dev/sr0 /media/cdrom

    Linux will mention that the device is mounted "read-only".

  • Since the VM currently has no windowing system installed, one must start the Guest Additions install manually:
    -
    # cd /media/cdrom
    # sudo sh VBoxLinuxAdditions.run
    +
    cd /media/cdrom
    sudo sh VBoxLinuxAdditions.run
  • The latest Virtualbox guest additions should now be installed.
  • @@ -585,7 +605,7 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com

    To minimize the size used for the disk image, there are three major steps.

    1. While running the VM, run this command:

    -
    # sudo apt clean
    +
    sudo apt clean

    This throws away any cached data from the apt tool, which can be substantial.

    If there are other junk files you know of that can be removed, delete @@ -593,12 +613,12 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com

    2. Reboot the VM to the gparted ISO image (available at the gparted site) and run the following command:

    -
    # sudo zerofree /dev/sda
    +
    sudo zerofree /dev/sda

    This sets all free space to the zero byte, enabling Virtualbox to free that space in the next step.

    3. Shut the vm down after zerofree is complete and run this command on the host PC (this is the Linux version of the command):

    -
    # VBoxManage modifyhd --compact ~/cake_lamp_vm/cake-lamp-vm-hd.vdi
    +
    VBoxManage modifyhd --compact ~/cake_lamp_vm/cake-lamp-vm-hd.vdi

    Replace the ~/cake_lamp_vm path with the real VM storage path.  This command compacts the root (and only) partition of the VM.

    @@ -625,8 +645,6 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com
  • Installed and configured Samba service for the guest VM.  The main config file lives in "/etc/samba/smb.conf".  Some pointers here: https://help.ubuntu.com/community/How%20to%20Create...
  • -

  • -

  • diff --git a/scripts/core/common.alias b/scripts/core/common.alias index ba2e44be..9eda7788 100644 --- a/scripts/core/common.alias +++ b/scripts/core/common.alias @@ -55,6 +55,7 @@ fi # re-use work we did on 'exp' macro for the longer windows command. define_yeti_alias explorer=exp define_yeti_alias fix_ssh_perms='chmod 700 $HOME/.ssh ; chmod 600 $HOME/.ssh/*' +define_yeti_alias get_feisty='rpuffer $FEISTY_MEOW_APEX; reconfigure_feisty_meow' define_yeti_alias halt='sudo shutdown -h now' define_yeti_alias i=inventory define_yeti_alias l='perl $FEISTY_MEOW_SCRIPTS/files/summing_dir.pl' @@ -107,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/core/functions.sh b/scripts/core/functions.sh index c60c9431..dc01d786 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -144,7 +144,7 @@ if [ -z "$skip_all" ]; then function test_or_die() { if [ $? -ne 0 ]; then - echo -e "\n\naction failed: $*\n\nExiting script..." + echo -e "\n\naction failed: $*\n\n*** Exiting script..." error_sound exit 1 fi @@ -154,7 +154,7 @@ if [ -z "$skip_all" ]; then function test_or_continue() { if [ $? -ne 0 ]; then - echo -e "\n\nerror occurred: $*\n\nContinuing script..." + echo -e "\n\nerror occurred: $*\n\n=> Continuing script..." error_sound fi } diff --git a/scripts/rev_control/git_scruncher.sh b/scripts/rev_control/git_scruncher.sh new file mode 100644 index 00000000..76ca12de --- /dev/null +++ b/scripts/rev_control/git_scruncher.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# check for whether we see a .git folder. +if [ ! -d ".git" ]; then + echo This script needs to run in the directory where a git repository lives, + echo but we do not see a .git directory here. + exit 1 +fi + +# makes git checkouts not be as intensive on the server. +git config --global pack.windowMemory "100m" +git config --global pack.SizeLimit "100m" +git config --global pack.threads "1" + + diff --git a/scripts/rev_control/version_control.sh b/scripts/rev_control/version_control.sh index d74fe1bd..8ec547f3 100644 --- a/scripts/rev_control/version_control.sh +++ b/scripts/rev_control/version_control.sh @@ -11,6 +11,20 @@ source "$FEISTY_MEOW_SCRIPTS/tty/terminal_titler.sh" ############## +# check git version to see if we can use autostash. +# this appears to be an ubuntu issue, where xenial did not provide it even though the +# feature appeared in git 2.6 and xenial claims it has git version 2.7.4. eventually, +# this version test can go away. +gitvertest="$(git version | sed -e 's/git version [0-9]\.//' | sed -e 's/\.[0-9][0-9]*$//' )" +if (( $gitvertest >= 11 )); then + # auto-stash is not available until 2.6 for git, but ubuntu is misreporting or using a + # differing version number somehow. we are sure autostash was missing on ubuntu xenial + # with git 2.7.4 and it's definitely present in zesty with git at 2.11. + PULL_ADDITION='--rebase --autostash' +fi + +############## + # the maximum depth that the recursive functions will try to go below the starting directory. export MAX_DEPTH=5 @@ -379,6 +393,8 @@ function do_careful_git_update() show_branch_conditionally "$this_branch" # this code is now doing what i have to do when i repair the repo. and it seems to be good so far. + # note that we allow the local branch to be merged with its remote counterpart; otherwise we would + # miss changes that happened elsewhere which should be seen in our local copy. local branch_list=$(all_branch_names) local bran for bran in $branch_list; do @@ -392,7 +408,9 @@ function do_careful_git_update() remote_branch_info=$(git ls-remote --heads origin $bran 2>/dev/null) if [ ! -z "$remote_branch_info" ]; then # we are pretty sure the remote branch does exist. - git pull --no-ff origin "$bran" | $TO_SPLITTER + git pull $PULL_ADDITION origin "$bran" | $TO_SPLITTER +# we may want to choose to do fast forward, to avoid crazy multiple merge histories +# without any changes in them. --no-ff promote_pipe_return 0 fi test_or_die "git pull of remote branch: $bran" @@ -404,7 +422,10 @@ function do_careful_git_update() # now pull down any changes in our own origin in the repo, to stay in synch # with any changes from others. - git pull --no-ff --all | $TO_SPLITTER + git pull $PULL_ADDITION --all | $TO_SPLITTER +#is the above really important when we did this branch already in the loop? +#it does an --all, but is that effective or different? should we be doing that in above loop? +# --no-ff promote_pipe_return 0 test_or_die "git pulling all upstream" @@ -443,9 +464,10 @@ function do_update() elif [ -d ".git" ]; then if test_writeable ".git"; then $blatt - git pull --no-ff 2>&1 | grep -v "X11 forwarding request failed" | $TO_SPLITTER + git pull $PULL_ADDITION 2>&1 | grep -v "X11 forwarding request failed" | $TO_SPLITTER +#ordinary pulls should be allowed to do fast forward: --no-ff promote_pipe_return 0 - test_or_die "git pull of origin without fast forwards" + test_or_die "git pull of origin" fi else # this is not an error necessarily; we'll just pretend they planned this. diff --git a/scripts/site_avenger/powerup.sh b/scripts/site_avenger/powerup.sh index ff2a9944..3709bc30 100644 --- a/scripts/site_avenger/powerup.sh +++ b/scripts/site_avenger/powerup.sh @@ -103,20 +103,5 @@ create_site_links "$site_store_path" "$theme_name" sep -# go with the default user running the script. -user_name=$USER -if [ ! -z "$user_name" -a "$user_name" != "root" ]; then - echo "Chowning the apps folder to be owned by: $user_name" -#hmmm: have to hope for now for standard group named after user - chown -R "$user_name:$user_name" "$BASE_APPLICATION_PATH" - test_or_die "Chowning $BASE_APPLICATION_PATH to be owned by $user_name" - -else -echo "user name failed checks for chowning, was '$user_name'" -fi - -sep - - echo "Finished powering up the site in '${app_dirname}'." diff --git a/scripts/site_avenger/revamp_cakelampvm.sh b/scripts/site_avenger/revamp_cakelampvm.sh index 2717b3a6..180574eb 100644 --- a/scripts/site_avenger/revamp_cakelampvm.sh +++ b/scripts/site_avenger/revamp_cakelampvm.sh @@ -270,6 +270,71 @@ 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 + +############## + +sep + +# repair the google config key for mapsdemo, which lives over in fred's account. +search_replace \ + "^[[:blank:]]*'key'[[:blank:]]*=>[[:blank:]]*'AIzaSyCd2kfOBf8tyd-_m2aM_ayMoAq8r_M1yUk'," \ + "\t'key' => 'AIzaSyCvKs62XudEWPZpA21rCGI1Dkh6UxSQzzQ'," \ + ~fred/apps/mapsdemo/avenger5/config/config_google.php + +if [ $? -ne 0 ]; then + echo Google config key for mapsdemo in fred account seems to already be patched. +else + echo Patched the google config key for mapsdemo app in fred account. +fi + ############## ############## @@ -285,6 +350,9 @@ echo " Thanks for revamping your cakelampvm. :-) + +You may want to update your current shell's feisty meow environment by typing: + reconfigure_feisty_meow " ############## diff --git a/scripts/site_avenger/shared_site_mgr.sh b/scripts/site_avenger/shared_site_mgr.sh index 3f73b3a8..94a4f792 100644 --- a/scripts/site_avenger/shared_site_mgr.sh +++ b/scripts/site_avenger/shared_site_mgr.sh @@ -351,4 +351,26 @@ function update_composer_repository() fi } +# fixes the ownership for a site avenger or php application. +# this almost certainly will require sudo capability, if there are any ownership problems +# that need to be resolved. +function fix_appdir_ownership() +{ + local appsdir="$1"; shift + local dir="$1"; shift + + local combo="$appsdir/$dir" + + # go with the default user running the script. + user_name="$USER" + if [ ! -z "$user_name" -a "$user_name" != "root" ]; then + echo "Chowning the apps folder to be owned by: $user_name" +#hmmm: have to hope for now for standard group named after user + chown -R "$user_name:$user_name" "$combo" + test_or_die "Chowning $combo to be owned by $user_name" + else + echo "user name failed checks for chowning, was found as '$user_name'" + fi +} + diff --git a/scripts/site_avenger/standup.sh b/scripts/site_avenger/standup.sh index 5adfcc63..cd2f6890 100644 --- a/scripts/site_avenger/standup.sh +++ b/scripts/site_avenger/standup.sh @@ -89,8 +89,12 @@ sep #echo default repo is "$DEFAULT_REPOSITORY_ROOT" powerup "$APPLICATION_NAME" "$REPO_NAME" "$THEME_NAME" -# pass the real user name who should own the files. -# "$(logname)" + +sep + +# hmmm: pass the real user name who should own the files? +# hmmm: "$(logname)" $USER works, but logname wasn't? +fix_appdir_ownership "$BASE_APPLICATION_PATH" "$APPLICATION_NAME" sep 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 diff --git a/scripts/wine/wine_link_maker.sh b/scripts/wine/wine_link_maker.sh new file mode 100644 index 00000000..743964e3 --- /dev/null +++ b/scripts/wine/wine_link_maker.sh @@ -0,0 +1,13 @@ + + +# find all the directories at this height. +find . -mindepth 1 -maxdepth 1 -type d -exec echo {} ';' >$TMP/filestolink.txt +# make links with all lower case and all upper case versions of the names. +while read line; do + ln -s "$line" "$(echo $line | tr '[:upper:]' '[:lower:]')" + ln -s "$line" "$(echo $line | tr '[:lower:]' '[:upper:]')" +done < $TMP/filestolink.txt +# remove dead links. +\rm $(find . -type l ! -exec test -e {} \; -print) + +