• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Automated Latest Fog SVN update script (1.0 and later) And other helpful productivity things

    Scheduled Pinned Locked Moved
    General
    2
    3
    1.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mecsrM
      mecsr
      last edited by

      Hi friends,

      So back in the times of fog 0.33b I posted a nifty script to help with automating the svn dev build update process. Since much has changed in the process since then I figure maybe someone else might find this rather helpful.
      The script is attached and it is thoroughly commented. I’ll just post the contents without most the comments in the post too.

      Some prereqs for this script

      Already have an existing working install/configuration of FOG 1.0 or later

      sudo apt-get install subversion
      mkdir /home/fog/fogInstalls
      sudo apt-get install dos2unix

      A encrypted version of your sudo password, create one with this command

      echo “your_super_secret_password” | openssl enc -des -a -e -pass pass:PASSWORD

      Then just copy the output, including any “=” signs at the end of the string, into the later section of this script

      Enter sudo mode and do some quick server maintenance update fun times

      echo “$(echo yourOpensslEncryptedPassword | openssl enc -des -a -d -pass pass:PASSWORD)” | sudo -S apt-get update -y
      sudo apt-get upgrade -y

      Backup stuff

      sudo cp /opt/fog/service/etc/config.php /home/fog/fogInstalls # config file
      sudo cp /etc/exports /home/fog/fogInstalls/exports # Exports file
      sudo cp /var/www/html/fog/service/ipxe/bzImage /home/fog/fogInstalls # 64 bit kernel
      sudo cp /var/www/html/fog/service/ipxe/bzImage32 /home/fog/fogInstalls # 32 bit kernel
      sudo cp /var/www/html/fog/service/ipxe/bg.png /home/fog/fogInstalls # custom background
      mysqldump -u root --all-databases --events > all-Databases-backup.sql # database backup

      Maintaining downloaded dev build folder structure

      cd /home/fog/fogInstalls
      time_stamp=$(date +%Y_%m_%d_%H_%M_%S)
      mkdir ${time_stamp}
      cd ${time_stamp}

      SVN download

      sudo svn checkout [url]https://svn.code.sf.net/p/freeghost/code/trunk[/url]
      sudo chown -R fog /home/fog/fogInstalls
      sudo chgrp -R fog /home/fog/fogInstalls
      sudo chmod -R 777 /home/fog/fogInstalls

      Update Fog

      cd ${PWD}/trunk/bin
      sudo yes | ${PWD}/installfog.sh
      wget -O - --post-data=“confirm=yes” “[url]http://${FOGWEBIP}/commons/schemaupdater/index.php[/url]” 2>/dev/null

      #Optional - Fix webroot
      sudo rm -rf /var/www/html/fog
      sudo mv /var/www/fog /var/www/html/fog

      Restore backed up files

      sudo dos2unix /home/fog/fogInstalls/.
      sudo rm /opt/fog/service/etc/config.php
      sudo cp /home/fog/fogInstalls/config.php /opt/fog/service/etc
      sudo rm /home/fog/fogInstalls/bzImage && sudo rm /home/fog/fogInstalls/bzImage32
      sudo cp /home/fog/fogInstalls/bzImage /var/www/html/fog/service/ipxe
      sudo cp /home/fog/fogInstalls/bzImage32 /var/www/html/fog/service/ipxe
      sudo cp /home/fog/fogInstalls/bg.png /var/www/html/fog/service/ipxe
      sudo cp /tftpboot/undionly.kpxe /tftpboot/undionly.kpxe.original && mv /tftpboot/undionly.kpxe /tftpboot/undionly.0
      sudo cp /tftpboot/undionly.0 /var/www/html/fog/service/ipxe/undionly.0

      Make sure Permissions are right on webroot and nfs images path

      sudo chown -R fog /var/www/html/fog
      sudo chgrp -R fog /var/www/html/fog
      sudo chmod -R 775 /var/www/html/fog
      sudo chown -R fog /images
      sudo chgrp -R fog /images
      sudo chmod -R 775 /images

      Restart/Refresh server services

      sudo /etc/init.d/apache2 restart
      sudo service mysql restart

      Alternatively, you could also just have it restart the server at this point with

      sudo shutdown -r now

      [url=“/_imported_xf_attachments/1/1757_fog_SVN_updater.zip?:”]fog_SVN_updater.zip[/url]

      1 Reply Last reply Reply Quote 0
      • mecsrM
        mecsr
        last edited by

        I’m also wondering if anyone has other helpful tricks they use on their fog server to make life easier.
        For example another thing I do is make aliases for cd-ing into the fog dirs I use often, so I can just type cdfog to get to the webroot for example. I realize that you can also do this with global variables, but I’m a fan of aliases.

        In case you don’t know, to make the file for your fog user
        sudo nano /home/fog/.bash_aliases
        Note that you’ll need to restart your terminal/login session for the aliases to take effect.

        This is what my .bash_aliases looks like.

        alias cdfog=‘cd /var/www/html/fog’
        alias editDns=‘sudo nano /etc/dnsmasq.d/ltsp.conf’
        alias editSmb=‘sudo nano /etc/samba/smb.cnf’
        alias cdipxe=‘cd /var/www/html/fog/service/ipxe’
        alias snapins=‘cd /opt/fog/snapins’

        1 Reply Last reply Reply Quote 0
        • S
          Sebastian Roth Moderator
          last edited by

          If I want to make changes to my init files I use this script a lot:
          [CODE]#!/bin/sh

          INIT=“init”

          if [ ! -f ${INIT}.bak ]
          then
          echo “Backing up ${INIT}.xz”
          mv ${INIT}.xz ${INIT}.bak
          cp ${INIT}.bak ${INIT}.xz
          fi

          if [ -f mnt/bin/fog ]
          then
          umount mnt
          rmdir mnt
          echo “Compressing ${INIT}.xz, please wait…”
          xz -C crc32 -9 ${INIT}
          else
          xz -d ${INIT}.xz
          mkdir -p mnt
          mount -o loop ${INIT} mnt
          echo “Mounted ${INIT}, have fun…”
          fi[/CODE]

          Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

          Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post

          214

          Online

          12.0k

          Users

          17.3k

          Topics

          155.2k

          Posts
          Copyright © 2012-2024 FOG Project