--- Main script install.sh ----------- #!/bin/bash # # This script helps you to install software into a Zenoss V6 Container. # It is important that all the files are in your current directory ex. /tmp/install and the mode is 777 # # # Copyright (C) 2020 Arthur Keusch # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 3 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # http://www.gnu.org/licenses/gpl-3.0.de.html # Use at your own risk mySnap="whatEver" echo "Creating snapshot $mySnap" echo "Connect to the Zope container an starting the switch_user_zenoss.sh" #serviced service shell -i zope bash /mnt/pwd/switch_user_zenoss.sh serviced service shell -i -s $mySnap zope bash /mnt/pwd/switch_user_zenoss.sh echo echo "I'm back from my work modifining the container!" echo "and ready to do my post stuff like:" echo echo "committing the container" echo "------------------------" serviced snapshot commit $mySnap retVal=$? if [ $retVal -ne 0 ]; then echo "Commiting the snapshot failed" fi echo "list the snapshot" echo "------------------" serviced snapshot list ------ switch_user_zenoss.sh ------- #!/bin/bash # Here we switch to the zenoss user in the and then start the work # Use at your own risk! # echo echo "I'm now in the switch_user_zenoss.sh and switch to the user zenoss and start my work.sh" echo sudo -u zenoss bash /mnt/pwd/work.sh echo "Seems I've done my work in the container. Going back" ----------- work.sh -------------- #!/bin/bash # Here you place all the work/changes you would like to do in the container # User at your own risk! USER=$(whoami) echo echo "Installing the given work." echo cp /mnt/pwd/*.sh /opt/myExistingDir/ chown zenoss:zenoss /opt/myExistingDir/*.sh && chmod 744 /opt/myExistingDir/*.sh ls -al /opt/myExistingDir/