Add Mageia in Redhat variants and fix a few things



  • Hi. I just created a patch to fog 3.3b (svn 3/25/14) which will allow fog to install on Mageia Linux (versions 2, 3 and 4). Mageia is a redhat derived os desending from the Mandrake-Mandriva linux linage. It is very popular. In developing this patch, I found and fixed a few minor bugs. For example the $linuxReleaseName variable could have trailing spaces in the distribution name. In another spot tftpboot is hard coded to /tftpboot where as it is now found in /var/lib/tftpboot. In the nfs /etc/exports some systems need additional options like ‘no_subtree_check’. All said, the changes are very minor and don’t distract from the core functionality of the original code.

    Cheers!

    Update: Please note a $tftpdirdist should be $tftpdirdst in the earlier version. This patchs have been fixed.
    — cut here -----
    [code]
    diff ‘–exclude=*~’ -r -u …/freeghost-code-svn/bin/installfog.sh ./bin/installfog.sh
    — …/freeghost-code-svn/bin/installfog.sh 2014-03-24 15:15:50.596935792 -0400
    +++ ./bin/installfog.sh 2014-03-25 14:08:58.255557287 -0400
    @@ -25,7 +25,7 @@
    . …/lib/common/config.sh

    Determine Linux release name

    -linuxReleaseName=lsb_release -a 2> /dev/null | grep "Distributor ID" | awk '{print $3,$4,$5,$6,$7,$8,$9}';
    +linuxReleaseName=lsb_release -a 2> /dev/null | grep "Distributor ID" | awk '{print $3,$4,$5,$6,$7,$8,$9}' | tr -d " ";
    if [ -z “$linuxReleaseName” ];
    then

    Fall back incase lsb_release does not exist / fails - use /etc/issue over /etc/release

    diff ‘–exclude=*~’ -r -u …/freeghost-code-svn/lib/common/functions.sh ./lib/common/functions.sh
    — …/freeghost-code-svn/lib/common/functions.sh 2014-03-24 15:15:32.236943638 -0400
    +++ ./lib/common/functions.sh 2014-03-24 16:44:17.613404643 -0400
    @@ -172,7 +172,7 @@
    else
    echo " What version of Linux would you like to run the installation for?"
    echo “”;

    • echo " 1) Redhat Based Linux (Redhat, Fedora, CentOS)";
    • echo " 1) Redhat Based Linux (Redhat, Fedora, CentOS, Mageia)";
      echo " 2) Debian Based Linux (Debian, Ubuntu, Kubuntu, Edubuntu)";
      echo “”;
      echo -n " Choice: [${strSuggestedOS}]";
      diff ‘–exclude=*~’ -r -u …/freeghost-code-svn/lib/common/input.sh ./lib/common/input.sh
      — …/freeghost-code-svn/lib/common/input.sh 2014-03-24 15:15:32.236943638 -0400
      +++ ./lib/common/input.sh 2014-03-24 17:13:40.949758957 -0400
      @@ -23,7 +23,7 @@
      strSuggestedOS="";

    #tmpOS=cat /etc/*release* /etc/issue 2> /dev/null | grep -Ei "Fedora|Redhat|CentOS";

    • if [ “echo $linuxReleaseName | grep -Ei "Fedora|Redhat|CentOS"” != “” ]
    • if [ “echo $linuxReleaseName | grep -Ei "Fedora|Redhat|CentOS|Mageia"” != “” ]
      then
      strSuggestedOS=“1”;
      fi
      diff ‘–exclude=*~’ -r -u …/freeghost-code-svn/lib/redhat/config.sh ./lib/redhat/config.sh
      — …/freeghost-code-svn/lib/redhat/config.sh 2014-03-24 15:15:31.958943748 -0400
      +++ ./lib/redhat/config.sh 2014-03-25 14:56:26.118537289 -0400
      @@ -19,19 +19,32 @@

    Yum packages to install

    -if [ “$linuxReleaseName” == “Fedora” ];
    +if [ “$linuxReleaseName” == “Mageia” ];
    +then

    • Mageia

    • packages=“apache apache-mod_php php-gd php-cli php-gettext mariadb mariadb-common mariadb-core mariadb-common-core php-mysql dhcp-server
      tftp-server nfs-utils vsftpd net-tools wget xinetd tar gzip make m4 gcc gcc-c++ htmldoc perl perl-Crypt-PasswdMD5 lftp clamav”;
    • storageNodePackages=“apache apache-mod_php php-cli php-gettext mariadb mariadb-core mariadb-common mariadb-common-core php-mysql nfs-util
      s vsftpd xinetd tar gzip make m4 gcc gcc-c++ lftp”;
    • packageinstaller=“urpmi --auto”;

    +elif [ “linuxReleaseName” == “Fedora” ];
    then

    Fedora

    packages=“httpd php php-cli php-common php-gd php-mysql mysql mysql-server dhcp tftp-server nfs-utils vsftpd net-tools wget xinetd tar gz
    ip make m4 gcc gcc-c++ htmldoc perl perl-Crypt-PasswdMD5 lftp clamav”;
    storageNodePackages=“httpd php php-cli php-common php-gd php-mysql mysql nfs-utils vsftpd xinetd tar gzip make m4 gcc gcc-c++ lftp”;
    -else

    • packageinstaller=“yum -y install”;

    +else

    CentOS or Other

    packages=“httpd php php-cli php-common php-gd php-mysql mysql mysql-server dhcp tftp-server nfs-utils vsftpd net-tools wget xinetd tar gz
    ip make m4 gcc gcc-c++ htmldoc perl perl-Crypt-PasswdMD5 lftp clamav”;
    storageNodePackages=“httpd php php-cli php-common php-gd php-mysql mysql nfs-utils vsftpd xinetd tar gzip make m4 gcc gcc-c++ lftp”;

    • packageinstaller=“yum -y install”;

    fi

    langPackages=“iso-codes”;
    dhcpname=“dhcp”;
    +nfsservice=“nfs”;

    where do the init scripts go?

    initdpath="/etc/rc.d/init.d";
    @@ -64,6 +77,8 @@

    where is the nfs exports file?

    nfsconfig="/etc/exports";
    +# Additional nfs /etc/exports options
    +nfsexportsopts="";

    where do snapins go?

    snapindir="/opt/fog/snapins";
    @@ -75,3 +90,17 @@
    freshconf="/etc/freshclam.conf";
    #freshcron="/etc/sysconfig/freshclam"
    freshcron="/usr/bin/freshclam"

    +# Distribution specific changes
    +if [ “$linuxReleaseName” == “Mageia” ];
    +then

    • #dhcpd package name
    • dhcpname=“dhcp-server”;
    • where do the tftp files go?

    • tftpdirdst="/var/lib/tftpboot";
    • NFS service name

    • nfsservice=“nfs-server”;
    • NFS Subtree Check needed

    • nfsexportsopts=“no_subtree_check”;
      +fi

    diff ‘–exclude=*~’ -r -u …/freeghost-code-svn/lib/redhat/functions.sh ./lib/redhat/functions.sh
    — …/freeghost-code-svn/lib/redhat/functions.sh 2014-03-24 15:15:31.958943748 -0400
    +++ ./lib/redhat/functions.sh 2014-03-25 15:04:09.118212951 -0400
    @@ -81,13 +81,13 @@
    {
    echo -n " * Setting up and starting NFS Server…";

    • echo “/images *(ro,sync,no_wdelay,insecure_locks,no_root_squash,insecure,fsid=1)
      -/images/dev *(rw,sync,no_wdelay,no_root_squash,insecure,fsid=2)” > “$nfsconfig”;
    • echo “/images *(ro,sync,no_wdelay,insecure_locks,no_root_squash,no_subtree_check,insecure,fsid=1,${nfsexportsopts}
      )
      +/images/dev *(rw,sync,no_wdelay,no_root_squash,insecure,fsid=2,${nfsexportsopts})” > “$nfsconfig”;
      chkconfig rpcbind on;
      service rpcbind restart >/dev/null 2>&1;
    • chkconfig nfs on;
    • service nfs restart >/dev/null 2>&1;
    • service nfs status >/dev/null 2>&1;
    • chkconfig ${nfsservice} on;
    • service ${nfsservice} restart >/dev/null 2>&1;
    • service ${nfsservice} status >/dev/null 2>&1;
      if [ “$?” != “0” ]
      then
      echo “Failed!”;
      @@ -198,7 +198,7 @@
      wait = yes
      user = root
      server = /usr/sbin/in.tftpd
    • server_args = -s /tftpboot
    • server_args = -s ${tftpdirdst}
      disable = no
      per_source = 11
      cps = 100 2
      @@ -450,7 +450,7 @@
      if [ “$?” != “0” ]
      then
      echo " * Installing package: $x";
    • yum -y install $x 1>/dev/null;
    • ${packageinstaller} $x 1>/dev/null;
      else
      echo " * Skipping package: $x (Already installed)";
      fi
      [/code]

    [url="/_imported_xf_attachments/0/617_fog-mageia.txt?:"]fog-mageia.txt[/url]


  • Senior Developer

    1873 with suggested mod.

    Thank you,


  • Senior Developer

    That’s too easy man, coming down the pipes.



  • Well this is most embarrassing. There was one critical line I left out of the Mageia patch. It was installer variable. the bug doesn’t effect redhat users, just us mageia users. I found this out after doing fresh install of FOG svn on a fresh Mageia4 machine.
    Tom, if you could install this asap. This is for rev 1871, June 18th.

    To install, in top level fogserver install directory; “patch -p0 < fog-mageia-patch2.txt”

    [CODE]
    diff ‘–exclude=*~’ -r -u …/free-ghost-svn/lib/redhat/functions.sh ./lib/redhat/functions.sh
    — …/free-ghost-svn/lib/redhat/functions.sh 2014-06-18 15:50:51.697789341 -0400
    +++ ./lib/redhat/functions.sh 2014-06-18 16:00:19.806067492 -0400
    @@ -551,7 +551,7 @@
    if [ “$?” != “0” ]
    then
    echo " * Installing package: $x";

    •                  yum -y install $x 1>/dev/null;
      
    •                  ${packageinstaller} $x 1>/dev/null;
                else
                        echo  "  * Skipping package: $x (Already installed)";
                fi
      

    [/CODE]

    [url="/_imported_xf_attachments/1/1017_fog-mageia-patch2.txt?:"]fog-mageia-patch2.txt[/url]


  • Senior Developer

    This is now added in svn, thank you much Chuck. 1860



  • Here are the patches to Fog svn revision 1859, June 17th (Fog 1.1.1) to Include Mageia in the Redhat variants, This should work for Mageia releases 2,3 and 4. Mageia Linux is the spin off/successor of Madriva which was spun off Mandrake Linux, which was spun off of Redhat. Mageia is my favorite of all of the Linux distros just for ease of use and robust packaging. This patch could be extended to include other Redhat variations like PCLinuxOS, but it uses apt-rpm which I know little about.

    The changes are all minimal. There are the file-names and file-installer used by the different distros. There are some changes in the names of the nfs and dhcp services. There are changes in the default location of the tftp directory. Lastly I added a few entries into the dhcp.conf to help with multicasting, and to show how to block dhcp services on a particular network interface (if you have two or more interfaces).

    To install, in top level fogserver install directory; “patch -p0 < fog-mageia-patch.txt”

    Have fun. The patch is attached below.

    [CODE]
    diff ‘–exclude=*~’ -r -u …/free-ghost/bin/.install.sh ./bin/.install.sh
    — …/free-ghost/bin/.install.sh 2014-06-17 15:12:10.154656509 -0400
    +++ ./bin/.install.sh 2014-06-17 13:45:07.530310345 -0400
    @@ -25,7 +25,7 @@
    . …/lib/common/config.sh

    Determine Linux release name

    -linuxReleaseName=lsb_release -a 2> /dev/null | grep "Distributor ID" | awk '{print $3,$4,$5,$6,$7,$8,$9}';
    +linuxReleaseName=lsb_release -a 2> /dev/null | grep "Distributor ID" | awk '{print $3,$4,$5,$6,$7,$8,$9}' | tr -d " ";
    if [ -z “$linuxReleaseName” ];
    then
    # Fall back incase lsb_release does not exist / fails - use /etc/issue over /etc/release
    diff ‘–exclude=*~’ -r -u …/free-ghost/lib/common/functions.sh ./lib/common/functions.sh
    — …/free-ghost/lib/common/functions.sh 2014-06-17 15:11:59.027652913 -0400
    +++ ./lib/common/functions.sh 2014-06-17 14:09:00.627415217 -0400
    @@ -172,7 +172,7 @@
    else
    echo " What version of Linux would you like to run the installation for?"
    echo “”;

    •                  echo "          1) Redhat Based Linux (Redhat, CentOS)";
      
    •                  echo "          1) Redhat Based Linux (Redhat, CentOS, Mageia)";
                        echo "          2) Debian Based Linux (Debian, Ubuntu, Kubuntu, Edubuntu)";
                        echo "";
                        echo -n "  Choice: [${strSuggestedOS}]";
      

    diff ‘–exclude=*~’ -r -u …/free-ghost/lib/common/input.sh ./lib/common/input.sh
    — …/free-ghost/lib/common/input.sh 2014-06-17 15:11:59.027652913 -0400
    +++ ./lib/common/input.sh 2014-06-17 14:09:58.643421175 -0400
    @@ -23,7 +23,7 @@
    strSuggestedOS="";

        #tmpOS=`cat /etc/*release* /etc/issue 2> /dev/null | grep -Ei "Fedora|Redhat|CentOS"`;
    
    •  if [ "`echo $linuxReleaseName | grep -Ei "Fedora|Redhat|CentOS"`" != "" ]
      
    •  if [ "`echo $linuxReleaseName | grep -Ei "Fedora|Redhat|CentOS|Mageia"`" != "" ]
        then
                strSuggestedOS="1";
        fi
      

    diff ‘–exclude=*~’ -r -u …/free-ghost/lib/redhat/config.sh ./lib/redhat/config.sh
    — …/free-ghost/lib/redhat/config.sh 2014-06-17 15:11:59.024652912 -0400
    +++ ./lib/redhat/config.sh 2014-06-17 14:21:47.916486069 -0400
    @@ -20,12 +20,29 @@

    Yum packages to install

    -packages=“httpd php php-cli php-common php-gd php-mysql mysql mysql-server dhcp tftp-server nfs-utils vsftpd ne
    t-tools wget xinetd tar gzip make m4 gcc gcc-c++ lftp”;
    -storageNodePackages=“httpd php php-cli php-common php-gd php-mysql mysql nfs-utils vsftpd xinetd tar gzip make
    m4 gcc gcc-c++ lftp”;

    +if [ “$linuxReleaseName” == “Mageia” ];
    +then

    • Mageia

    • packages=“apache apache-mod_php php-gd php-cli php-gettext mariadb mariadb-common mariadb-core mariadb-comm
      on-core php-mysql dhcp-server tftp-server nfs-utils vsftpd net-tools wget xinetd tar gzip make m4 gcc gcc-c++ ht
      mldoc perl perl-Crypt-PasswdMD5 lftp clamav”;
    • storageNodePackages=“apache apache-mod_php php-cli php-gettext mariadb mariadb-core mariadb-common mariadb-
      common-core php-mysql nfs-utils vsftpd xinetd tar gzip make m4 gcc gcc-c++ lftp”;
    • packageinstaller=“urpmi --auto”;

    +elif [ “linuxReleaseName” == “Fedora” ];
    +then

    • Fedora

    • packages=“httpd php php-cli php-common php-gd php-mysql mysql mysql-server dhcp tftp-server nfs-utils vsftp
      d net-tools wget xinetd tar gzip make m4 gcc gcc-c++ lftp”;
    • storageNodePackages=“httpd php php-cli php-common php-gd php-mysql mysql nfs-utils vsftpd xinetd tar gzip m
      ake m4 gcc gcc-c++ lftp”;
    • packageinstaller=“yum -y install”;
      +else
    • CentOS or Other PCLinuxOS uses apt-rpm

    • packages=“httpd php php-cli php-common php-gd php-mysql mysql mysql-server dhcp tftp-server nfs-utils vsftp
      d net-tools wget xinetd tar gzip make m4 gcc gcc-c++ htmldoc lftp clamav”;
    • storageNodePackages=“httpd php php-cli php-common php-gd php-mysql mysql nfs-utils vsftpd xinetd tar gzip m
      ake m4 gcc gcc-c++ lftp”;
    • packageinstaller=“yum -y install”;
      +fi

    langPackages=“iso-codes”;
    dhcpname=“dhcp”;
    +nfsservice=“nfs”;

    where do the init scripts go?

    initdpath="/etc/rc.d/init.d";
    @@ -69,3 +86,16 @@
    freshconf="/etc/freshclam.conf";
    #freshcron="/etc/sysconfig/freshclam"
    freshcron="/usr/bin/freshclam"

    +# Distribution specific changes
    +if [ “$linuxReleaseName” == “Mageia” ];
    +then

    • #dhcpd package name
    • dhcpname=“dhcp-server”;
    • where do the tftp files go?

    • tftpdirdst="/var/lib/tftpboot";
    • NFS service name

    • nfsservice=“nfs-server”;
    • NFS Subtree Check needed

    • nfsexportsopts=“no_subtree_check”;
      +fi
      diff ‘–exclude=*~’ -r -u …/free-ghost/lib/redhat/functions.sh ./lib/redhat/functions.sh
      — …/free-ghost/lib/redhat/functions.sh 2014-06-17 15:11:59.023652912 -0400
      +++ ./lib/redhat/functions.sh 2014-06-17 14:55:21.068530873 -0400
      @@ -81,13 +81,13 @@
      {
      echo -n " * Setting up and starting NFS Server…";
    •  echo "/images                        *(ro,sync,no_wdelay,insecure_locks,no_root_squash,insecure,fsid=1)
      

    -/images/dev *(rw,sync,no_wdelay,no_root_squash,insecure,fsid=2)" > “$nfsconfig”;

    •  echo "/images *(ro,sync,no_wdelay,insecure_locks,no_root_squash,insecure,fsid=1,${nfsexportsopts})
      

    +/images/dev *(rw,sync,no_wdelay,no_root_squash,insecure,fsid=2,${nfsexportsopts})" > “$nfsconfig”;
    chkconfig rpcbind on;
    service rpcbind restart >/dev/null 2>&1;

    •  chkconfig nfs on;
      
    •  service nfs restart >/dev/null 2>&1;
      
    •  service nfs status  >/dev/null 2>&1;
      
    •  chkconfig ${nfsservice} on;
      
    •  service ${nfsservice} restart >/dev/null 2>&1;
      
    •  service ${nfsservice} status  >/dev/null 2>&1;
        if [ "$?" != "0" ]
        then
                echo "Failed!";
      

    @@ -190,7 +190,7 @@
    wait = yes
    user = root
    server = /usr/sbin/in.tftpd

    •  server_args            = -s /tftpboot
      
    •  server_args            = -s ${tftpdirdst}
        disable                = no
        per_source              = 11
        cps                    = 100 2
      

    @@ -232,11 +232,33 @@
    echo "# DHCP Server Configuration file.

    see /usr/share/doc/dhcp*/dhcpd.conf.sample

    This file was created by FOG

    +# Definition of PXE-specific options
    +# Code 1: Multicast IP address of bootfile
    +# Code 2: UDP port that client should monitor for MTFTP responses
    +# Code 3: UDP port that MTFTP servers are using to listen for MTFTP requests
    +# Code 4: Number of seconds a client must listen for activity before trying
    +# to start a new MTFTP transfer
    +# Code 5: Number of seconds a client must listen before trying to restart
    +# a MTFTP transfer

    +option space PXE;
    +option PXE.mtftp-ip code 1 = ip-address;
    +option PXE.mtftp-cport code 2 = unsigned integer 16;
    +option PXE.mtftp-sport code 3 = unsigned integer 16;
    +option PXE.mtftp-tmout code 4 = unsigned integer 8;
    +option PXE.mtftp-delay code 5 = unsigned integer 8;
    +option arch code 93 = unsigned integer 16; # RFC4578

    use-host-decl-names on;
    ddns-update-style interim;
    ignore client-updates;
    next-server ${ipaddress};

    +# Specify subnet of ether device you do NOT want serviced. For systems with
    +# two or more ethernet devices.
    +# subnet 136.165.0.0 netmask 255.255.0.0 { }

    subnet ${network} netmask 255.255.255.0 {
    option subnet-mask 255.255.255.0;
    range dynamic-bootp ${startrange} ${endrange};
    [/CODE]

    [url="/_imported_xf_attachments/1/1011_fog-mageia-patch.txt?:"]fog-mageia-patch.txt[/url]


  • Senior Developer

    Chuck, if you’re willing, could you possibly make a new patch of this and post it with the new updates to the installer functions?

    I only ask because I’ve made quite a few changes and adding this, while not difficult, could take quite a bit of time hand coding.


Log in to reply
 

543
Online

39007
Users

10720
Topics

101798
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.