source: trunk/example/masterscript.new

Last change on this file was 570, checked in by dennis, 8 years ago

Changing SARA to SURFsara

  • Property svn:keywords set to Id
File size: 4.0 KB
Line 
1#!/bin/sh
2#
3# SURFsara install script for LISA nodes:
4# Initial Authors: Bas van der Vlies and Jaap Dijkshoorn
5#
6# SVN Info:
7#       $Id: masterscript.new 570 2013-04-19 07:09:49Z dennis $
8
9# Pull in variables left behind by the linuxrc script.
10# This information is passed from the linuxrc script on the autoinstall media
11# via /tmp/variables.txt.
12#
13#set -x
14
15. /tmp/variables.txt
16
17# Load functions and other variables
18. /etc/init.d/functions
19
20## Checking if we are using grub legacy or grub2.
21## if grub2 is used the disk are set with label gpt
22
23if [ "$GRUB2" == "yes" ]; then
24        DISKLABEL=gpt
25else
26        DISKLABEL=msdos
27fi
28
29get_arch
30
31NO_LISTING=yes
32if [ -z $NO_LISTING ]; then
33    VERBOSE_OPT="v"
34else
35    VERBOSE_OPT=""
36fi
37
38# Remove .master from script name
39#
40SARA_IMAGE=`echo $0 | cut -d. -f1`
41
42echo $0
43echo $IMAGENAME
44
45[ -z $IMAGENAME ] && IMAGENAME=`basename $SARA_IMAGE`
46[ -z $OVERRIDES ] && OVERRIDES=`basename $SARA_IMAGE`
47
48echo $IMAGENAME
49export IMAGENAME
50save_param IMAGENAME "${IMAGENAME}"
51
52## Sort disk, first disk to be found are sd* disk
53#
54disk_enumerate "sd hd vd cciss"
55
56## Begin disk creation and mounting
57# Create disk label.  This ensures that all remnants of the old label, whatever
58# type it was, are removed and that we're starting with a clean label.
59logmsg "set_disklabel  $DISK0 $DISKLABEL"
60set_disklabel $DISK0 $DISKLABEL
61
62if [ "$DISKLABEL" == "msdos" ]; then
63        logmsg "partition $DISK0 1024:ext2.128:/boot:boot 1:none 4096:swap::swap 0:xfs:/:root"
64        partition $DISK0 1024:ext2.128:/boot:boot 4096:swap::swap 0:xfs:/:root
65else
66        logmsg "partition $DISK0 1024:ext2:/boot:boot 1:grub2 4096:swap::swap 0:xfs:/:root"
67        partition $DISK0 1024:ext2:/boot:boot 1:grub2 4096:swap::swap 0:xfs:/:root
68fi
69
70if [ ! -z $DISK1 ]
71then
72        logmsg "set_disklabel  $DISK1 $DISKLABEL"
73        set_disklabel $DISK1 $DISKLABEL
74
75        logmsg "partition $DISK1 0:xfs:/scratch:scratch"
76        partition $DISK1 0:xfs:/scratch:scratch
77fi
78
79logmsg "mount_disks"
80mount_disks
81
82## End disk creation and mounting
83
84### BEGIN mount proc in image for tools like System Configurator ###
85### BEGIN mount sysfs in image for tools that might be run during chroot ###
86logmsg "chroot_mount_system_fs"
87chroot_mount_system_fs
88### END mount proc in image for tools like System Configurator ###
89### END mount sysfs in image for tools that might be run during chroot ###
90
91################################################################################
92#
93#   Lay the image down on the freshly formatted disk(s)
94#
95if [ ! -z $MONITOR_SERVER ]; then
96    start_report_task
97fi
98
99## Let's get the image
100# TODO: rewrite this so we can use PROTOCOL instead of using BITTORRENT yes/no
101logmsg "getimage"
102getimage
103
104# Leave notice of which image is installed on the client
105echo $IMAGENAME > /a/root/IMAGE_LAST_SYNCED_TO || shellout
106
107if [ "$GRUB2" == "yes" ]
108then
109        grub2_install $DISK0
110fi
111
112#
113################################################################################
114
115
116################################################################################
117#
118#   Post Install Scripts
119#
120
121run_post_install_scripts
122
123#
124################################################################################
125
126################################################################################
127#
128#   Save virtual console session in the imaged client
129#
130if [ ! -z $MONITOR_SERVER ]; then
131    if [ "x$MONITOR_CONSOLE" = "xyes" ]; then 
132        [ ! -d /a/root ] && mkdir -p /a/root
133        cp -f /var/log/sali.log /a/root/sali.log
134    fi
135fi
136
137#
138################################################################################
139
140################################################################################
141#
142#   Unmount filesystems
143#
144
145logmsg "chroot_umount_system_fs"
146chroot_umount_system_fs
147
148logmsg "umount_disks"
149umount_disks
150
151#
152################################################################################
153
154
155################################################################################
156#
157#   Tell the image server we are done
158#   
159rsync $IMAGESERVER::scripts/imaging_complete > /dev/null 2>&1
160logmsg "Imaging completed"
161#
162################################################################################
163
164reboot
Note: See TracBrowser for help on using the repository browser.