summaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorDirk2013-03-19 18:02:11 +0100
committerDirk2013-03-19 18:02:11 +0100
commit6c096421db0a398960b44ec6d3dc1c3a2c081c46 (patch)
tree32ebbc5418f05c411158f614008c85ddf19c637c /data
parentrenamed targets stage3.* to stage3* (diff)
downloadtm-scripts-6c096421db0a398960b44ec6d3dc1c3a2c081c46.tar.gz
tm-scripts-6c096421db0a398960b44ec6d3dc1c3a2c081c46.tar.xz
tm-scripts-6c096421db0a398960b44ec6d3dc1c3a2c081c46.zip
Should be added to systemd ...
Diffstat (limited to 'data')
-rw-r--r--data/analyse-disk.sh46
1 files changed, 16 insertions, 30 deletions
diff --git a/data/analyse-disk.sh b/data/analyse-disk.sh
index 0c152dbf..ac63956e 100644
--- a/data/analyse-disk.sh
+++ b/data/analyse-disk.sh
@@ -9,30 +9,26 @@
#
# General information about OpenSLX can be found under http://openslx.org
#
-# Local hard disk autoconfiguration script for OpenSLX linux stateless
-# clients, detecting swap and special partitions
+# Local hard disk autodetection script for OpenSLX linux stateless clients,
+# detecting swap and special partitions
#############################################################################
-# Todo:
-# * This script should be run just once per boot!
-# * The activation of swap could/should be handled in separate script!?
-# * The mounting of /tmp could/should be done separately?
-# * Same for other partitions, use information of /etc/fstab for that?
-# * Should we just install xfs in the source system and boil down everything
-# onto that?
-
# General formatter for the /tmp partition on a local harddisk
diskfm () {
local target=$1
-local mntpnt=$2
local fs
local path
-for fs in xfs reiserfs ext2 ; do
- if strinfile "$fs" /proc/filesystems || modprobe ${MODPRV} $fs ; then
- unset $found
+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 ; do
- if test -x /mnt/$path/mkfs.$fs ; then
+ if test -x /$path/mkfs.$fs ; then
found=yes
case mkfs.$fs in
mkfs.xfs)
@@ -48,19 +44,9 @@ for fs in xfs reiserfs ext2 ; do
mopt="-o noexec"
;;
esac
- mkfs.$fs $fopt $target >/dev/null 2>&1 #|| error
- if [ -z $mntpnt ] ; then
- umount /tmp 2>/dev/null
- if mount -t $fs -n $mopt $target /tmp 2>/dev/null; then
- return 0
- else
- mount -n -t tmpfs none /tmp
- fi
- else
- mkdir -p $mntpnt
- mount -t $fs -n -o loop $target $mntpnt 2>/dev/null
- return 0
- fi
+ mkfs.$fs ${fopt} ${target} >/dev/null 2>&1 #|| error
+ mkdir -p /var/mnt/tmp
+ mount -t ${fs} ${target} /var/mnt/tmp
fi
done
[ -z $found ] && continue
@@ -70,7 +56,7 @@ done
}
# Check for local harddisks and appropriate partitions
-fdisk -l /dev/$hd|sed -n "/^\/dev\//p" >/etc/disk.partition
+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 | \
@@ -85,7 +71,7 @@ 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 "$hdpartnr is mounted to /mnt/tmp at $(sysup)" >/tmp/tmpready
echo -e "$hdpartnr\t/tmp\t\tauto\t\tdefaults\t 0 0" >>/etc/fstab
else
echo "formatting failed for some reason ($(sysup))" >/tmp/tmpready