summaryrefslogtreecommitdiffstats
path: root/installer
diff options
context:
space:
mode:
authorNico Dietrich2006-03-24 00:33:25 +0100
committerNico Dietrich2006-03-24 00:33:25 +0100
commitfb0229630649060c2ac502fd7142ab3e2fe0f7ad (patch)
tree2e40729019fa7a5b36822431313fe9b92a37c316 /installer
parentvmware-prep test version (diff)
downloadcore-fb0229630649060c2ac502fd7142ab3e2fe0f7ad.tar.gz
core-fb0229630649060c2ac502fd7142ab3e2fe0f7ad.tar.xz
core-fb0229630649060c2ac502fd7142ab3e2fe0f7ad.zip
installer: kernel autodetection
git-svn-id: http://svn.openslx.org/svn/openslx/ld4@122 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'installer')
-rw-r--r--installer/default_files/default61
-rw-r--r--installer/distro-specs/config-debian6
-rw-r--r--installer/distro-specs/config-suse6
-rw-r--r--installer/distro-specs/config-ubuntu1
-rw-r--r--installer/distro-specs/exclude-suse-10.04
-rw-r--r--installer/distro-specs/exclude-suse-10.14
-rw-r--r--installer/distro-specs/exclude-ubuntu-5.10 (renamed from installer/distro-specs/exclude-ubuntu)0
-rwxr-xr-xinstaller/ld4-inst101
8 files changed, 92 insertions, 91 deletions
diff --git a/installer/default_files/default b/installer/default_files/default
index f7c22c8d..2ec41b9f 100644
--- a/installer/default_files/default
+++ b/installer/default_files/default
@@ -28,68 +28,11 @@ LABEL
APPEND @@@server@@@::@@@tftpbootdir@@@/pxelinux.cfg/default
#####
-LABEL dxsdefault
- MENU DEFAULT
- MENU LABEL 1. @@@client_distro@@@-@@@client_distro_ver@@@ Diskless
- KERNEL @@@server@@@::@@@tftpbootdir@@@/vmlinuz
- APPEND nfsroot=@@@server@@@:@@@rootdir@@@ vga=0x317 nosplash initrd=@@@server@@@::@@@tftpbootdir@@@/initrd apic dhcp noldsc vci=DXS
- ipappend 1
-
-
-LABEL kr1
- MENU LABEL 1. 10.0 NFS
- KERNEL @@@server@@@::@@@tftpbootdir@@@/suse10nfs
- APPEND nfsroot=@@@server@@@:/nfsroot/sdc/10.0 vga=0x317 splash=silent initrd=@@@server@@@::@@@tftpbootdir@@@/initrd-10nfs apic dhcp noldsc vci=DXS
- ipappend 1
-
-LABEL kr2
- MENU LABEL 1. 10.0 NBD
- KERNEL @@@server@@@::@@@tftpbootdir@@@/suse10nfs
- APPEND nbdroot=@@@server@@@:5000,squashfs vga=0x317 splash=silent initrd=@@@server@@@::@@@tftpbootdir@@@/initrd-10nfs apic dhcp noldsc vci=DXS
- ipappend 1
-
-LABEL kr3
- MENU LABEL 1. 10.0 DNBD
- KERNEL @@@server@@@::@@@tftpbootdir@@@/suse10nfs
- APPEND dnbdroot=224.0.0.4:squashfs vga=0x317 splash=silent initrd=@@@server@@@::@@@tftpbootdir@@@/initrd-10nfs apic dhcp noldsc vci=DXS elevator=noop
- ipappend 1
-
-LABEL kr4
- MENU LABEL 1. 10.1 NFS
- KERNEL @@@server@@@::@@@tftpbootdir@@@/suse101nfs
- APPEND nfsroot=@@@server@@@:/nfsroot/10.1 vga=0x317 splash=silent initrd=@@@server@@@::@@@tftpbootdir@@@/initrd-101nfs apic dhcp noldsc vci=DXS debug=1
- ipappend 1
-
-LABEL kr5
- MENU LABEL 1. 10.1 DNBD-SQFS
- KERNEL @@@server@@@::@@@tftpbootdir@@@/suse101nfs
- APPEND dnbdroot=224.0.0.5:5001,squashfs vga=0x317 splash=silent initrd=@@@server@@@::@@@tftpbootdir@@@/initrd-101nfs apic dhcp noldsc vci=DXS debug=0 elevator=noop
- ipappend 1
-
-LABEL kr5a
- MENU LABEL 1. 10.1 NBD-SQFS
- KERNEL @@@server@@@::@@@tftpbootdir@@@/suse101nfs
- APPEND nbdroot=@@@server@@@:5000,squashfs vga=0x317 splash=silent initrd=@@@server@@@::@@@tftpbootdir@@@/initrd-101nfs apic dhcp noldsc vci=DXS debug=0 elevator=anticipatory
- ipappend 1
-
-LABEL kr6
- MENU LABEL 1. 10.1 DNBD-EXT2
- KERNEL @@@server@@@::@@@tftpbootdir@@@/suse101nfs
- APPEND dnbdroot=224.0.0.6:5001,ext2 vga=0x317 splash=silent initrd=@@@server@@@::@@@tftpbootdir@@@/initrd-101nfs apic dhcp noldsc vci=DXS debug=0 elevator=noop
- ipappend 1
-
-LABEL kursraum
- MENU LABEL 1. ^FLA Linux 2.6
- KERNEL @@@server@@@::@@@tftpbootdir@@@/10.1
- APPEND nfsroot=@@@server@@@:/nfsroot/10.1 vga=0x317 splash=silent initrd=initrd-10.1 apic dhcp
- ipappend 1
-
LABEL local
- MENU LABEL 3. ^Lokal booten
- MENU PASSWD lokal
+ MENU LABEL -1. ^Lokal booten
+# MENU PASSWD lokal
localboot 0
-
#####
LABEL
KERNEL @@@server@@@::@@@tftpbootdir@@@/menu.c32
diff --git a/installer/distro-specs/config-debian b/installer/distro-specs/config-debian
new file mode 100644
index 00000000..20a376bd
--- /dev/null
+++ b/installer/distro-specs/config-debian
@@ -0,0 +1,6 @@
+dhcpd_conf="/etc/dhcp3/dhcpd.conf"
+atftpd_conf="/etc/default/atftpd"
+exports_conf="/etc/exports"
+
+# this variable choses which atftpd template file to chose
+atftpd_conf_name="atftpd_default"
diff --git a/installer/distro-specs/config-suse b/installer/distro-specs/config-suse
new file mode 100644
index 00000000..169ad716
--- /dev/null
+++ b/installer/distro-specs/config-suse
@@ -0,0 +1,6 @@
+dhcpd_conf="/etc/dhcp3/dhcpd.conf"
+atftpd_conf="/etc/default/atftpd"
+exports_conf="/etc/exports"
+
+# this variable choses which atftpd template file to chose
+atftpd_conf_name="atftpd_sysconfig"
diff --git a/installer/distro-specs/config-ubuntu b/installer/distro-specs/config-ubuntu
index 9dba0de9..20a376bd 100644
--- a/installer/distro-specs/config-ubuntu
+++ b/installer/distro-specs/config-ubuntu
@@ -2,4 +2,5 @@ dhcpd_conf="/etc/dhcp3/dhcpd.conf"
atftpd_conf="/etc/default/atftpd"
exports_conf="/etc/exports"
+# this variable choses which atftpd template file to chose
atftpd_conf_name="atftpd_default"
diff --git a/installer/distro-specs/exclude-suse-10.0 b/installer/distro-specs/exclude-suse-10.0
index e26e17f8..7e49a641 100644
--- a/installer/distro-specs/exclude-suse-10.0
+++ b/installer/distro-specs/exclude-suse-10.0
@@ -8,8 +8,10 @@
+ /media
+ /mnt
+ /opt
++ /proc
+ /root
+ /sbin
++ /sys
+ /tmp
+ /usr
+ /var
@@ -25,6 +27,8 @@
- /boot/grub
- /dev/*
- /etc/shadow*
+- /proc/*
+- /sys/*
- /tmp/*
- /root/*
- /home/*
diff --git a/installer/distro-specs/exclude-suse-10.1 b/installer/distro-specs/exclude-suse-10.1
index e26e17f8..7e49a641 100644
--- a/installer/distro-specs/exclude-suse-10.1
+++ b/installer/distro-specs/exclude-suse-10.1
@@ -8,8 +8,10 @@
+ /media
+ /mnt
+ /opt
++ /proc
+ /root
+ /sbin
++ /sys
+ /tmp
+ /usr
+ /var
@@ -25,6 +27,8 @@
- /boot/grub
- /dev/*
- /etc/shadow*
+- /proc/*
+- /sys/*
- /tmp/*
- /root/*
- /home/*
diff --git a/installer/distro-specs/exclude-ubuntu b/installer/distro-specs/exclude-ubuntu-5.10
index 1e6fb910..1e6fb910 100644
--- a/installer/distro-specs/exclude-ubuntu
+++ b/installer/distro-specs/exclude-ubuntu-5.10
diff --git a/installer/ld4-inst b/installer/ld4-inst
index 0240409b..c840d1d0 100755
--- a/installer/ld4-inst
+++ b/installer/ld4-inst
@@ -204,13 +204,59 @@ configure() {
copy_system() {
echo -e "\n\nSyncing system now\nPlease enter root password of client machine\n"
- rsync -avDe ssh --delete --exclude-from=distro-specs/exclude-${client_distro} ${rsyncsource} ${rootdir} || { echo "Rsync failed" ; exit 1 ; }
+ rsync -avDe ssh --delete --exclude-from=distro-specs/exclude-${client_distro}-${client_distro_ver} ${rsyncsource} ${rootdir} || { echo "Rsync failed" ; exit 1 ; }
# generate error message in case rsync didn't work and exit.
# TODO: mksquashfs (background process)
}
+create_initrd() {
+ # find existing kernels
+ declare -i i=0
+ for kern in `find ${rootdir}/boot |grep vmlinuz` ; do
+ if ! [ -L $kern ] ; then
+ kernel[$i]=$kern
+ i=$i+1
+ fi
+ done
+
+ if [ $i -eq 0 ] ; then
+ echo "No kernels found in ${rootdir}/boot, so no initial ramdisk is created and linked to ${tftpbootdir}."
+ kernel_choice=""
+ elif [ $i -eq 1 ] ; then
+ echo "Found one kernel in ${rootdir}/boot."
+ kernel_choice="0"
+ else
+ echo -e "This is a list of existing kernels in your client OS: \n"
+ declare -i j=0
+ while [ $j -lt $i ] do
+ echo "$j: ${kernel[$j]}"
+ j=$j+1
+ done
+ ask "Please chose kernels to create initial ramdisks for (space separated numbers) " kernel_choice ${kernel_choice}
+ fi
+ choice=( ${kernel_choice} )
+
+ # make sure /$tftbootdir exists
+ mkdir -p ${tftpbootdir}
+
+ declare -i j=0
+ # FIXME: mkdxsinitrd currently wants to run from own directory
+ # ugly workaround...
+ cd ../initrd
+ while [ $j -lt ${#choice[@]} ] do
+ current_kernel=${kernel[$j]#${rootdir}/boot/vmlinuz-}
+ echo "Creating initial ramdisk for ${current_kernel}"
+ current_initrd=${tftpbootdir}/initrd-dxs-${current_kernel}
+ [ -f ${current_initrd} ] && rm ${current_initrd}
+ ./mkdxsinitrd -r ${rootdir} -k ${current_kernel} -i ${current_initrd}
+
+ ln -sf ${kernel[$j]} ${tftpbootdir}/vmlinuz-${current_kernel}
+ j=$j+1
+ done
+ cd -
+}
# setting up server site configuration files etc.
setup_server () {
@@ -229,7 +275,7 @@ setup_server () {
# TODO: sed -e @@@example1@@@, netname+1 etc. - which ip addresses are safe to use?
# atftpd
- sed -e "s,/tftpboot,${tftpbootdir}," default_files/${atftpd_conf_name} > ${dxs_conf}/${dxs_atftpd_conf}-${timestamp}
+ sed -e "s,@@@tftpbootdir@@@,${tftpbootdir}," default_files/${atftpd_conf_name} > ${dxs_conf}/${dxs_atftpd_conf}-${timestamp}
# nfs
echo -e "# Bla Blub\n \
@@ -242,13 +288,31 @@ setup_server () {
sed -e "s,@@@server@@@,${server},g;s,@@@tftpbootdir@@@,${tftpbootdir},g;s,@@@pxe_passwd@@@,${pxe_passwd},g;s,@@@client_distro@@@,${client_distro},g;s,@@@client_distro_ver@@@,${client_distro_ver},g;s,@@@rootdir@@@,${rootdir},g" default_files/default > ${dxs_conf}/${dxs_pxedefault_conf}-${timestamp}
- # TODO: loop over kernel and initial ramdisks and create corresponding entries in default
+ declare -i j=0
+ while [ $j -lt ${#choice[@]} ] do
+ current_kernel=${kernel[$j]#${rootdir}/boot/vmlinuz-}
+ current_initrd=${tftpbootdir}/initrd-dxs-${current_kernel}
+ if [ $j -eq 0 ] ; then
+ default_string="MENU DEFAULT\n"
+ else
+ default_string=""
+ fi
+ echo -e "LABEL ${client_distro}-${current_kernel}\n \
+ ${default_string} \
+ MENU LABEL $j. ${client_distro}-${client_distro_ver} ${current_kernel} Diskless\n \
+ KERNEL ${server}::${tftpbootdir}/vmlinuz-${current_kernel}\n \
+ APPEND nfsroot=${server}:${rootdir} initrd=${server}::${tftpbootdir}/initrd-dxs-${current_kernel} apic dhcp noldsc vci=DXS\n \
+ ipappend 1\n\n" >> ${dxs_conf}/${dxs_pxedefault_conf}-${timestamp}
+
+ j=$j+1
+ done
+
# backing up original files
for cfile in ${dhcpd_conf} ${atftpd_conf} ${exports_conf} ${tftpbootdir}/${pxedefault_conf} ; do
if [ -f ${cfile} -a ! -L ${cfile} ] ; then
- echo "Copying old ${cfile} to ${cfile}"
+ echo "Copying old ${cfile} to ${cfile}.original"
mv ${cfile} ${cfile}.original
elif [ -L ${cfile} ] ; then
unlink ${cfile}
@@ -264,33 +328,6 @@ setup_server () {
}
-create_initrd() {
- # FIXME: mkdxsinitrd currently wants to run from own directory
- # ugly workaround...
- cd ../initrd
-
- # TODO: loop over chosen kernels -> mkdxsinitrd -k ... and -i ...
-
- ./mkdxsinitrd -r ${rootdir}
- cd -
-
- # generate links to kernels and initial ramdisks
-
- # TODO: move this stuff in upper loop
- if [ -e ${rootdir}/boot/vmlinuz ] ; then
- ln -sf ${rootdir}/boot/vmlinuz ${tftpbootdir}
- elif [ -e ${rootdir}/vmlinuz ] ; then
- ln -sf ${rootdir}/boot/vmlinuz ${tftpbootdir}
- elif [ -n "`ls ${rootdir}/boot/vmlinuz*`" ]; then
- ln -sf `ls -1t ${rootdir}/boot/vmlinuz* | sed -n 1,1p` ${tftpbootdir}/vmlinuz
- else echo "Could not find the Kernel. Please link the kernel to ${tftpbootdir}"
- fi
- # make sure /$tftbootdir exists
- mkdir -p ${tftpbootdir}
- ln -sf ${rootdir}/tmp/dxsinitrd.gz ${tftpbootdir}/initrd
-
-}
-
footer() {
echo -e "\nPlease assure to restart atftpd, nfs-kernel-server and dhcpd!\n"
@@ -321,7 +358,7 @@ dxs_pxedefault_conf="pxelinux/default"
header
precheck #(run as root, rsync etc.)
configure
-#copy_system
+copy_system
create_initrd
setup_server
footer