summaryrefslogtreecommitdiffstats
path: root/remote/rootfs
diff options
context:
space:
mode:
authorMichael Neves2013-05-23 17:01:04 +0200
committerMichael Neves2013-05-23 17:01:04 +0200
commit655b2494fc7d8fec3a5f6212bbb7a88cbe5c13f7 (patch)
tree26e62638af3ae641fe0e561ba3ee19bdbb71e484 /remote/rootfs
parent[SUSE] vmchooser xml now found in correct dir (diff)
parentfix PATH for debug shell (diff)
downloadtm-scripts-655b2494fc7d8fec3a5f6212bbb7a88cbe5c13f7.tar.gz
tm-scripts-655b2494fc7d8fec3a5f6212bbb7a88cbe5c13f7.tar.xz
tm-scripts-655b2494fc7d8fec3a5f6212bbb7a88cbe5c13f7.zip
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
Diffstat (limited to 'remote/rootfs')
-rw-r--r--remote/rootfs/rootfs-stage32/data/etc/issue12
-rw-r--r--remote/rootfs/rootfs-stage32/data/etc/systemd/system/mount-tmp.service7
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/bin/analyse-disk105
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/bin/disk-tmp24
-rw-r--r--remote/rootfs/rootfs-stage32/rootfs-stage32.build2
-rw-r--r--remote/rootfs/rootfs-stage32/rootfs-stage32.conf2
-rw-r--r--remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper4
7 files changed, 146 insertions, 10 deletions
diff --git a/remote/rootfs/rootfs-stage32/data/etc/issue b/remote/rootfs/rootfs-stage32/data/etc/issue
index de0a2265..11c0452c 100644
--- a/remote/rootfs/rootfs-stage32/data/etc/issue
+++ b/remote/rootfs/rootfs-stage32/data/etc/issue
@@ -1,11 +1,11 @@
WELCOME TO \n (\l)
- _____ ______ ______ __ __ _______ __ __ __
- / _ | _ | ___| | | | | ____| | | | | |
- | | | | |_| | |_ | | | | |___ | | / /
- | | | | ___/| _| | | ____ | | | |
- | |_| | | | |___| | | | ____| | |___ / /
- _____/|__| |______|__| |__| |_______|______|__| |__|
+ _____ ______ ______ __ __ ______ __ __ __ __ __ ______
+ / _ | _ | ___| | | || ___| | | | | | | | | | ____
+| | | | |_| | |_ | | || |__ | | / / __ | | | |
+| | | | ___/| _| | | ___ | | | | |__| | | | ___
+| |_| | | | |___| | | | ___| | |___ / / | | | | |__ |
+ _____/|__| |______|__| |__||______|______|__| |__| |__| |__| _____/
(c) <OpenSLX.ORG>
diff --git a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/mount-tmp.service b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/mount-tmp.service
new file mode 100644
index 00000000..75e285e2
--- /dev/null
+++ b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/mount-tmp.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Mount hard drive as tmp
+
+[Service]
+Type=oneshot
+ExecStart=/opt/openslx/bin/analyse-disk
+ExecStart=/opt/openslx/bin/disk-tmp
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/analyse-disk b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/analyse-disk
new file mode 100755
index 00000000..27c3f306
--- /dev/null
+++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/analyse-disk
@@ -0,0 +1,105 @@
+#!/bin/bash
+# Copyright (c) 2013 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found under http://openslx.org
+#
+# Local hard disk autodetection script for OpenSLX linux stateless clients,
+# detecting swap and special partitions
+
+#############################################################################
+
+# General formatter for the /tmp partition on a local harddisk
+diskfm () {
+local target=$1
+local fs
+local path
+for fs in xfs ext3 ext2 ; do
+ unset available
+ case $(cat /proc/filesystems) in
+ *${fs}*) available=yes;;
+ *) modprobe -q ${fs} 2>/dev/null && available=yes;;
+ esac
+ if [ -n ${available} ]; then
+ unset found
+ for path in /sbin /bin /usr/sbin /usr/bin /openslx/sbin /openslx/bin; do
+ if test -x /$path/mkfs.$fs ; then
+ found=yes
+ case mkfs.$fs in
+ mkfs.xfs)
+ fopt="-f"
+ mopt="-o noexec"
+ ;;
+ mkfs.ext2)
+ fopt="-Fq"
+ mopt="-o nocheck,noexec"
+ ;;
+ mkfs.reiserfs)
+ fopt="-f"
+ mopt="-o noexec"
+ ;;
+ esac
+ mkfs.$fs ${fopt} ${target} >/dev/null 2>&1 #|| error
+ mkdir -p /run/mount/tmp
+ mount -t ${fs} ${target} /run/mount/tmp
+ fi
+ done
+ [ -n "$found" ] && break
+ fi
+done
+}
+
+# Check for local harddisks and appropriate partitions
+fdisk -l |sed -n "/^\/dev\//p" >/etc/disk.partition
+
+# Check for standard swap partitions and make them available to the system
+for hdpartnr in $(cat /etc/disk.partition | \
+ sed -n -e "/ 82 /p"|sed -e "s/[[:space:]].*//") ; do
+ echo -e "$hdpartnr\tswap\t\tswap\t\tdefaults\t 0 0" >>/etc/fstab
+done
+
+# We use special non assigned partition type (id44) for harddisk scratch
+# space, thus no normal filesystem will be incidentally deleted or
+# corrupted
+for hdpartnr in $(cat /etc/disk.partition | \
+ sed -n -e "/ 44 /p"|sed -e "s/[[:space:]].*//") ; do
+ # check for supported filesystem and formatter
+ ( if diskfm $hdpartnr ; then
+ # echo "$hdpartnr is mounted to /mnt/tmp at $(sysup)" >/tmp/tmpready
+ echo -e "$hdpartnr\t/tmp\t\tnoauto\t\tdefaults\t 0 0" >>/etc/fstab
+ else
+ echo "formatting failed for some reason " >/tmp/tmpready
+ fi ) &
+ break
+done
+
+# Put detected linux partitions (83) into /etc/fstab with "noauto", special
+# partition 45 (persistent scratch) to /var/scratch and 46 to /var/openslx
+for partid in 83 45 46 ; do
+ for hdpartnr in $(cat /etc/disk.partition | \
+ sed -n -e "/ ${partid} /p"|sed -e "s/[[:space:]].*//") ; do
+ mkdir -p /media/${hdpartnr#/dev/*} 2>/dev/null
+ if [ ${partid} -eq 83 ] ; then
+ echo -e "$hdpartnr\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto,\
+noexec\t 0 0" >>/tmp/fstab
+ elif [ ${partid} -eq 45 ] ; then
+ #mount -t auto ${hdpartnr} /media/${hdpartnr#/dev/*}
+ #ln -sf /media/${hdpartnr#/dev/*} /var/scratch
+ echo -e "${hdpartnr}\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto\
+\t\t 0 0" >>/tmp/fstab
+ elif [ ${partid} -eq 46 ] ; then
+ # Mount a home directory to (/mnt)/var/home
+ #mount -t auto ${hdpartnr} /mnt/media/${hdpartnr#/dev/*} \n\
+ #test -d /mnt/media/${hdpartnr#/dev/*}/home && \
+ # ln -sf /media/${hdpartnr#/dev/*} /var/home
+ echo -e "${hdpartnr}\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto\
+\t\t 0 0" >>/tmp/fstab
+ fi
+ done
+done
+
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/disk-tmp b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/disk-tmp
new file mode 100755
index 00000000..4378c45c
--- /dev/null
+++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/disk-tmp
@@ -0,0 +1,24 @@
+#!/bin/sh
+# Copyright (c) 2013 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found under http://openslx.org
+#
+# Mount local ID44 partition to /tmp after all existing stuff is preserved
+
+#############################################################################
+
+# Check if ID44 is available by analysing /etc/fstab for appropriate entry
+if cat /proc/mounts | grep -qe "/dev/.*/tmp" ; then
+ mkdir -p /run/tmp
+ mv /tmp/* /run/tmp
+ mount --bind /run/mount/tmp /tmp
+ umount /run/mount/tmp
+ mv /run/tmp/* /tmp
+ rmdir /run/tmp
+fi
diff --git a/remote/rootfs/rootfs-stage32/rootfs-stage32.build b/remote/rootfs/rootfs-stage32/rootfs-stage32.build
index 0ca8d64c..713c0a3d 100644
--- a/remote/rootfs/rootfs-stage32/rootfs-stage32.build
+++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.build
@@ -4,7 +4,7 @@ fetch_source() {
}
build() {
- if [ ! -z "$REQUIRED_PACKAGES" ]; then
+ if [ ! -z "$REQUIRED_CONTENT_PACKAGES" ]; then
COPYLIST="list_dpkg_output"
[ -e "${COPYLIST}" ] && rm "${COPYLIST}"
list_packet_files >> "${COPYLIST}"
diff --git a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf
index a8bbf386..f5452f53 100644
--- a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf
+++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf
@@ -1,5 +1,5 @@
REQUIRED_MODULES=" kernel"
-REQUIRED_DEPENDENCIES="nfs-common aufs-tools squashfs-tools whois xfsprogs"
+REQUIRED_INSTALLED_PACKAGES="nfs-common aufs-tools squashfs-tools whois xfsprogs"
REQUIRED_BINARIES=" bash
more
less
diff --git a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper
index 1e2ba9c8..3f7f446e 100644
--- a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper
+++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper
@@ -1,7 +1,7 @@
pinfo "If aufs install fails, run zypper addrepo http://jftp.inai.de/openSUSE_12.3/ j.eng-i586"
REQUIRED_MODULES=" kernel"
-REQUIRED_DEPENDENCIES="nfs-client aufs squashfs"
-REQUIRED_PACKAGES="timezone"
+REQUIRED_INSTALLED_PACKAGES="nfs-client aufs squashfs"
+REQUIRED_CONTENT_PACKAGES="timezone"
REQUIRED_BINARIES=" bash
agetty
cat