summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic.pouzenc@mines-albi.fr>2017-11-03 17:41:26 +0100
committerLudovic Pouzenc <ludovic.pouzenc@mines-albi.fr>2017-11-03 17:41:26 +0100
commit86863ee1f083dbdadcb896734b319aa59a2707c4 (patch)
tree94a5a47502621c0583ba79c2f0cc6a88c4ed806c
parentfe5aa2731c35f3f73c968536ed43b0f390be36cf (diff)
downloadeficast-86863ee1f083dbdadcb896734b319aa59a2707c4.tar.gz
eficast-86863ee1f083dbdadcb896734b319aa59a2707c4.tar.bz2
eficast-86863ee1f083dbdadcb896734b319aa59a2707c4.zip
Some more deploy scripting and hard-coded tests
-rw-r--r--nfs/scripts/funcs.sh11
-rw-r--r--nfs/scripts/image_capture.sh1
-rw-r--r--nfs/scripts/image_deploy.sh13
-rw-r--r--nfs/scripts/image_deploy_I5456.sh11
4 files changed, 25 insertions, 11 deletions
diff --git a/nfs/scripts/funcs.sh b/nfs/scripts/funcs.sh
index a69fb75..a1757a1 100644
--- a/nfs/scripts/funcs.sh
+++ b/nfs/scripts/funcs.sh
@@ -60,3 +60,14 @@ scriptavailability_test() {
fi
}
+# $1 : scriptname, print colored message, returns 0 script is available, returns 1 if not
+diravailability_test() {
+ dir=$1
+ if [ -d $dir ]
+ then echo_color green black ">>> Image $dir is available"
+ return 0
+ else echo_color white blue ">>> Image $dir is missing or unreadable"
+ return 1
+ fi
+}
+
diff --git a/nfs/scripts/image_capture.sh b/nfs/scripts/image_capture.sh
index 47aad9c..7c23c30 100644
--- a/nfs/scripts/image_capture.sh
+++ b/nfs/scripts/image_capture.sh
@@ -19,6 +19,7 @@ setterm -bold on
env
setterm -bold off
echo_color green black "$scriptdir/image_capture_${hostname}.sh script will run on tty1 now"
+pause10s
source $scriptdir/image_capture_${hostname}.sh
date >>logs/date.log
diff --git a/nfs/scripts/image_deploy.sh b/nfs/scripts/image_deploy.sh
index e23fd70..69c5cf6 100644
--- a/nfs/scripts/image_deploy.sh
+++ b/nfs/scripts/image_deploy.sh
@@ -8,11 +8,14 @@ monthday=$(date +%m-%d)
# define what master image should be used for the current client machine
#TODO : have a better place for that (CMDB...)
case "$hostname" in
- I5480) mastername=pctp-master ;;
- *) mastername=I4920 ;;
-# *) echo_color white red ">>> " "No master for $hostname (see image_deploy.sh)" ; exit 1 ;;
+ I5480) mastername=I5456 ;;
+ I5454) mastername=I5456 ;;
+ *) echo_color white red ">>> " "No master for $hostname (see image_deploy.sh)" ; exit 1 ;;
esac
+# Check and print if the deploy script is defined for the current master machine
+scriptavailability_test image_deploy_${mastername}.sh || exit $?
+
# Determine which image take
#TODO : have a better place for that (CMDB...)
ls -ld "$imagedir/$year/$mastername/"
@@ -21,8 +24,7 @@ indir=$(find "$imagedir/$year/$mastername/" -maxdepth 1 -type d -regex '.*/\d\d-
# Put a bad value to help the user to see where the image should be available
indir=${indir:-$imagedir/$year/$mastername/XX-XX}
-# Check and print if the deploy script is defined for the current master machine
-scriptavailability_test image_deploy_${mastername}.sh || exit $?
+# Check and print if the select image is available
diravailability_test $indir || exit $?
# Print all variables and start the deploy using the customized script (image_deploy_<hostname>.sh)
@@ -30,6 +32,7 @@ setterm -bold on
env
setterm -bold off
echo_color green black "$scriptdir/image_deploy_${mastername}.sh script will run on tty1 now"
+pause10s
source $scriptdir/image_deploy_${mastername}.sh
diff --git a/nfs/scripts/image_deploy_I5456.sh b/nfs/scripts/image_deploy_I5456.sh
index b151af9..d0c8916 100644
--- a/nfs/scripts/image_deploy_I5456.sh
+++ b/nfs/scripts/image_deploy_I5456.sh
@@ -4,19 +4,18 @@
# $outdir is the also the current working dir, garanted to be empty and writable
# Many cloning/partitioning tools are available for use, see make-boot-image.sh
-echo_color white blue ">>> " "Restoring /dev/sda boot sectors"
+echo_color white blue ">>> Restoring /dev/sda boot sectors"
pigz -dc "$indir/sda-dd.gz" | dd of=/dev/sda count=2048
-echo_color white blue ">>> " "Detecting new partitions"
+echo_color white blue ">>> Detecting new partitions"
echo -e "w\nq\n" | fdisk /dev/sda
-echo_color white blue ">>> " "Restoring /dev/sda1 NTFS BOOT"
+echo_color white blue ">>> Restoring /dev/sda1 NTFS BOOT"
pigz -dc "$indir/sda1-partclone.gz" | partclone.restore -o /dev/sda1
-echo_color white blue ">>> " "Restoring /dev/sda2 NTFS WINDOWS"
+echo_color white blue ">>> Restoring /dev/sda2 NTFS WINDOWS"
pigz -dc "$indir/sda2-partclone.gz" | partclone.restore -o /dev/sda2
-echo_color white blue ">>> " "Restoring /dev/sda3 EXT4 LINUX"
+echo_color white blue ">>> Restoring /dev/sda3 EXT4 LINUX"
pigz -dc "$indir/sda3-partclone.gz" | partclone.restore -o /dev/sda3
-