Check in Arif's changes for debian/ubuntu support. Not all patches applied yet.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8965 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
40d2825237
commit
5bda5a1df6
@ -470,6 +470,8 @@ sub makescript
|
||||
elsif ($os =~ /fedora.*/) { $platform = "fedora"; }
|
||||
elsif ($os =~ /SL.*/) { $platform = "SL"; }
|
||||
elsif ($os =~ /sles.*/) { $platform = "sles"; }
|
||||
elsif ($os =~ /ubuntu.*/) { $platform = "ubuntu"; }
|
||||
elsif ($os =~ /debian.*/) { $platform = "debian"; }
|
||||
elsif ($os =~ /aix.*/) { $platform = "aix"; }
|
||||
}
|
||||
if (($nodesetstate) && ($nodesetstate eq "netboot"))
|
||||
|
@ -320,6 +320,8 @@ sub getsynclistfile()
|
||||
elsif ($os =~ /fedora.*/) { $platform = "fedora"; }
|
||||
elsif ($os =~ /sles.*/) { $platform = "sles"; }
|
||||
elsif ($os =~ /SL.*/) { $platform = "SL"; }
|
||||
elsif ($os =~ /ubuntu.*/) { $platform = "ubuntu"; }
|
||||
elsif ($os =~ /debian.*/) { $platform = "debian"; }
|
||||
elsif ($os =~ /AIX.*/) { $platform = "AIX"; }
|
||||
}
|
||||
|
||||
@ -345,6 +347,8 @@ sub getsynclistfile()
|
||||
elsif ($os =~ /fedora.*/) { $platform = "fedora"; }
|
||||
elsif ($os =~ /sles.*/) { $platform = "sles"; }
|
||||
elsif ($os =~ /SL.*/) { $platform = "SL"; }
|
||||
elsif ($os =~ /ubuntu.*/) { $platform = "ubuntu"; }
|
||||
elsif ($os =~ /debian.*/) { $platform = "debian"; }
|
||||
elsif ($os =~ /AIX.*/) { $platform = "AIX"; }
|
||||
elsif ($os =~ /win/) {$platform = "windows"; }
|
||||
}
|
||||
|
1356
xCAT-server/lib/xcat/plugins/debian.pm
Normal file
1356
xCAT-server/lib/xcat/plugins/debian.pm
Normal file
File diff suppressed because it is too large
Load Diff
129
xCAT-server/share/xcat/install/debian/compute.tmpl
Normal file
129
xCAT-server/share/xcat/install/debian/compute.tmpl
Normal file
@ -0,0 +1,129 @@
|
||||
|
||||
### Localization
|
||||
d-i debian-installer/locale string en_GB
|
||||
|
||||
# Keyboard Selection
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i console-setup/layoutcode string uk
|
||||
|
||||
### Network Configuration
|
||||
d-i netcfg/choose_interface select #TABLE:noderes:$NODE:primarynic#
|
||||
d-i netcfg/dhcp_options select Configure network manually
|
||||
|
||||
d-i netcfg/dhcp_timeout string 60
|
||||
d-i netcfg/get_hostname string #TABLE:nodelist:THISNODE:node#
|
||||
d-i netcfg/get_domain string #TABLE:site:key=domain:value#
|
||||
d-i netcfg/wireless_wep string
|
||||
d-i netcfg/disable-dhcp boolean false
|
||||
d-i netcfg/confirm_static boolean false
|
||||
|
||||
### Mirror settings
|
||||
# If you select ftp, the mirror/country string does not need to be set.
|
||||
|
||||
d-i mirror/country string manual
|
||||
d-i mirror/protocol string http
|
||||
d-i mirror/http/hostname string #TABLE:noderes:$NODE:nfsserver#
|
||||
d-i mirror/http/directory string /install/#TABLE:nodetype:$NODE:os#/#TABLE:nodetype:$NODE:arch#/
|
||||
d-i mirror/http/proxy string
|
||||
|
||||
# Suite to install.
|
||||
#d-i mirror/suite select stable
|
||||
#d-i mirror/codename string
|
||||
# Suite to use for loading installer components (optional).
|
||||
#d-i mirror/udeb/suite string testing
|
||||
#d-i mirror/suite string feisty
|
||||
|
||||
|
||||
### Partitioning
|
||||
# This creates a small /boot partition, suitable
|
||||
# swap, and uses the rest of the space for the root partition:
|
||||
|
||||
d-i partman-auto/method string regular
|
||||
d-i partman-lvm/device_remove_lvm boolean true
|
||||
d-i partman-md/device_remove_md boolean true
|
||||
|
||||
d-i partman-auto/expert_recipe string \
|
||||
boot-root :: \
|
||||
40 50 100 ext3 \
|
||||
$primary{ } $bootable{ } \
|
||||
method{ format } format{ } \
|
||||
use_filesystem{ } filesystem{ ext3 } \
|
||||
mountpoint{ /boot } \
|
||||
. \
|
||||
500 10000 1000000000 ext3 \
|
||||
method{ format } format{ } \
|
||||
use_filesystem{ } filesystem{ ext3 } \
|
||||
mountpoint{ / } \
|
||||
. \
|
||||
64 512 300% linux-swap \
|
||||
method{ swap } format{ } \
|
||||
.
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
|
||||
|
||||
### Account setup
|
||||
|
||||
d-i passwd/root-login boolean true
|
||||
d-i passwd/make-user boolean false
|
||||
|
||||
d-i passwd/root-password-crypted password #CRYPT:passwd:key=system,username=root:password#
|
||||
|
||||
### Clock and time zone setup
|
||||
|
||||
d-i clock-setup/ntp boolean true
|
||||
d-i clock-setup/ntp-server string #TABLE:site:key=master:value#
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string #TABLE:site:key=timezone:value#
|
||||
|
||||
### Apt setup
|
||||
|
||||
#d-i apt-setup/multiverse boolean true
|
||||
#d-i apt-setup/universe boolean true
|
||||
|
||||
|
||||
### Boot loader installation
|
||||
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
### Package selection
|
||||
|
||||
tasksel tasksel/first multiselect standard
|
||||
|
||||
# gawk required for the xCAT scripts to work
|
||||
# Otherwise it installs mawk, which doesn't work
|
||||
|
||||
d-i pkgsel/include string openssh-server ntp gawk
|
||||
|
||||
d-i debian-installer/allow_unauthenticated string true
|
||||
d-i pkgsel/update-policy select none
|
||||
d-i pkgsel/updatedb boolean false
|
||||
|
||||
### Finishing up the installation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
### X configuration
|
||||
xserver-xorg xserver-xorg/autodetect_monitor boolean true
|
||||
|
||||
xserver-xorg xserver-xorg/config/monitor/selection-method \
|
||||
select medium
|
||||
|
||||
xserver-xorg xserver-xorg/config/monitor/mode-list \
|
||||
select 1024x768 @ 60 Hz
|
||||
|
||||
|
||||
d-i preseed/early_command string wget http://#TABLE:noderes:$NODE:nfsserver#/install/autoinst/#TABLE:nodelist:THISNODE:node#.pre; \
|
||||
chmod u+x #TABLE:nodelist:THISNODE:node#.pre; \
|
||||
./#TABLE:nodelist:THISNODE:node#.pre
|
||||
|
||||
d-i preseed/late_command string wget http://#TABLE:noderes:$NODE:nfsserver#/install/autoinst/#TABLE:nodelist:THISNODE:node#.post; \
|
||||
chmod u+x #TABLE:nodelist:THISNODE:node#.post; \
|
||||
cp ./#TABLE:nodelist:THISNODE:node#.post /target/root/post.script; \
|
||||
chroot /target /root/post.script
|
||||
|
Binary file not shown.
Binary file not shown.
BIN
xCAT-server/share/xcat/install/debian/debian5.0.6Images/linux
Normal file
BIN
xCAT-server/share/xcat/install/debian/debian5.0.6Images/linux
Normal file
Binary file not shown.
Binary file not shown.
141
xCAT-server/share/xcat/install/scripts/post.debian
Normal file
141
xCAT-server/share/xcat/install/scripts/post.debian
Normal file
@ -0,0 +1,141 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Setup hostname
|
||||
#
|
||||
echo "post scripts" >/root/post.log
|
||||
export PRINIC=#TABLE:noderes:THISNODE:primarynic#
|
||||
if [ "$PRINIC" == "mac" ]
|
||||
then
|
||||
export PRINIC='#TABLE:mac:THISNODE:mac#'
|
||||
fi
|
||||
if [ -z "$PRINIC" ]
|
||||
then
|
||||
export PRINIC=eth0
|
||||
elif [[ `echo "$PRINIC" | grep -sqE ^[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+$ ;echo $?` == "0" ]]; then
|
||||
export PRINIC=`ifconfig -a | grep -i "HWaddr $PRINIC" | awk '{print $1}'`
|
||||
fi
|
||||
IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}')
|
||||
if [ -z $IP ]
|
||||
then
|
||||
dhclient eth0
|
||||
IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}')
|
||||
fi
|
||||
echo "search #TABLE:site:key=domain:value#" >/etc/resolv.conf
|
||||
for i in $(echo #TABLE:site:key=nameservers:value# | tr ',' ' ')
|
||||
do
|
||||
echo "nameserver $i"
|
||||
done >>/etc/resolv.conf
|
||||
export HOSTNAME=$(host $IP 2>/dev/null | awk '{print $5}' | awk -F. '{print $1}')
|
||||
hostname $HOSTNAME
|
||||
#
|
||||
# Run xCAT post install
|
||||
#
|
||||
export MASTER_IP="#XCATVAR:XCATMASTER#"
|
||||
export MASTER_IPS="#XCATVAR:XCATMASTER#"
|
||||
export MASTER="#XCATVAR:XCATMASTER#"
|
||||
cd /tmp
|
||||
RAND=$(perl -e 'print int(rand(50)). "\n"')
|
||||
sleep $RAND
|
||||
for i in $(seq 1 20)
|
||||
do
|
||||
GOTIT=0
|
||||
for i in $MASTER_IPS
|
||||
do
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts
|
||||
#wget --wait=10 --random-wait --waitretry=10 --retry-connrefused -t 0 -T 60 http://$i/install/autoinst/xcatpost.tar.gz
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
if [ ! -x /usr/bin/openssl ]; then #Stop if no openssl to help the next bit
|
||||
exit 1
|
||||
fi
|
||||
USEOPENSSLFORXCAT=1 #Though this is the only method going forward, flag to allow backward compatibility with 2.2 generated netboot images
|
||||
export USEOPENSSLFORXCAT
|
||||
XCATSERVER=$i:3001
|
||||
export XCATSERVER
|
||||
mv $i/postscripts /xcatpost
|
||||
rm -rf $i
|
||||
chmod +x /xcatpost/*
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
RETRY=$(($RETRY+1))
|
||||
if [ $RETRY -eq $MAX_RETRIES ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
done
|
||||
|
||||
|
||||
chmod +x /tmp/mypostscript
|
||||
GOTIT=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$GOTIT" = "1" ]
|
||||
then
|
||||
#save the master to /opt/xcat/xcatinfo file
|
||||
if [ ! -f /opt/xcat/xcatinfo ]; then
|
||||
mkdir -p /opt/xcat
|
||||
touch /opt/xcat/xcatinfo
|
||||
fi
|
||||
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
|
||||
break
|
||||
fi
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
done
|
||||
cd /xcatpost
|
||||
#gunzip xcatpost.tar.gz
|
||||
#tar -xvf xcatpost.tar
|
||||
#/xcatpost/#TABLE:nodelist:THISNODE:node#
|
||||
export PATH=/xcatpost:$PATH
|
||||
|
||||
#save the postboot scripts to /tmp/mypostscript.post
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript.post
|
||||
chmod 755 /tmp/mypostscript.post
|
||||
|
||||
#create the post init
|
||||
cat >/etc/init.d/xcatpostinit1 << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit1#
|
||||
EOF
|
||||
chmod 755 /etc/init.d/xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/rc2.d/S84xcatpostinit1
|
||||
mkdir -p /opt/xcat
|
||||
cat >/opt/xcat/xcatinstallpost << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatinstallpost#
|
||||
rm /etc/rc2.d/S84xcatpostinit1
|
||||
EOF
|
||||
chmod 755 /opt/xcat/xcatinstallpost
|
||||
|
||||
#only run the prebooot scripts here
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript
|
||||
|
||||
/tmp/mypostscript
|
||||
export NODE=#TABLE:nodelist:THISNODE:node#
|
||||
export OSVER=#TABLE:nodetype:THISNODE:os#
|
||||
export ARCH=#TABLE:nodetype:THISNODE:arch#
|
||||
#addsiteyum
|
||||
if [[ -r /boot/grub/menu.lst ]]; then
|
||||
sed -i 's/^serial/#serial/' /boot/grub/menu.lst
|
||||
sed -i 's/^terminal/#terminal/' /boot/grub/menu.lst
|
||||
elif [[ -r /boot/grub/grub.cfg ]] ; then
|
||||
sed -i 's/\(GRUB_CMDLINE_LINUX=\).*/\1\"console=tty0\ console=ttyS#TABLE:nodehm:THISNODE:serialport#,#TABLE:nodehm:THISNODE:serialspeed#\"/' /etc/default/grub
|
||||
sed -i 's/\(GRUB_CMDLINE_LINUX_DEFAULT=\).*/\1""/g' /etc/default/grub
|
||||
update-grub
|
||||
fi
|
||||
sed -i 's/\(deb.*security.*\)/#\1/' /etc/apt/sources.list
|
||||
updateflag.awk $MASTER 3002
|
||||
cd /
|
||||
#rm -Rf /xcatpost
|
||||
#rm -f /tmp/mypostscript
|
||||
exit 0
|
||||
|
141
xCAT-server/share/xcat/install/scripts/post.ubuntu
Normal file
141
xCAT-server/share/xcat/install/scripts/post.ubuntu
Normal file
@ -0,0 +1,141 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Setup hostname
|
||||
#
|
||||
echo "post scripts" >/root/post.log
|
||||
export PRINIC=#TABLE:noderes:THISNODE:primarynic#
|
||||
if [ "$PRINIC" == "mac" ]
|
||||
then
|
||||
export PRINIC='#TABLE:mac:THISNODE:mac#'
|
||||
fi
|
||||
if [ -z "$PRINIC" ]
|
||||
then
|
||||
export PRINIC=eth0
|
||||
elif [[ `echo "$PRINIC" | grep -sqE ^[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+$ ;echo $?` == "0" ]]; then
|
||||
export PRINIC=`ifconfig -a | grep -i "HWaddr $PRINIC" | awk '{print $1}'`
|
||||
fi
|
||||
IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}')
|
||||
if [ -z $IP ]
|
||||
then
|
||||
dhclient eth0
|
||||
IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}')
|
||||
fi
|
||||
echo "search #TABLE:site:key=domain:value#" >/etc/resolv.conf
|
||||
for i in $(echo #TABLE:site:key=nameservers:value# | tr ',' ' ')
|
||||
do
|
||||
echo "nameserver $i"
|
||||
done >>/etc/resolv.conf
|
||||
export HOSTNAME=$(host $IP 2>/dev/null | awk '{print $5}' | awk -F. '{print $1}')
|
||||
hostname $HOSTNAME
|
||||
#
|
||||
# Run xCAT post install
|
||||
#
|
||||
export MASTER_IP="#XCATVAR:XCATMASTER#"
|
||||
export MASTER_IPS="#XCATVAR:XCATMASTER#"
|
||||
export MASTER="#XCATVAR:XCATMASTER#"
|
||||
cd /tmp
|
||||
RAND=$(perl -e 'print int(rand(50)). "\n"')
|
||||
sleep $RAND
|
||||
for i in $(seq 1 20)
|
||||
do
|
||||
GOTIT=0
|
||||
for i in $MASTER_IPS
|
||||
do
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts
|
||||
#wget --wait=10 --random-wait --waitretry=10 --retry-connrefused -t 0 -T 60 http://$i/install/autoinst/xcatpost.tar.gz
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
if [ ! -x /usr/bin/openssl ]; then #Stop if no openssl to help the next bit
|
||||
exit 1
|
||||
fi
|
||||
USEOPENSSLFORXCAT=1 #Though this is the only method going forward, flag to allow backward compatibility with 2.2 generated netboot images
|
||||
export USEOPENSSLFORXCAT
|
||||
XCATSERVER=$i:3001
|
||||
export XCATSERVER
|
||||
mv $i/postscripts /xcatpost
|
||||
rm -rf $i
|
||||
chmod +x /xcatpost/*
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
while [ -z "$MYCONT" ]; do
|
||||
RETRY=$(($RETRY+1))
|
||||
if [ $RETRY -eq $MAX_RETRIES ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
|
||||
MYCONT=`grep MASTER /tmp/mypostscript`
|
||||
done
|
||||
|
||||
|
||||
chmod +x /tmp/mypostscript
|
||||
GOTIT=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$GOTIT" = "1" ]
|
||||
then
|
||||
#save the master to /opt/xcat/xcatinfo file
|
||||
if [ ! -f /opt/xcat/xcatinfo ]; then
|
||||
mkdir -p /opt/xcat
|
||||
touch /opt/xcat/xcatinfo
|
||||
fi
|
||||
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
|
||||
break
|
||||
fi
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
sleep $RAND
|
||||
done
|
||||
cd /xcatpost
|
||||
#gunzip xcatpost.tar.gz
|
||||
#tar -xvf xcatpost.tar
|
||||
#/xcatpost/#TABLE:nodelist:THISNODE:node#
|
||||
export PATH=/xcatpost:$PATH
|
||||
|
||||
#save the postboot scripts to /tmp/mypostscript.post
|
||||
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript.post
|
||||
chmod 755 /tmp/mypostscript.post
|
||||
|
||||
#create the post init
|
||||
cat >/etc/init.d/xcatpostinit1 << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit1#
|
||||
EOF
|
||||
chmod 755 /etc/init.d/xcatpostinit1
|
||||
ln -s /etc/init.d/xcatpostinit1 /etc/rc2.d/S84xcatpostinit1
|
||||
mkdir -p /opt/xcat
|
||||
cat >/opt/xcat/xcatinstallpost << 'EOF'
|
||||
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatinstallpost#
|
||||
rm /etc/rc2.d/S84xcatpostinit1
|
||||
EOF
|
||||
chmod 755 /opt/xcat/xcatinstallpost
|
||||
|
||||
#only run the prebooot scripts here
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript`
|
||||
echo "$TMP" > /tmp/mypostscript
|
||||
|
||||
/tmp/mypostscript
|
||||
export NODE=#TABLE:nodelist:THISNODE:node#
|
||||
export OSVER=#TABLE:nodetype:THISNODE:os#
|
||||
export ARCH=#TABLE:nodetype:THISNODE:arch#
|
||||
#addsiteyum
|
||||
if [[ -r /boot/grub/menu.lst ]]; then
|
||||
sed -i 's/^serial/#serial/' /boot/grub/menu.lst
|
||||
sed -i 's/^terminal/#terminal/' /boot/grub/menu.lst
|
||||
elif [[ -r /boot/grub/grub.cfg ]] ; then
|
||||
sed -i 's/\(GRUB_CMDLINE_LINUX=\).*/\1\"console=tty0\ console=ttyS#TABLE:nodehm:THISNODE:serialport#,#TABLE:nodehm:THISNODE:serialspeed#\"/' /etc/default/grub
|
||||
sed -i 's/\(GRUB_CMDLINE_LINUX_DEFAULT=\).*/\1""/g' /etc/default/grub
|
||||
update-grub
|
||||
fi
|
||||
sed -i 's/\(deb.*security.*\)/#\1/' /etc/apt/sources.list
|
||||
updateflag.awk $MASTER 3002
|
||||
cd /
|
||||
#rm -Rf /xcatpost
|
||||
#rm -f /tmp/mypostscript
|
||||
exit 0
|
||||
|
90
xCAT-server/share/xcat/install/scripts/pre.debian
Normal file
90
xCAT-server/share/xcat/install/scripts/pre.debian
Normal file
@ -0,0 +1,90 @@
|
||||
#!/bin/sh
|
||||
|
||||
AWK=`find / -name awk | tail -1`
|
||||
#old awk /mounts/instsys/bin/awk -f
|
||||
|
||||
cat >/tmp/bar.awk <<EOF
|
||||
#!$AWK -f
|
||||
|
||||
BEGIN {
|
||||
xcatdport = "#TABLE:site:key=xcatiport:value#"
|
||||
xcatdhost = "#XCATVAR:XCATMASTER#"
|
||||
|
||||
ns = "/inet/tcp/0/" xcatdhost "/" xcatiport
|
||||
|
||||
print "xCAT_xcatd" |& ns
|
||||
|
||||
while(1) {
|
||||
ns |& getline
|
||||
|
||||
if(\$0 == "ready")
|
||||
print "installmonitor" |& ns
|
||||
if(\$0 == "done")
|
||||
break
|
||||
}
|
||||
|
||||
close(ns)
|
||||
|
||||
exit 0
|
||||
}
|
||||
EOF
|
||||
|
||||
if [ ! -c /dev/vcs ]; then
|
||||
mknod /dev/vcs c 7 0
|
||||
fi
|
||||
cat >/tmp/foo.awk <<EOF
|
||||
#!$AWK -f
|
||||
|
||||
BEGIN {
|
||||
ns = "/inet/tcp/3001/0/0"
|
||||
|
||||
while(1) {
|
||||
ns |& getline
|
||||
|
||||
# if(\$1 == "sh") { #TODO: ENABLE IF DEBUG
|
||||
# sub(/^sh +/,"",\$0)
|
||||
# output = \$0
|
||||
# while((output | getline) > 0)
|
||||
# print \$0 |& ns
|
||||
# print "EOO" |& ns
|
||||
# close(output)
|
||||
# }
|
||||
|
||||
if(\$1 == "screendump") {
|
||||
output = "chvt " \$2 ";cat /dev/vcs"
|
||||
while((output | getline) > 0)
|
||||
print \$0 |& ns
|
||||
close(output)
|
||||
}
|
||||
|
||||
if(\$1 == "stat") {
|
||||
while((getline < "/target/var/log/installer/syslog") > 0) {
|
||||
line = \$0
|
||||
}
|
||||
close("/target/var/log/installer/syslog")
|
||||
|
||||
if(line ~ /Unpacking/) {
|
||||
sub(/\.[^\.]+\.deb .*$/,"",line)
|
||||
sub(/^.* /,"",line)
|
||||
}
|
||||
if( (line ~ /Installing/) (line ~ /Selecting/) or (line ~ /Setting\ up/)) {
|
||||
sub(/\.[^\.]+\.deb .*$/,"",line)
|
||||
sub(/^.* /,"",line)
|
||||
}
|
||||
else {
|
||||
line = "prep"
|
||||
}
|
||||
|
||||
print ("installing " line) |& ns
|
||||
}
|
||||
|
||||
close(ns)
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
chmod 755 /tmp/foo.awk
|
||||
chmod 755 /tmp/bar.awk
|
||||
|
||||
/tmp/bar.awk &
|
||||
/tmp/foo.awk >/tmp/foo.log 2>&1 &
|
90
xCAT-server/share/xcat/install/scripts/pre.ubuntu
Normal file
90
xCAT-server/share/xcat/install/scripts/pre.ubuntu
Normal file
@ -0,0 +1,90 @@
|
||||
#!/bin/sh
|
||||
|
||||
AWK=`find / -name awk | tail -1`
|
||||
#old awk /mounts/instsys/bin/awk -f
|
||||
|
||||
cat >/tmp/bar.awk <<EOF
|
||||
#!$AWK -f
|
||||
|
||||
BEGIN {
|
||||
xcatdport = "#TABLE:site:key=xcatiport:value#"
|
||||
xcatdhost = "#XCATVAR:XCATMASTER#"
|
||||
|
||||
ns = "/inet/tcp/0/" xcatdhost "/" xcatiport
|
||||
|
||||
print "xCAT_xcatd" |& ns
|
||||
|
||||
while(1) {
|
||||
ns |& getline
|
||||
|
||||
if(\$0 == "ready")
|
||||
print "installmonitor" |& ns
|
||||
if(\$0 == "done")
|
||||
break
|
||||
}
|
||||
|
||||
close(ns)
|
||||
|
||||
exit 0
|
||||
}
|
||||
EOF
|
||||
|
||||
if [ ! -c /dev/vcs ]; then
|
||||
mknod /dev/vcs c 7 0
|
||||
fi
|
||||
cat >/tmp/foo.awk <<EOF
|
||||
#!$AWK -f
|
||||
|
||||
BEGIN {
|
||||
ns = "/inet/tcp/3001/0/0"
|
||||
|
||||
while(1) {
|
||||
ns |& getline
|
||||
|
||||
# if(\$1 == "sh") { #TODO: ENABLE IF DEBUG
|
||||
# sub(/^sh +/,"",\$0)
|
||||
# output = \$0
|
||||
# while((output | getline) > 0)
|
||||
# print \$0 |& ns
|
||||
# print "EOO" |& ns
|
||||
# close(output)
|
||||
# }
|
||||
|
||||
if(\$1 == "screendump") {
|
||||
output = "chvt " \$2 ";cat /dev/vcs"
|
||||
while((output | getline) > 0)
|
||||
print \$0 |& ns
|
||||
close(output)
|
||||
}
|
||||
|
||||
if(\$1 == "stat") {
|
||||
while((getline < "/target/var/log/installer/syslog") > 0) {
|
||||
line = \$0
|
||||
}
|
||||
close("/target/var/log/installer/syslog")
|
||||
|
||||
if(line ~ /Unpacking/) {
|
||||
sub(/\.[^\.]+\.deb .*$/,"",line)
|
||||
sub(/^.* /,"",line)
|
||||
}
|
||||
if( (line ~ /Installing/) (line ~ /Selecting/) or (line ~ /Setting\ up/)) {
|
||||
sub(/\.[^\.]+\.deb .*$/,"",line)
|
||||
sub(/^.* /,"",line)
|
||||
}
|
||||
else {
|
||||
line = "prep"
|
||||
}
|
||||
|
||||
print ("installing " line) |& ns
|
||||
}
|
||||
|
||||
close(ns)
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
chmod 755 /tmp/foo.awk
|
||||
chmod 755 /tmp/bar.awk
|
||||
|
||||
/tmp/bar.awk &
|
||||
/tmp/foo.awk >/tmp/foo.log 2>&1 &
|
127
xCAT-server/share/xcat/install/ubuntu/compute.tmpl
Normal file
127
xCAT-server/share/xcat/install/ubuntu/compute.tmpl
Normal file
@ -0,0 +1,127 @@
|
||||
|
||||
### Localization
|
||||
d-i debian-installer/locale string en_GB
|
||||
|
||||
# Keyboard Selection
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i console-setup/layoutcode string uk
|
||||
|
||||
### Network Configuration
|
||||
d-i netcfg/choose_interface select #TABLE:noderes:$NODE:primarynic#
|
||||
|
||||
d-i netcfg/get_hostname string unassigned-hostname
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
d-i netcfg/wireless_wep string
|
||||
|
||||
### Mirror settings
|
||||
# If you select ftp, the mirror/country string does not need to be set.
|
||||
|
||||
d-i mirror/country string manual
|
||||
d-i mirror/protocol string http
|
||||
d-i mirror/http/hostname string #TABLE:noderes:$NODE:nfsserver#
|
||||
d-i mirror/http/directory string /install/#TABLE:nodetype:$NODE:os#/#TABLE:nodetype:$NODE:arch#
|
||||
d-i mirror/http/proxy string
|
||||
|
||||
# Suite to install.
|
||||
#d-i mirror/suite string testing
|
||||
# Suite to use for loading installer components (optional).
|
||||
#d-i mirror/udeb/suite string testing
|
||||
#d-i mirror/suite string feisty
|
||||
|
||||
|
||||
### Partitioning
|
||||
# This creates a small /boot partition, suitable
|
||||
# swap, and uses the rest of the space for the root partition:
|
||||
|
||||
d-i partman-auto/method strng regular
|
||||
d-i partman-lvm/device_remove_lvm boolean true
|
||||
d-i partman-md/device_remove_md boolean true
|
||||
|
||||
# 100M /boot
|
||||
# 4G swap
|
||||
# / rest
|
||||
d-i partman-auto/expert_recipe string \
|
||||
boot-root :: \
|
||||
100 50 100 ext3 \
|
||||
$primary{ } $bootable{ } \
|
||||
method{ format } format{ } \
|
||||
use_filesystem{ } filesystem{ ext3 } \
|
||||
mountpoint{ /boot } \
|
||||
. \
|
||||
500 10000 1000000000 ext3 \
|
||||
method{ format } format{ } \
|
||||
use_filesystem{ } filesystem{ ext3 } \
|
||||
mountpoint{ / } \
|
||||
. \
|
||||
4096 512 300% linux-swap \
|
||||
method{ swap } format{ } \
|
||||
.
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
|
||||
|
||||
### Account setup
|
||||
|
||||
d-i passwd/root-login boolean true
|
||||
d-i passwd/make-user boolean false
|
||||
|
||||
d-i passwd/root-password-crypted password #CRYPT:passwd:key=system,username=root:password#
|
||||
|
||||
### Clock and time zone setup
|
||||
|
||||
d-i clock-setup/ntp boolean true
|
||||
d-i clock-setup/ntp-server string #TABLE:site:key=master:value#
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string #TABLE:site:key=timezone:value#
|
||||
|
||||
### Apt setup
|
||||
|
||||
d-i apt-setup/multiverse boolean false
|
||||
d-i apt-setup/universe boolean false
|
||||
|
||||
|
||||
### Boot loader installation
|
||||
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
### Package selection
|
||||
|
||||
tasksel tasksel/first multiselect standard
|
||||
|
||||
# gawk required for the xCAT scripts to work
|
||||
# Otherwise it installs mawk, which doesn't work
|
||||
|
||||
d-i pkgsel/include string openssh-server ntp gawk
|
||||
|
||||
d-i debian-installer/allow_unauthenticated string true
|
||||
d-i pkgsel/update-policy select none
|
||||
d-i pkgsel/updatedb boolean false
|
||||
|
||||
### Finishing up the installation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
### X configuration
|
||||
xserver-xorg xserver-xorg/autodetect_monitor boolean true
|
||||
|
||||
xserver-xorg xserver-xorg/config/monitor/selection-method \
|
||||
select medium
|
||||
|
||||
xserver-xorg xserver-xorg/config/monitor/mode-list \
|
||||
select 1024x768 @ 60 Hz
|
||||
|
||||
|
||||
d-i preseed/early_command string wget http://#TABLE:noderes:$NODE:nfsserver#/install/autoinst/#TABLE:nodelist:THISNODE:node#.pre; \
|
||||
chmod u+x #TABLE:nodelist:THISNODE:node#.pre; \
|
||||
./#TABLE:nodelist:THISNODE:node#.pre
|
||||
|
||||
d-i preseed/late_command string wget http://#TABLE:noderes:$NODE:nfsserver#/install/autoinst/#TABLE:nodelist:THISNODE:node#.post; \
|
||||
chmod u+x #TABLE:nodelist:THISNODE:node#.post; \
|
||||
cp ./#TABLE:nodelist:THISNODE:node#.post /target/root/post.script; \
|
||||
chroot /target /root/post.script
|
||||
|
13
xCAT-server/share/xcat/netboot/debian/compute.exlist
Normal file
13
xCAT-server/share/xcat/netboot/debian/compute.exlist
Normal file
@ -0,0 +1,13 @@
|
||||
./usr/share/man*
|
||||
./usr/share/locale*
|
||||
./usr/share/i18n*
|
||||
./var/cache/yum*
|
||||
./usr/share/doc*
|
||||
./usr/share/gnome*
|
||||
./usr/share/zoneinfo*
|
||||
./usr/share/cracklib*
|
||||
./usr/share/info*
|
||||
./usr/share/omf*
|
||||
./usr/lib/locale*
|
||||
./usr/lib/perl5*
|
||||
./boot*
|
12
xCAT-server/share/xcat/netboot/debian/compute.pkglist
Normal file
12
xCAT-server/share/xcat/netboot/debian/compute.pkglist
Normal file
@ -0,0 +1,12 @@
|
||||
bash
|
||||
nfs-common
|
||||
openssl
|
||||
dhcp3-client
|
||||
linux-image
|
||||
openssh-server
|
||||
openssh-client
|
||||
wget
|
||||
vim
|
||||
ntp
|
||||
rsyslog
|
||||
rsync
|
1265
xCAT-server/share/xcat/netboot/debian/genimage
Executable file
1265
xCAT-server/share/xcat/netboot/debian/genimage
Executable file
File diff suppressed because it is too large
Load Diff
13
xCAT-server/share/xcat/netboot/ubuntu/compute.exlist
Normal file
13
xCAT-server/share/xcat/netboot/ubuntu/compute.exlist
Normal file
@ -0,0 +1,13 @@
|
||||
./usr/share/man*
|
||||
./usr/share/locale*
|
||||
./usr/share/i18n*
|
||||
./var/cache/yum*
|
||||
./usr/share/doc*
|
||||
./usr/share/gnome*
|
||||
./usr/share/zoneinfo*
|
||||
./usr/share/cracklib*
|
||||
./usr/share/info*
|
||||
./usr/share/omf*
|
||||
./usr/lib/locale*
|
||||
./usr/lib/perl5*
|
||||
./boot*
|
12
xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist
Normal file
12
xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist
Normal file
@ -0,0 +1,12 @@
|
||||
bash
|
||||
nfs-common
|
||||
openssl
|
||||
dhcp3-client
|
||||
linux-image-generic
|
||||
openssh-server
|
||||
openssh-client
|
||||
wget
|
||||
vim
|
||||
ntp
|
||||
rsyslog
|
||||
rsync
|
1265
xCAT-server/share/xcat/netboot/ubuntu/genimage
Executable file
1265
xCAT-server/share/xcat/netboot/ubuntu/genimage
Executable file
File diff suppressed because it is too large
Load Diff
461
xCAT/postscripts/otherpkgs.ubuntu
Executable file
461
xCAT/postscripts/otherpkgs.ubuntu
Executable file
@ -0,0 +1,461 @@
|
||||
#!/bin/bash
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#=head1 otherpkgs
|
||||
#=head2 It gets the extra rpms and install/update them.
|
||||
# The environment variable OTHERPKGS contains the rpms to be installed/updated.
|
||||
# On MN, You need to:
|
||||
# 1. put rpms under /install/post/otherpkgs/os/arch directory where 'os' and 'arch'
|
||||
# can be found in the nodetype table.
|
||||
# 2. put the name of the packages to /opt/xcat/share/xcat/netboot(install)/platform
|
||||
# directory. The file name is one of the following:
|
||||
# profile.os.arch.otherpkgs.pkglist
|
||||
# profile.os.otherpkgs.pkglist
|
||||
# profile.arch.otherpkgs.pkglist
|
||||
# profile.otherpkgs.pkglist
|
||||
# The install/deployment process will pick up the rpms and install them on the nodes.
|
||||
# However, if the nodes have already installed and up and running, you can run the following
|
||||
# command to have the extra rpms installed:
|
||||
# updatenode noderange otherpkgs
|
||||
#
|
||||
#=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
# do nothing for diskless deployment case because it is done in the image already
|
||||
if [[ $UPDATENODE -ne 1 ]]; then
|
||||
if [ "$NODESETSTATE" = "netboot" -o \
|
||||
"$NODESETSTATE" = "statelite" -o \
|
||||
"$NODESETSTATE" = "diskless" -o \
|
||||
"$NODESETSTATE" = "dataless" ]
|
||||
then
|
||||
echo " Did not install any extra rpms."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "$OTHERPKGS_INDEX" ]]; then
|
||||
echo "$0: no extra rpms to install"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ -z "$NFSSERVER" ]]; then
|
||||
NFSSERVER=$MASTER
|
||||
fi
|
||||
|
||||
if [[ -z "$INSTALLDIR" ]]; then
|
||||
INSTALLDIR="/install"
|
||||
fi
|
||||
|
||||
#check if /install is mounted on the server, we may need to add code to conver NFSSERVER to ip
|
||||
mounted=0;
|
||||
result=`mount |grep /install |grep $NFSSERVER`
|
||||
if [ $? -eq 0 ]; then
|
||||
NFSSERVER="/install"
|
||||
mounted=1
|
||||
fi
|
||||
|
||||
if [[ -z "$OTHERPKGDIR" ]]; then
|
||||
OTHERPKGDIR="$NFSSERVER/post/otherpkgs/$OSVER/$ARCH"
|
||||
fi
|
||||
|
||||
if [ $mounted -eq 0 ]; then
|
||||
OTHERPKGDIR=${OTHERPKGDIR/#$INSTALLDIR/$NFSSERVER/}
|
||||
fi
|
||||
|
||||
echo NFSSERVER=$NFSSERVER
|
||||
logger -t xcat "NFSSERVER=$NFSSERVER"
|
||||
echo OTHERPKGDIR=$OTHERPKGDIR
|
||||
logger -t xcat "OTHERPKGDIR=$OTHERPKGDIR"
|
||||
|
||||
#if [ -x "/sbin/dhcpcd" ]; then
|
||||
# dhcpcd -n $PRIMARYNIC
|
||||
#fi
|
||||
|
||||
#check if the node has yum or zypper installed, it will try yum first, then zypper and last rpm
|
||||
# for rpm based machines, or check if apt is installed, then it will use apt then dpkg
|
||||
|
||||
hasrpm=0
|
||||
hasyum=0
|
||||
haszypper=0
|
||||
hasapt=0
|
||||
hasdpkg=0
|
||||
scommand="rpm"
|
||||
sinstallcommad="$scommand -ivh"
|
||||
supdatecommad="$scommand -Uvh --replacepkgs"
|
||||
sremovecommad="$scommand -ev"
|
||||
|
||||
result=`which rpm`
|
||||
if [ $? -eq 0 ]; then
|
||||
hasrpm=1
|
||||
result=`rpm -q yum`
|
||||
if [ $? -eq 0 ]; then
|
||||
hasyum=1
|
||||
else
|
||||
result=`rpm -q zypper`
|
||||
if [ "$?" = "0" ]; then
|
||||
haszypper=1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
result=`which dpkg`
|
||||
if [ $? -eq 0 ]; then
|
||||
hasdpkg=1
|
||||
scommand="dpkg"
|
||||
sinstallcommand="$scommand -i"
|
||||
supdatecommand="$sinstallcommand"
|
||||
sremovecommand="$scommand -r"
|
||||
result=`dpkg -l apt`
|
||||
if [ $? -eq 0 ]; then
|
||||
hasapt=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# To support the #NEW_INSTALL_LIST# entry in otherpkgs.pkglist files,
|
||||
# multiple lists of packages are provided to this script in the form:
|
||||
# OTHERPKGS1, OTHERPKGS2, ... OTHERPKSn where n=OTHERPKGS_INDEX
|
||||
# Each sublist will be installed in a separate call (separate pass
|
||||
# through this loop)
|
||||
op_index=1
|
||||
#echo "OTHERPKGS_INDEX = $OTHERPKGS_INDEX"
|
||||
while [ $op_index -le $OTHERPKGS_INDEX ]; do
|
||||
eval pkglist=\$OTHERPKGS$op_index
|
||||
#echo "pkglist = $pkglist"
|
||||
if [ $hasyum -eq 1 ]; then
|
||||
mkdir -p /etc/yum.repos.d
|
||||
result=`rm /etc/yum.repos.d/xCAT-otherpkgs*.repo 2>&1`
|
||||
result=`yum clean all`
|
||||
repo_base="/etc/yum.repos.d"
|
||||
elif [ $haszypper -eq 1 ]; then
|
||||
#remove old repo
|
||||
old_repo=`zypper sl |grep xcat-otherpkgs | cut -f2 -d '|'`
|
||||
for x in $old_repo
|
||||
do
|
||||
result=`zypper sd $x`
|
||||
done
|
||||
zypper --non-interactive refresh
|
||||
repo_base="/tmp"
|
||||
elif [ $hasapt -eq 1 ] ; then
|
||||
mkdir -p /etc/apt/sources.list.d
|
||||
result=`rm /etc/apt/sources.list.d/xCAT-otherpkgs*.list 2>&1`
|
||||
result=`apt-get -y update`
|
||||
repo_base="/etc/apt/sources.list.d"
|
||||
fi
|
||||
|
||||
repo_path=()
|
||||
repo_pkgs=""
|
||||
repo_pkgs_preremove=""
|
||||
repo_pkgs_postremove=""
|
||||
plain_pkgs=""
|
||||
plain_pkgs_preremove=""
|
||||
plain_pkgs_postremove=""
|
||||
handled_path=()
|
||||
for x in `echo "$pkglist" | tr "," "\n"`
|
||||
do
|
||||
#check if the file name starts with -- or -.
|
||||
#If it is start with -, then the rpm must be removed before installing other packages
|
||||
#If it is start with --, then the rpm will be removed after installing other packages
|
||||
string_type=0; #nornmal rpm
|
||||
pos=`expr index $x -`
|
||||
if [ $pos -eq 1 ]; then
|
||||
x=`echo ${x#-}`
|
||||
pos=`expr index $x -`
|
||||
if [ $pos -eq 1 ]; then
|
||||
x=`echo ${x#-}`
|
||||
string_type=1 #start with --
|
||||
else
|
||||
string_type=-1 #start with -
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $hasyum -eq 0 ] && [ $haszypper -eq 0 ] && [ $hasapt -eq 0 ]; then
|
||||
if [ $string_type -eq -1 ]; then
|
||||
plain_pkgs_preremove="$plain_pkgs_preremove $x"
|
||||
elif [ $string_type -eq 1 ]; then
|
||||
plain_pkgs_postremove="$plain_pkgs_postremove $x"
|
||||
else
|
||||
plain_pkgs="$plain_pkgs $x*"
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ $string_type -eq -1 ]; then
|
||||
repo_pkgs_preremove="$repo_pkgs_preremove $x"
|
||||
elif [ $string_type -eq 1 ]; then
|
||||
repo_pkgs_postremove="$repo_pkgs_postremove $x"
|
||||
else
|
||||
fn=`basename $x`
|
||||
path=`dirname $x`
|
||||
whole_path=$OTHERPKGDIR/$path
|
||||
#whole_path=$OTHERPKGDIR
|
||||
|
||||
#find out if this path has already handled
|
||||
try_repo=1
|
||||
rc=1
|
||||
i=0
|
||||
while [ $i -lt ${#handled_path[*]} ]; do
|
||||
if [ ${handled_path[$i]} = $path ]; then
|
||||
try_repo=0
|
||||
j=0
|
||||
while [ $j -lt ${#repo_path[*]} ]; do
|
||||
if [ ${repo_path[$j]} = $path ]; then
|
||||
rc=0
|
||||
break
|
||||
fi
|
||||
let j++
|
||||
done
|
||||
break
|
||||
fi
|
||||
let i++
|
||||
done
|
||||
|
||||
|
||||
#try to add the path to the repo
|
||||
if [ $try_repo -eq 1 ]; then
|
||||
index=${#repo_path[*]}
|
||||
if [ $hasyum -eq 1 ] || [ $haszypper -eq 1 ] ; then
|
||||
REPOFILE="$repo_base/xCAT-otherpkgs$index.repo"
|
||||
echo "[xcat-otherpkgs$index]" > $REPOFILE
|
||||
echo "name=xcat-otherpkgs$index" >> $REPOFILE
|
||||
if [ $mounted -eq 0 ]; then
|
||||
echo "baseurl=ftp://$whole_path" >> $REPOFILE
|
||||
else
|
||||
echo "baseurl=file://$whole_path" >> $REPOFILE
|
||||
fi
|
||||
echo "enabled=1" >> $REPOFILE
|
||||
echo "gpgcheck=0" >> $REPOFILE
|
||||
elif [ $hasapt -eq 1 ] ; then
|
||||
REPOFILE="$repo_base/xCAT-otherpkgs$index.list"
|
||||
|
||||
if [ $mounted -eq 0 ]; then
|
||||
type=ftp
|
||||
else
|
||||
type=file
|
||||
fi
|
||||
|
||||
echo "deb $type://$whole_path /" >> $REPOFILE
|
||||
fi
|
||||
|
||||
if [ $hasyum -eq 1 ]; then
|
||||
#use yum
|
||||
result=`yum list $fn 2>&1`
|
||||
if [ $? -eq 0 ]; then
|
||||
rc=0
|
||||
repo_path[${#repo_path[*]}]=$path
|
||||
else
|
||||
rm $REPOFILE
|
||||
fi
|
||||
elif [ $haszypper -eq 1 ]; then
|
||||
#use zypper
|
||||
if [[ "$OSVER" = sles11* ]]; then
|
||||
result=`zypper ar -c $REPOFILE`
|
||||
else
|
||||
result=`zypper sa -c $REPOFILE`
|
||||
fi
|
||||
|
||||
result=`zypper --non-interactive refresh xcat-otherpkgs$index 2>&1`
|
||||
if [ $? -eq 0 ]; then
|
||||
rc=0
|
||||
repo_path[${#repo_path[*]}]=$path
|
||||
else
|
||||
result=`zypper sd xcat-otherpkgs$index`
|
||||
fi
|
||||
elif [ $hasapt -eq 1 ]; then
|
||||
#use apt
|
||||
result=`apt-cache search $fn 2>&1`
|
||||
if [ $? -eq 0 ]; then
|
||||
rc=0
|
||||
repo_path[${#repo_path[*]}]=$path
|
||||
else
|
||||
rm $REPOFILE
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if [ $rc -eq 0 ]; then
|
||||
repo_pkgs="$repo_pkgs $fn"
|
||||
else
|
||||
#now no hope we have to use rpm command
|
||||
plain_pkgs="$plain_pkgs $x*"
|
||||
fi
|
||||
handled_path[${#handled_path[*]}]=$path
|
||||
fi
|
||||
done
|
||||
|
||||
#now update all the existing rpms
|
||||
if [ $hasyum -eq 1 ]; then
|
||||
echo "yum -y upgrade"
|
||||
result=`yum -y upgrade 2>&1`
|
||||
logger -t xcat "$result"
|
||||
if [ $? -ne 0 ]; then
|
||||
logger -t xcat "otherpkgs: $result"
|
||||
fi
|
||||
echo "$result"
|
||||
elif [ $haszypper -eq 1 ]; then
|
||||
echo "zypper --non-interactive update --auto-agree-with-license"
|
||||
result=`zypper --non-interactive update --auto-agree-with-license 2>&1`
|
||||
logger -t xcat "$result"
|
||||
if [ $? -ne 0 ]; then
|
||||
logger -t xcat "otherpkgs: $result"
|
||||
fi
|
||||
echo "$result"
|
||||
fi
|
||||
|
||||
#echo "repo_pkgs=$repo_pkgs,\nrepo_pkgs_preremove=$repo_pkgs_preremove,\nrepo_pkgs_postremove=$repo_pkgs_postremove"
|
||||
#echo "plain_pkgs=$plain_pkgs,\nplain_pkgs_preremove=$plain_pkgs_preremove,\nplain_pkgs_postremove=$plain_pkgs_postremove"
|
||||
|
||||
|
||||
#Now we have parsed the input, let's remove rpms if is specified with -
|
||||
if [ "$repo_pkgs_preremove" != "" ]; then
|
||||
if [ $hasyum -eq 1 ]; then
|
||||
echo "yum -y remove $repo_pkgs_preremove"
|
||||
result=`yum -y remove $repo_pkgs_preremove 2>&1`
|
||||
logger -t xcat "$result"
|
||||
if [ $? -ne 0 ]; then
|
||||
logger -t xcat "otherpkgs: $result"
|
||||
fi
|
||||
echo "$result"
|
||||
elif [ $haszypper -eq 1 ]; then
|
||||
echo "zypper remove -y $repo_pkgs_preremove"
|
||||
result=`zypper remove -y $repo_pkgs_preremove 2>&1`
|
||||
logger -t xcat "$result"
|
||||
if [ $? -ne 0 ]; then
|
||||
logger -t xcat "otherpkgs: $result"
|
||||
fi
|
||||
echo "$result"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$plain_pkgs_preremove" != "" ]; then
|
||||
echo "$sremovecommand $plain_pkgs_preremove"
|
||||
result=`$sremovecommand $plain_pkgs_preremove 2>&1`
|
||||
logger -t xcat "$result"
|
||||
if [ $? -ne 0 ]; then
|
||||
logger -t xcat "otherpkgs $result"
|
||||
fi
|
||||
echo "$result"
|
||||
fi
|
||||
|
||||
|
||||
#installation using yum or zypper
|
||||
if [ "$repo_pkgs" != "" ]; then
|
||||
if [ $hasyum -eq 1 ]; then
|
||||
echo "yum -y install $repo_pkgs"
|
||||
result=`yum -y install $repo_pkgs 2>&1`
|
||||
logger -t xcat "$result"
|
||||
if [ $? -ne 0 ]; then
|
||||
logger -t xcat "otherpkgs: $result"
|
||||
fi
|
||||
echo "$result"
|
||||
elif [ $haszypper -eq 1 ]; then
|
||||
echo "zypper install -y $repo_pkgs"
|
||||
result=`zypper install -y $repo_pkgs 2>&1`
|
||||
logger -t xcat "$result"
|
||||
if [ $? -ne 0 ]; then
|
||||
logger -t xcat "otherpkgs: $result"
|
||||
fi
|
||||
echo "$result"
|
||||
#remove the repos
|
||||
#old_repo=`zypper lr -u |grep xcat-otherpkgs | cut -f2 -d '|'`
|
||||
#for x in $old_repo
|
||||
#do
|
||||
# result=`zypper sd $x`
|
||||
#done
|
||||
elif [ $hasapt -eq 1 ]; then
|
||||
echo "apt-get -q -y --force-yes install $repo_pkgs"
|
||||
result=`apt-get -q -y --force-yes install $repo_pkgs 2>&1`
|
||||
logger -t xcat "$result"
|
||||
if [ $? -ne 0 ]; then
|
||||
logger -t xcat "otherpkgs: $result"
|
||||
fi
|
||||
echo "$result"
|
||||
fi
|
||||
fi
|
||||
|
||||
#Handle the rest with rpm
|
||||
if [ "$plain_pkgs" != "" ]; then
|
||||
if [ $mounted -eq 0 ]; then
|
||||
dir_no_ftproot=${OTHERPKGDIR#$INSTALLDIR/}
|
||||
mkdir -p /xcatpost/$dir_no_ftproot
|
||||
rm -f -R /xcatpost/$dir_no_ftproot/*
|
||||
mkdir -p /tmp/postage/
|
||||
rm -f -R /tmp/postage/*
|
||||
cd /tmp/postage
|
||||
|
||||
for x in `echo "$plain_pkgs" | tr " " "\n"`
|
||||
do
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$OTHERPKGDIR/$x 2> /tmp/wget.log
|
||||
done
|
||||
|
||||
mv $dir_no_ftproot/* /xcatpost/$dir_no_ftproot;
|
||||
rm -rf $NFSSERVER
|
||||
cd /xcatpost/$dir_no_ftproot
|
||||
else
|
||||
cd $OTHERPKGDIR
|
||||
fi
|
||||
|
||||
echo "$supdatecommand --replacepkgs $plain_pkgs"
|
||||
result=`$supdatecommand --replacepkgs $plain_pkgs 2>&1`
|
||||
logger -t xcat "$result"
|
||||
if [ $? -ne 0 ]; then
|
||||
logger -t xcat "otherpkgs $result"
|
||||
fi
|
||||
echo "$result"
|
||||
|
||||
if [ $mounted -eq 0 ]; then
|
||||
cd /xcatpost
|
||||
dir_no_ftproot=${OTHERPKGDIR#$INSTALLDIR/}
|
||||
dir_no_ftproot=${dir_no_ftproot/\/*/}
|
||||
rm -f -R $dir_no_ftproot
|
||||
fi
|
||||
fi
|
||||
|
||||
#remove more rpms if specified with --
|
||||
if [ "$repo_pkgs_postremove" != "" ]; then
|
||||
if [ $hasyum -eq 1 ]; then
|
||||
echo "yum -y remove $repo_pkgs_postremove"
|
||||
result=`yum -y remove $repo_pkgs_postremove 2>&1`
|
||||
logger -t xcat "$result"
|
||||
if [ $? -ne 0 ]; then
|
||||
logger -t xcat "otherpkgs: $result"
|
||||
fi
|
||||
echo "$result"
|
||||
elif [ $haszypper -eq 1 ]; then
|
||||
echo "zypper remove -y $repo_pkgs_postremove"
|
||||
result=`zypper remove -y $repo_pkgs_postremove 2>&1`
|
||||
logger -t xcat "$result"
|
||||
if [ $? -ne 0 ]; then
|
||||
logger -t xcat "otherpkgs: $result"
|
||||
fi
|
||||
echo "$result"
|
||||
elif [ $hasapt -eq 1 ]; then
|
||||
echo "apt-get -y remove $repo_pkgs_postremove"
|
||||
result=`apt-get -y remove $repo_pkgs_postremove 2>&1`
|
||||
logger -t xcat "$result"
|
||||
if [ $? -ne 0 ]; then
|
||||
logger -t xcat "otherpkgs: $result"
|
||||
fi
|
||||
echo "$result"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$plain_pkgs_postremove" != "" ]; then
|
||||
echo "$sremovecommand $plain_pkgs_postremove"
|
||||
result=`$sremovecommand $plain_pkgs_postremove 2>&1`
|
||||
logger -t xcat "$result"
|
||||
if [ $? -ne 0 ]; then
|
||||
logger -t xcat "otherpkgs $result"
|
||||
fi
|
||||
echo "$result"
|
||||
fi
|
||||
|
||||
let op_index=$op_index+1
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
@ -74,7 +74,7 @@ if [[ $NTYPE = service ]]; then
|
||||
fi
|
||||
|
||||
if [[ $OSTYPE = linux* ]]; then
|
||||
if [[ $OSVER = fedora* ]] || [[ $OSVER = rhels5* ]] || [[ $OSVER = rhel6* ]] || [[ $OSVER = rhels6* ]] || [[ -f /etc/fedora-release ]] || [[ -f /etc/redhat-release ]]; then
|
||||
if [[ $OSVER = fedora* ]] || [[ $OSVER = rhels5* ]] || [[ $OSVER = rhel6* ]] || [[ $OSVER = rhels6* ]] || [[ -f /etc/fedora-release ]] || [[ -f /etc/redhat-release ]] || [[ $OSVER = ubuntu* ]]; then
|
||||
if [ -e /etc/rsyslog.conf ]; then
|
||||
conf_file="/etc/rsyslog.conf"
|
||||
sysconfig="/etc/sysconfig/rsyslog"
|
||||
|
@ -34,6 +34,9 @@ stop)
|
||||
logger -t xcat "nothing to stop"
|
||||
;;
|
||||
start)
|
||||
# For nodes that unmount/remove /tmp at install time, like ubuntu
|
||||
#cp /root/mypostscript* /tmp/.
|
||||
|
||||
# Node is stateless by default
|
||||
STATELITE="No"
|
||||
|
||||
|
@ -31,6 +31,9 @@ stop)
|
||||
echo -n "nothing to stop "
|
||||
;;
|
||||
start)
|
||||
# For nodes that unmount/remove /tmp at install time, like ubuntu
|
||||
#cp /root/mypostscript* /tmp/.
|
||||
|
||||
# run /opt/xcat/xcatinstallpost
|
||||
if [ -r /opt/xcat/xcatinstallpost ]; then
|
||||
/opt/xcat/xcatinstallpost
|
||||
|
Loading…
Reference in New Issue
Block a user