summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2015-04-07 17:43:23 +0200
committerJonathan Bauer2015-04-07 17:43:23 +0200
commitb1074927e6848d7370c6d4a1b11b7149d6660a77 (patch)
tree89dfef802d48522d297632cb77fe13825707ff3e
parent[pam-common-share] rudimentary nfs-support for common share (diff)
parent[hdd-boot] michi's werk (diff)
downloadtm-scripts-mergetest.tar.gz
tm-scripts-mergetest.tar.xz
tm-scripts-mergetest.zip
Merge remote-tracking branch 'remotes/origin/test' into mergetestmergetest
-rw-r--r--data/kernel.wanted.config1
-rw-r--r--doc/boot_config_vars30
-rw-r--r--doc/kcl_config_vars2
-rw-r--r--remote/modules/busybox/openslx-busybox-config2
-rw-r--r--remote/modules/dnbd3/data/etc/systemd/system/setup-dnbd3.service3
-rw-r--r--remote/modules/dnbd3/module.build5
-rw-r--r--remote/modules/dnbd3/module.conf1
-rw-r--r--remote/modules/grub/module.build18
-rw-r--r--remote/modules/grub/module.conf9
-rw-r--r--remote/modules/grub/module.conf.ubuntu7
-rwxr-xr-xremote/modules/systemd/data/opt/openslx/scripts/systemd-shutdown_prescript13
-rw-r--r--remote/rootfs/rootfs-stage31/data/inc/functions16
-rw-r--r--remote/rootfs/rootfs-stage31/data/inc/parse_kcl4
-rwxr-xr-xremote/rootfs/rootfs-stage31/data/init13
-rw-r--r--remote/rootfs/rootfs-stage32/data/etc/systemd/system/mount-stage4.service4
-rw-r--r--remote/rootfs/rootfs-stage32/data/etc/systemd/system/setup-partitions.service1
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_stage42
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions185
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons21
-rw-r--r--remote/rootfs/rootfs-stage32/module.conf11
l---------remote/targets/stage32-curitiba/grub1
l---------server/configs/curitiba/cups-curitiba1
l---------server/configs/curitiba/dnbd3-cache1
l---------server/configs/curitiba/hdd-boot1
l---------server/configs/curitiba/local_accounts1
l---------server/configs/curitiba/pam-curitiba1
l---------server/configs/curitiba/partitioner1
l---------server/configs/curitiba/ubuntu-13.04-pulseaudio-fix1
l---------server/configs/curitiba/ubuntu-13.10-unity-fix1
l---------server/configs/curitiba/ubuntu-14.04-unity-panel-service-fix1
-rw-r--r--server/modules/dnbd3-cache/etc/systemd/system/setup-dnbd3_cache.service12
l---------server/modules/dnbd3-cache/etc/systemd/system/sysinit.target.wants/setup-dnbd3_cache.service1
-rw-r--r--server/modules/dnbd3-cache/opt/openslx/dnbd3-cache/alt-servers1
-rw-r--r--server/modules/dnbd3-cache/opt/openslx/dnbd3-cache/server.conf9
-rwxr-xr-xserver/modules/dnbd3-cache/opt/openslx/scripts/systemd-setup_dnbd3_cache8
-rw-r--r--server/modules/hdd-boot/etc/systemd/system/hdd_boot.service11
l---------server/modules/hdd-boot/etc/systemd/system/multi-user.target.wants/hdd_boot.service1
-rw-r--r--server/modules/hdd-boot/opt/openslx/hdd-boot/grub.cfg146
-rwxr-xr-xserver/modules/hdd-boot/opt/openslx/scripts/systemd-hdd_boot116
-rw-r--r--server/modules/local_accounts/etc/cron.d/openslx-local_accounts6
-rw-r--r--server/modules/local_accounts/etc/login.defs335
-rw-r--r--server/modules/local_accounts/etc/systemd/system/local_accounts.service9
l---------server/modules/local_accounts/etc/systemd/system/multi-user.target.wants/local_accounts.service1
-rwxr-xr-xserver/modules/local_accounts/opt/openslx/scripts/local_accounts-cron_script9
-rwxr-xr-xserver/modules/local_accounts/opt/openslx/scripts/systemd-local_accounts66
l---------server/modules/partitioner/etc/systemd/system/multi-user.target.wants/partitioner.service1
-rw-r--r--server/modules/partitioner/etc/systemd/system/partitioner.service20
-rwxr-xr-xserver/modules/partitioner/opt/openslx/scripts/systemd-partitioner497
-rw-r--r--vim.log282
49 files changed, 1814 insertions, 75 deletions
diff --git a/data/kernel.wanted.config b/data/kernel.wanted.config
index 62dc3b37..dba15d7f 100644
--- a/data/kernel.wanted.config
+++ b/data/kernel.wanted.config
@@ -4,6 +4,7 @@ CONFIG_8139TOO=y
CONFIG_8139TOO_8129=y
CONFIG_8139TOO_PIO=y
CONFIG_8139TOO_TUNE_TWISTER=y
+CONFIG_SATA_AHCI=y
CONFIG_ACENIC=y
CONFIG_AGP_SIS=y
CONFIG_AGP_VIA=y
diff --git a/doc/boot_config_vars b/doc/boot_config_vars
index 7890ecc2..1ea182d4 100644
--- a/doc/boot_config_vars
+++ b/doc/boot_config_vars
@@ -64,3 +64,33 @@ SLX_SHARE_n_AUTH_PASS Only required if SLX_SHARE_n_AUTH_TYPE is 'user'. Defin
password to use for authenticating the mount of the share.
SLX_SHARE_n_PERM Permissions for the share. Supports 'rw' and 'ro'. Defaults to 'ro'.
+
+partitioner & setup partitions:
+SLX_PARTITION_TYPE='GPT|msdos' #Choose partition table type, if variable is not set partitioner
+ #will ask user or in silent mode use 'msdos' as default
+
+SLX_CHOOSEN_DISK='sda' #If no HDD is specified, the partitioner will either ask the user
+ #or in silent mode choose the only HDD available or abort if more
+ #then one HDD is present.
+
+SLX_AUTOMATIC_PARTITIONING='yes' #silent mode, restarts the machine automatically after partitioning
+
+SLX_PARTITION_TABLE=' #The partition table variable is used by both the partitioner and
+ 44,1G,/tmp #setup-partition script. The values per partition are as follows:
+ 43,1G,/boot,bootable #unique ID, size, [mountpoint], [options]
+ 42,1G,/cache/export/dnbd3 #The ID is used as is for msdos and for GPT concatenated with trailing
+ 41,1G,/home #zeros, example: msdos: 44 GPT: 44000000-0000-0000-0000-000000000000
+ 82,1G' #Attention: without a mount point, the setup-partition script won't mount
+ #the partition. Swap partition doesn't need a mount point
+ #Existing linux partitions will automatically be mountet under /media
+ #and don't need to be specified here.
+ #The only optional argument currently used at the moment is 'bootable'
+ #to mark a partition as such
+
+#If no partition table variable was specifies, the partitioner and setup-scripts will assume
+#the following default partition table:
+
+SLX_PARTITION_TABLE='
+ 44,10G,/tmp
+ 45,10G,/var/scratch
+ 82,4G'
diff --git a/doc/kcl_config_vars b/doc/kcl_config_vars
index 66166299..4c51d5dc 100644
--- a/doc/kcl_config_vars
+++ b/doc/kcl_config_vars
@@ -26,3 +26,5 @@ LABEL u1304x64
APPEND slxsrv=10.254.221.6 slxbase=u1304x64 vga=current splash quiet
IPAPPEND 3
+To start the partitioner, the partitioner module must be included in the configuration
+and 'partitioner' must be specifies in the KCL
diff --git a/remote/modules/busybox/openslx-busybox-config b/remote/modules/busybox/openslx-busybox-config
index 29bb29ae..0f884d2b 100644
--- a/remote/modules/busybox/openslx-busybox-config
+++ b/remote/modules/busybox/openslx-busybox-config
@@ -365,7 +365,7 @@ CONFIG_WHICH=y
# Editors
#
CONFIG_AWK=y
-# CONFIG_FEATURE_AWK_LIBM is not set
+CONFIG_FEATURE_AWK_LIBM=y
CONFIG_FEATURE_AWK_GNU_EXTENSIONS=y
# CONFIG_CMP is not set
CONFIG_DIFF=y
diff --git a/remote/modules/dnbd3/data/etc/systemd/system/setup-dnbd3.service b/remote/modules/dnbd3/data/etc/systemd/system/setup-dnbd3.service
index 516cbfa2..7d34480d 100644
--- a/remote/modules/dnbd3/data/etc/systemd/system/setup-dnbd3.service
+++ b/remote/modules/dnbd3/data/etc/systemd/system/setup-dnbd3.service
@@ -1,6 +1,5 @@
[Unit]
Description=Setup dnbd3 kernel module and user space daemon
-After=sysinit.target
Before=shutdown.target
DefaultDependencies=no
@@ -9,3 +8,5 @@ ExecStart=/opt/openslx/scripts/systemd-setup_dnbd3
ExecStop=/opt/openslx/bin/dnbd3-client --kill
ExecStopPost=/opt/openslx/bin/rm /var/run/dnbd3.socket
Restart=on-abort
+
+
diff --git a/remote/modules/dnbd3/module.build b/remote/modules/dnbd3/module.build
index cdbd8251..fd56b4f7 100644
--- a/remote/modules/dnbd3/module.build
+++ b/remote/modules/dnbd3/module.build
@@ -27,13 +27,16 @@ build() {
cd "$MODULE_DIR/src/kmod" || perror "Could not CD to standalone dnbd3 kmod dir"
make MODULE_NAME=dnbd3 KDIR="$KERNEL_HEADERS_DIR" || perror "Could not compile kernel module"
mkdir -p "$MODULE_BUILD_DIR/lib/modules/dnbd3" || perror "Could not create lib/modules/dnbd3"
- mkdir -p "$MODULE_BUILD_DIR/opt/openslx/bin" || perror "Coould not create opt/openslx/bin"
+ mkdir -p "$MODULE_BUILD_DIR/opt/openslx/bin" || perror "Could not create opt/openslx/bin"
cp "$MODULE_DIR/src/kmod/dnbd3.ko" "$MODULE_BUILD_DIR/lib/modules/dnbd3/" || perror "could not cp dnbd3.ko"
cd "$MODULE_BUILD_DIR/opt/openslx/bin" || perror "Could not cd to build dir for client binary"
cmake "$MODULE_DIR/src/dnbd3" || perror "Could not cmake"
make dnbd3-client || perror "Could not make dnbd3-client"
chown root:root "dnbd3-client"
chmod +xs "dnbd3-client"
+ make dnbd3-server || perror "Could not make dnbd3-server"
+ chown root:root "dnbd3-server"
+ chmod +xs "dnbd3-server"
cd "$MODULE_DIR"
}
diff --git a/remote/modules/dnbd3/module.conf b/remote/modules/dnbd3/module.conf
index 631b0e23..f917b1b4 100644
--- a/remote/modules/dnbd3/module.conf
+++ b/remote/modules/dnbd3/module.conf
@@ -5,6 +5,7 @@ REQUIRED_GIT="git://git.openslx.org/dnbd3.git"
REQUIRED_COMMIT="bc4ee543ce5beec823ae0cbd811bb7febe43103f"
REQUIRED_BINARIES="
dnbd3-client
+ dnbd3-server
"
REQUIRED_DIRECTORIES="
/lib/modules
diff --git a/remote/modules/grub/module.build b/remote/modules/grub/module.build
new file mode 100644
index 00000000..119ea7bf
--- /dev/null
+++ b/remote/modules/grub/module.build
@@ -0,0 +1,18 @@
+fetch_source() {
+ :
+}
+
+build() {
+ COPYLIST="list_dpkg_output"
+ [ -e "$COPYLIST" ] && rm "$COPYLIST"
+
+ list_packet_files >> "$COPYLIST"
+ tarcopy "$(cat "$COPYLIST" | sort -u)" "${MODULE_BUILD_DIR}"
+
+ return 0
+}
+
+post_copy() {
+ :
+}
+
diff --git a/remote/modules/grub/module.conf b/remote/modules/grub/module.conf
new file mode 100644
index 00000000..61c3deac
--- /dev/null
+++ b/remote/modules/grub/module.conf
@@ -0,0 +1,9 @@
+REQUIRED_BINARIES="
+ grub-install
+ grub-mkconfig
+ grub-probe
+ grub-bios-setup
+"
+REQUIRED_DIRECTORIES="
+ /usr/lib/grub/
+"
diff --git a/remote/modules/grub/module.conf.ubuntu b/remote/modules/grub/module.conf.ubuntu
new file mode 100644
index 00000000..bca61a90
--- /dev/null
+++ b/remote/modules/grub/module.conf.ubuntu
@@ -0,0 +1,7 @@
+REQUIRED_CONTENT_PACKAGES="
+ grub2-common
+ grub-common
+ grub-gfxpayload-lists
+ grub-pc
+ grub-pc-bin
+"
diff --git a/remote/modules/systemd/data/opt/openslx/scripts/systemd-shutdown_prescript b/remote/modules/systemd/data/opt/openslx/scripts/systemd-shutdown_prescript
index 3b5d7f92..e3a45ecf 100755
--- a/remote/modules/systemd/data/opt/openslx/scripts/systemd-shutdown_prescript
+++ b/remote/modules/systemd/data/opt/openslx/scripts/systemd-shutdown_prescript
@@ -38,6 +38,14 @@ umount_samba_shares() {
done
}
+backup_users(){
+ # create patch files to backup the users created by the openslx, so we can restore then in the next session.
+ for file in passwd shadow group; do
+ diff -u /home/openslx/.$file.backup /etc/$file > /home/openslx/.$file.patch
+ done
+ echo "Patch of /etc/{passwd,shadow,group} generated at /home/openslx/.{passwd,shadow,group}.patch"
+}
+
# Searching for nfs-shares in mtab:
if [ $(echo /etc/mtab | cut -d " " -f 3 | grep -q nfs) ]; then
umount_nfs_shares
@@ -47,4 +55,9 @@ fi
if [ $(echo /etc/mtab|cut -d " " -f 3 | grep -q cifs) ]; then
umount_samba_shares
fi
+
+if [ -d /home/openslx ]; then
+ backup_users
+fi
+
exit $ERRORLEVEL
diff --git a/remote/rootfs/rootfs-stage31/data/inc/functions b/remote/rootfs/rootfs-stage31/data/inc/functions
index 5cc56dd7..b5d8f31d 100644
--- a/remote/rootfs/rootfs-stage31/data/inc/functions
+++ b/remote/rootfs/rootfs-stage31/data/inc/functions
@@ -43,7 +43,22 @@ download() {
local FILE_URL="$1"
local TARGET_PATH="$2"
+
+#Files from HD
+if [ "$HDD" = "yes" ]; then
+
+ cp /boot/$FILE_URL $TARGET_PATH
+ RET=$?
+ if [ "x$RET" != "x0" -o ! -e "$TARGET_PATH" ]; then
+ echo "Error - Copying '$FILE_URL' from HD failed. Exit Code: $RET"
+ usleep 50000 # 50ms
+ else
+ echo "Successfully copied '$FILE_URL' from HD."
+ return 0
+ fi
+
+else # Normal Download from server
# Shuffle server list
local SERVERS=$(for SERVER in $SLX_CONFIG_SERVERS $SLX_KCL_SERVERS; do echo "$RANDOM $SERVER"; done | sort -u | sed -r 's/^[0-9]+ //')
@@ -65,6 +80,7 @@ download() {
done
# Max retries reached, no success :-(
return 1
+fi
}
# Add benchmark event to var, including uptime as prefix
diff --git a/remote/rootfs/rootfs-stage31/data/inc/parse_kcl b/remote/rootfs/rootfs-stage31/data/inc/parse_kcl
index 13f9c467..8c81f65d 100644
--- a/remote/rootfs/rootfs-stage31/data/inc/parse_kcl
+++ b/remote/rootfs/rootfs-stage31/data/inc/parse_kcl
@@ -43,6 +43,10 @@ for opts in ${KCL}; do
GFX=nvidia ;;
ati|amd)
GFX=amd ;;
+ hdd_boot=*)
+ HDD='yes'
+ HDD_BOOT=${opts#hdd_boot=} ;; # all stages got from hd
+
esac
done
diff --git a/remote/rootfs/rootfs-stage31/data/init b/remote/rootfs/rootfs-stage31/data/init
index 9daa6d58..d363db51 100755
--- a/remote/rootfs/rootfs-stage31/data/init
+++ b/remote/rootfs/rootfs-stage31/data/init
@@ -69,9 +69,18 @@ if [ $SPLASH -eq 0 ]; then
[ $DEBUG -ge 1 ] && echo "4 4 1 7" > /proc/sys/kernel/printk || echo "1 1 0 1" >/proc/sys/kernel/printk
fi
-[ $DEBUG -ge 4 ] && drop_shell "Requested Debug Shell: before network."
+case $HDD in
+yes)
+ mkdir /boot
+ busybox mount /dev/$HDD_BOOT /boot
+;;
+esac
-. "/inc/setup_network" || . "/inc/setup_network_retry" || drop_shell "Error setting up network"
+[ $DEBUG -ge 4 ] && drop_shell "Requested Debug Shell: before network."
+. "/inc/setup_network"
+if [ "$?" -ne 0 -a "x$HDD" = "x" ]; then
+ . "/inc/setup_network_retry" || drop_shell "Error setting up network"
+fi
bench_event "NETWORK" "Network up and running"
[ $DEBUG -ge 3 ] && drop_shell "Requested Debug Shell: after network/before configuring."
diff --git a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/mount-stage4.service b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/mount-stage4.service
index 7f8b54a8..0b453165 100644
--- a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/mount-stage4.service
+++ b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/mount-stage4.service
@@ -1,8 +1,8 @@
[Unit]
Description=Mount Openslx Stage 4
DefaultDependencies=no
-Wants=setup-dnbd3.service stage4.target
-After=setup-dnbd3.service
+Wants=setup-dnbd3.service setup-dnbd3_cache.service stage4.target
+After=setup-dnbd3.service setup-dnbd3_cache.service
Before=stage4.target
[Service]
diff --git a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/setup-partitions.service b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/setup-partitions.service
index 6bb3a986..67466fae 100644
--- a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/setup-partitions.service
+++ b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/setup-partitions.service
@@ -4,6 +4,7 @@ DefaultDependencies=no
Before=basic.target
After=systemd-udev-settle.service
Wants=tmp.target
+ConditionKernelCommandLine=!partitioner
[Service]
Type=oneshot
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_stage4 b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_stage4
index 201e7a26..277efa05 100755
--- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_stage4
+++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_stage4
@@ -63,6 +63,8 @@ else
exit 1
fi
+sleep 2
+
# dbus reload needed eg. for gnome etc. and perhaps other service files which stage4 needs:
systemctl reload dbus.service
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions
index f9640589..8fc7535c 100755
--- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions
+++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions
@@ -14,8 +14,8 @@
#############################################################################
-# Mount point for persistent scratch partition (type 45)
-PERSISTENT="/opt/openslx/persistent"
+# read global OpenSLX config
+. /opt/openslx/config || { echo "Could not source config!"; exit 23; }
# General formatter for the /tmp partition on a local harddisk
diskfm () {
@@ -57,7 +57,8 @@ diskfm () {
mopt="-o noexec"
;;
esac
- mkfs.$fs ${fopt} "${target}"
+ echo "formatting ${target} with $fs..."
+ mkfs.$fs ${fopt} "${target}" > /dev/null 2>&1
fi
[ -n "$found" ] && break
fi
@@ -73,7 +74,7 @@ mount_temp () {
mount $@ /tmp || return 1
chmod a+rwxt /tmp
# Move stuff from working directory, which is old /tmp, to new /tmp just mounted
- mv ./* ./.[!.]* ./..?* /tmp/ 2> /dev/null
+ mv ./* ./.[!.]* ./..?* /tmp/ > /dev/null 2>&1
local OLD=$(LANG=C ls -alh | grep -v -E ' \.\.?$' | grep -v '^total')
[ -n "$OLD" ] && echo -- "Leftovers:" && echo -- "$OLD"
cd "$PRE"
@@ -81,7 +82,7 @@ mount_temp () {
mount_temp_fallback () {
mkdir -p /tmptmp
- mv /tmp/* /tmp/.* /tmptmp/ 2> /dev/null
+ mv /tmp/* /tmp/.* /tmptmp/ > /dev/null 2>&1
mount $@ /tmp || return 1
chmod a+rwxt /tmp
mv /tmptmp/* /tmptmp/.* /tmp/
@@ -89,72 +90,142 @@ mount_temp_fallback () {
return 0
}
-fdisk -l | sed -n "/^\/dev\//p" > "/etc/disk.partition"
+mount_partition () {
+ local mountpoint="$1"
+ local partition="$2"
-echo "Partitions:"
-cat "/etc/disk.partition"
-
-# Check for standard swap partitions and make them available to the system
-HAVE_SWAP=no
-for hdpartnr in $(sed -n -e "/ 82 /p" "/etc/disk.partition" | sed -e "s/[[:space:]].*//"); do
- echo -e "$hdpartnr\tswap\t\tswap\t\tdefaults\t 0 0" >> "/etc/fstab"
- swapon "$hdpartnr" -p 10 && HAVE_SWAP=yes # low priority, in case we have zram swap, prefer that)
-done
-
-# We use special non assigned partition type (id44) for harddisk scratch
-# space, thus no normal filesystem will be incidentally deleted or
-# corrupted
-HAVE_TEMP=no
-for hdpartnr in $(sed -n -e "/ 44 /p" "/etc/disk.partition" | 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
- mount_temp "$mopt" "$hdpartnr" || continue
- echo -e "${hdpartnr}\t/tmp\t\tauto\t\tnoexec\t 0 0" >> "/etc/fstab"
- HAVE_TEMP=yes
- break
+ mkdir -p "$mountpoint"
+ if ! blkid -s TYPE | grep "${partition}" ; then
+ echo "No fs found for ${partition}, formating..."
+ diskfm "$partition" "jfs xfs ext3" || return $?
+ mount -t auto -o noexec "$partition" "$mountpoint" || return $?
else
- echo "formatting failed for some reason"
- fi # Made this non-forking, systemd should handle it - 2013-05-28
-done
+ if ! mount -t auto -o noexec "$partition" "$mountpoint" ; then
+ echo "Mount of $partition on $mountpoint failed with code $?, trying fsck..."
+ fsck "$partition" || return $?
+ mount -t auto -o noexec "$partition" "$mountpoint" || return $?
+ fi
+ fi
+ echo "${partition}\t${mountpoint}\tauto\t\tnoauto,noexec\t\t 0 0" >> "/etc/fstab"
+}
-# Put detected linux partitions (83) into /etc/fstab with "noauto", special
-# partition 45 (persistent scratch) to /var/scratch and 46 to /var/openslx
-HAVE_PERSISTENT=no
-for partid in 83 45 46 ; do
- for hdpartnr in $(sed -n -e "/ ${partid} /p" "/etc/disk.partition" | sed -e "s/[[:space:]].*//"); do
- if [ "${partid}" -eq 83 ]; then
- mkdir -p "/media/${hdpartnr#/dev/*}"
- echo -e "${hdpartnr}\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto,noexec\t 0 0" >> "/etc/fstab"
- elif [ "${partid}" -eq 45 -a "$HAVE_PERSISTENT" = "no" ]; then
- mkdir -p "$PERSISTENT"
- if ! mount -t auto -o noexec "${hdpartnr}" "$PERSISTENT"; then
- diskfm "$hdpartnr" "jfs xfs ext3" || continue
- mount -t auto -o noexec "${hdpartnr}" "$PERSISTENT" || continue
- fi
- HAVE_PERSISTENT=yes
- echo -e "${hdpartnr}\t${PERSISTENT}\tauto\t\tnoauto,noexec\t\t 0 0" >> "/etc/fstab"
- elif [ "${partid}" -eq 46 ]; then
- mkdir -p "/media/${hdpartnr#/dev/*}"
- #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" >> "/etc/fstab"
+read_partitions () {
+ # create the /etc/disk.partition file with all the partitions and respective id's (MSDOS and GPT)
+ echo "PARTITION - ID" > "/etc/disk.partition"
+ for hd in $(cat /proc/partitions | tr -s ' ' | cut -d ' ' -f5 | grep -o -e "[a-z]*$"); do
+ echo -n "$hd (" >> "/etc/disk.partition"
+ sfdisk -d /dev/$hd 2>&1 | grep 'GPT' > /dev/null
+ if [ $? -eq 1 ]; then
+ echo "MSDOS)" >> "/etc/disk.partition"
+ fdisk /dev/$hd -l | sed -n "/^\/dev\//p" | tr -d '*' | tr -s ' ' | cut -d ' ' -f1,5 >> "/etc/disk.partition"
+ else
+ echo "GPT)" >> "/etc/disk.partition"
+ for part in $(cat /proc/partitions | tr -s ' ' | cut -d ' ' -f5 | grep -o -e "$hd[0-9][0-9]*$"); do
+ LINE="/dev/$part "
+ LINE=${LINE}$(sgdisk /dev/$hd -i ${part:3} | grep 'GUID code' | cut -d ' ' -f4)
+ echo $LINE >> "/etc/disk.partition"
+ done
fi
done
+
+ echo "Partitions:"
+ cat "/etc/disk.partition"
+ echo "------------------------------------------------------"
+}
+
+# default partitions, if not specifies in config (note: size is irrelevant for setup_partitions)
+if [ -z "${SLX_PARTITION_TABLE}" ]; then
+ SLX_PARTITION_TABLE='
+ 44,10G,/tmp
+ 45,10G,/var/scratch
+ 82,4G'
+fi
+
+read_partitions
+
+for PARTITION in $SLX_PARTITION_TABLE; do
+ IFS=,
+ set $PARTITION
+ id=$1
+ shift
+ size=$1
+ shift
+ mountpoint="$1"
+ shift
+ options="$*"
+ unset IFS
+
+ case $id in
+ 44)
+ HAVE_TEMP="no"
+ TMP_SIZE=$size
+ for tmppart in $(grep -e "44$\|44000000-0000-0000-0000-000000000000$" /etc/disk.partition | cut -d ' ' -f1); do
+ echo "tmp partition found, formatting and mounting..."
+ if diskfm "$tmppart"; then
+ # echo "$tmppart is mounted to /mnt/tmp at $(sysup)" >/tmp/tmpready
+ mount_temp "$mopt" "$tmppart" || continue
+ echo "${tmppart}\t/tmp\t\tauto\t\tnoexec\t 0 0" >> "/etc/fstab"
+ HAVE_TEMP="yes"
+ echo "$tmppart mounted on /tmp"
+ else
+ echo "formatting tmp partition failed for some reason"
+ fi # Made this non-forking, systemd should handle it - 2013-05-28
+ done
+ ;;
+ 46)
+ for openslxpart in $(grep -e "46$\|46000000-0000-0000-0000-000000000000$" /etc/disk.partition | cut -d ' ' -f1); do
+ mkdir -p "/media/${openslxpart#/dev/*}"
+ #mount -t auto ${openslxpart} /mnt/media/${openslxpart#/dev/*} \n\
+ #test -d /mnt/media/${openslxpart#/dev/*}/home && \
+ #ln -sf /media/${openslxpart#/dev/*} /var/home
+ echo "${openslxpart}\t/media/${openslxpart#/dev/*}\tauto\t\tnoauto\t\t 0 0" >> "/etc/fstab"
+ echo "special partition ${openslxpart} mounted on /media/${openslxpart#/dev/*}"
+ done
+ ;;
+ 82)
+ # Check for standard swap partitions and make them available to the system
+ HAVE_SWAP=no
+ for swppart in $(grep -e "82$\|0657FD6D-A4AB-43C4-84E5-0933C84B4F4F$" /etc/disk.partition | cut -d ' ' -f1); do
+ echo -e "$swppart\tswap\t\tswap\t\tdefaults\t 0 0" >> "/etc/fstab"
+ mkswap "$swppart" && swapon "$swppart" -p 10 && HAVE_SWAP=yes # low priority, in case we have zram swap, prefer that)
+ [ $HAVE_SWAP = "yes" ] && echo "swap partition found and activated"
+ done
+ ;;
+ *)
+ for hdpartnr in $(grep -e "${id}$\|${id}000000-0000-0000-0000-000000000000$" /etc/disk.partition | cut -d ' ' -f1); do
+ mount_partition "${mountpoint}" $hdpartnr
+ mount_status=$?
+ if [ $mount_status -ne 0 ]; then
+ echo "Mount of partition $hdpartnr on ${mountpoint} failed with exit code: $mount_status"
+ [ -d "${mountpoint}" ] && rm -r "${mountpoint}"
+ else
+ echo "special partition $hdpartnr mounted on ${mountpoint}"
+ fi
+ done
+ ;;
+ esac
+ echo "------------------------------------------------------"
+done
+
+#Put detected linux partitions (83) into /etc/fstab with "noauto"
+for linuxpart in $(grep -e "83$\|0FC63DAF-8483-4772-8E79-3D69D8477DE4$" /etc/disk.partition | cut -d ' ' -f1); do
+ mountpoint="/media"
+ mkdir -p "${mountpoint}/${linuxpart#/dev/*}"
+ echo "${linuxpart}\t${mountpoint}/${linuxpart#/dev/*}\tauto\t\tnoauto,noexec\t 0 0" >> "/etc/fstab"
+ echo "linux partition ${linuxpart} mounted on ${mountpoint}/${linuxpart#/dev/*}"
+ echo "------------------------------------------------------"
done
-[ "$HAVE_PERSISTENT" = "no" -a -d "$PERSISTENT" ] && rm -f "$PERSISTENT"
mount -a
# Make huge tmpfs if nothing could be mounted for /tmp
if [ "$HAVE_TEMP" = "no" ]; then
- mount_temp -t tmpfs -o size=20G none
- slxlog "partition-temp" "Running /tmp on tmpfs only!" "/etc/disk.partition"
+ mount_temp -t tmpfs -o size=${TMP_SIZE} none
+ slxlog "partition-temp" "Running /tmp on tmpfs only!" "/etc/disk.partition"
fi
+
if [ "$HAVE_SWAP" = "no" ]; then
slxlog "partition-swap" "Have no (formatted) swap partition, using zram swap only!" "/etc/disk.partition"
fi
exit 0
-
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons
index 8d4d2d1a..71ed70a7 100755
--- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons
+++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons
@@ -14,7 +14,7 @@
#
#
######################################################################################
-
+set -x
# read global OpenSLX config
. /opt/openslx/config || { echo "Could not source config!"; exit 23; }
@@ -35,6 +35,9 @@ BASE_MOUNT_POINT="/opt/openslx/mnt"
DOWNLOAD_DEST="/tmp/addons"
mkdir -p "$DOWNLOAD_DEST" || { echo "Failed to create $DOWNLOAD_DEST"; exit 1; }
+# Check if HDD Boot is active
+if grep -qs 'hdd_boot' /proc/cmdline; then HDD="yes"; fi
+
######################################################################################
#
# NO ARGUMENTS -> LOOP OVER ALL ADDONS
@@ -54,13 +57,19 @@ fi
if [ $# -eq 1 ]; then
ADDON="$1"
-
- # download the addon from the given URL
ADDON_TARGET_PATH="${DOWNLOAD_DEST}/$(basename "$ADDON").sqfs"
- if ! download "${SLX_BASE_PATH}/${ADDON}.sqfs" "${ADDON_TARGET_PATH}"; then
- slxlog --echo "addon-download" "Download of '${HTTP_BASE_PATH}/${ADDON}.sqfs' failed."
- exit 1
+
+ if [ -z "$HDD" ]; then
+ # download the addon from the given URL
+ if ! download "${SLX_BASE_PATH}/${ADDON}.sqfs" "${ADDON_TARGET_PATH}"; then
+ slxlog --echo "addon-download" "Download of '${HTTP_BASE_PATH}/${ADDON}.sqfs' failed."
+ exit 1
+ fi
+ else
+ # copy from /boot
+ cp /boot/${SLX_BASE_PATH}/${ADDON}.sqfs ${ADDON_TARGET_PATH}
fi
+
# now mount it to $BASE_MOUNT_POINT/<addon-name>
ADDON_MOUNT_POINT="${BASE_MOUNT_POINT}/$(basename "$ADDON")"
diff --git a/remote/rootfs/rootfs-stage32/module.conf b/remote/rootfs/rootfs-stage32/module.conf
index 3a160a36..1182ea53 100644
--- a/remote/rootfs/rootfs-stage32/module.conf
+++ b/remote/rootfs/rootfs-stage32/module.conf
@@ -18,6 +18,11 @@ REQUIRED_BINARIES="
mkfs.xfs
mkfs.ext3
mkfs.ext4
+ fsck.ext3
+ fsck.ext4
+ fsck.jfs
+ fsck.xfs
+ fsck
blkid
modprobe
ps
@@ -38,6 +43,12 @@ REQUIRED_BINARIES="
getent
ldconfig
grep
+ sfdisk
+ sgdisk
+ dialog
+ useradd
+ patch
+ wget
"
REQUIRED_LIBRARIES="
libcap
diff --git a/remote/targets/stage32-curitiba/grub b/remote/targets/stage32-curitiba/grub
new file mode 120000
index 00000000..5d8aa189
--- /dev/null
+++ b/remote/targets/stage32-curitiba/grub
@@ -0,0 +1 @@
+../../modules/grub/ \ No newline at end of file
diff --git a/server/configs/curitiba/cups-curitiba b/server/configs/curitiba/cups-curitiba
deleted file mode 120000
index 99418604..00000000
--- a/server/configs/curitiba/cups-curitiba
+++ /dev/null
@@ -1 +0,0 @@
-../../modules/cups-curitiba/ \ No newline at end of file
diff --git a/server/configs/curitiba/dnbd3-cache b/server/configs/curitiba/dnbd3-cache
new file mode 120000
index 00000000..9bc8ef6f
--- /dev/null
+++ b/server/configs/curitiba/dnbd3-cache
@@ -0,0 +1 @@
+../../modules/dnbd3-cache/ \ No newline at end of file
diff --git a/server/configs/curitiba/hdd-boot b/server/configs/curitiba/hdd-boot
new file mode 120000
index 00000000..0fb7b3a9
--- /dev/null
+++ b/server/configs/curitiba/hdd-boot
@@ -0,0 +1 @@
+../../modules/hdd-boot/ \ No newline at end of file
diff --git a/server/configs/curitiba/local_accounts b/server/configs/curitiba/local_accounts
new file mode 120000
index 00000000..c28e06ff
--- /dev/null
+++ b/server/configs/curitiba/local_accounts
@@ -0,0 +1 @@
+../../modules/local_accounts \ No newline at end of file
diff --git a/server/configs/curitiba/pam-curitiba b/server/configs/curitiba/pam-curitiba
deleted file mode 120000
index 476a0cb2..00000000
--- a/server/configs/curitiba/pam-curitiba
+++ /dev/null
@@ -1 +0,0 @@
-../../modules/pam-curitiba/ \ No newline at end of file
diff --git a/server/configs/curitiba/partitioner b/server/configs/curitiba/partitioner
new file mode 120000
index 00000000..b45bce02
--- /dev/null
+++ b/server/configs/curitiba/partitioner
@@ -0,0 +1 @@
+../../modules/partitioner \ No newline at end of file
diff --git a/server/configs/curitiba/ubuntu-13.04-pulseaudio-fix b/server/configs/curitiba/ubuntu-13.04-pulseaudio-fix
deleted file mode 120000
index 92979703..00000000
--- a/server/configs/curitiba/ubuntu-13.04-pulseaudio-fix
+++ /dev/null
@@ -1 +0,0 @@
-../../modules/ubuntu-13.04-pulseaudio-fix/ \ No newline at end of file
diff --git a/server/configs/curitiba/ubuntu-13.10-unity-fix b/server/configs/curitiba/ubuntu-13.10-unity-fix
deleted file mode 120000
index 15cde030..00000000
--- a/server/configs/curitiba/ubuntu-13.10-unity-fix
+++ /dev/null
@@ -1 +0,0 @@
-../../modules/ubuntu-13.10-unity-fix \ No newline at end of file
diff --git a/server/configs/curitiba/ubuntu-14.04-unity-panel-service-fix b/server/configs/curitiba/ubuntu-14.04-unity-panel-service-fix
deleted file mode 120000
index c7444165..00000000
--- a/server/configs/curitiba/ubuntu-14.04-unity-panel-service-fix
+++ /dev/null
@@ -1 +0,0 @@
-../../modules/ubuntu-14.04-unity-panel-service-fix \ No newline at end of file
diff --git a/server/modules/dnbd3-cache/etc/systemd/system/setup-dnbd3_cache.service b/server/modules/dnbd3-cache/etc/systemd/system/setup-dnbd3_cache.service
new file mode 100644
index 00000000..2eaeddc4
--- /dev/null
+++ b/server/modules/dnbd3-cache/etc/systemd/system/setup-dnbd3_cache.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Setup dnbd3-server as proxy/cache daemon
+Requires=setup-dnbd3.service
+Wants=setup-partitions.service
+After=sysinit.target setup-dnbd3.service setup-partitions.service
+Before=shutdown.target
+DefaultDependencies=no
+
+[Service]
+ExecStart=/opt/openslx/scripts/systemd-setup_dnbd3_cache
+ExecStop=/opt/openslx/bin/killall dnbd3-server
+Restart=on-abort
diff --git a/server/modules/dnbd3-cache/etc/systemd/system/sysinit.target.wants/setup-dnbd3_cache.service b/server/modules/dnbd3-cache/etc/systemd/system/sysinit.target.wants/setup-dnbd3_cache.service
new file mode 120000
index 00000000..9ed23a9f
--- /dev/null
+++ b/server/modules/dnbd3-cache/etc/systemd/system/sysinit.target.wants/setup-dnbd3_cache.service
@@ -0,0 +1 @@
+../setup-dnbd3_cache.service \ No newline at end of file
diff --git a/server/modules/dnbd3-cache/opt/openslx/dnbd3-cache/alt-servers b/server/modules/dnbd3-cache/opt/openslx/dnbd3-cache/alt-servers
new file mode 100644
index 00000000..b6347315
--- /dev/null
+++ b/server/modules/dnbd3-cache/opt/openslx/dnbd3-cache/alt-servers
@@ -0,0 +1 @@
+-132.230.4.1 SLXBOX DNBD3 SERVER
diff --git a/server/modules/dnbd3-cache/opt/openslx/dnbd3-cache/server.conf b/server/modules/dnbd3-cache/opt/openslx/dnbd3-cache/server.conf
new file mode 100644
index 00000000..c0820ea1
--- /dev/null
+++ b/server/modules/dnbd3-cache/opt/openslx/dnbd3-cache/server.conf
@@ -0,0 +1,9 @@
+[dnbd3]
+#vmdkLegacyMode=TRUE
+#clientPenalty=300000
+clientPenalty=0
+basePath=/cache/export/dnbd3
+isProxy=true
+proxyPrivateOnly=true
+uplinkTimeout=5000
+
diff --git a/server/modules/dnbd3-cache/opt/openslx/scripts/systemd-setup_dnbd3_cache b/server/modules/dnbd3-cache/opt/openslx/scripts/systemd-setup_dnbd3_cache
new file mode 100755
index 00000000..705c5c89
--- /dev/null
+++ b/server/modules/dnbd3-cache/opt/openslx/scripts/systemd-setup_dnbd3_cache
@@ -0,0 +1,8 @@
+#!/bin/ash
+
+[ -d "/cache/export/dnbd3" ] || mkdir -p /cache/export/dnbd3/
+
+exec dnbd3-server -c /opt/openslx/dnbd3-cache -n
+slxlog "dnbd3-server" "Error launching dnbd3-server"
+exit 1
+
diff --git a/server/modules/hdd-boot/etc/systemd/system/hdd_boot.service b/server/modules/hdd-boot/etc/systemd/system/hdd_boot.service
new file mode 100644
index 00000000..ed4fdcb7
--- /dev/null
+++ b/server/modules/hdd-boot/etc/systemd/system/hdd_boot.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Runs the OpenSLX Hdd-boot Tool
+After=tmp.target
+Wants=tmp.target
+DefaultDependencies=no
+ConditionPathIsMountPoint=/boot
+
+[Service]
+Type=oneshot
+ExecStart=/opt/openslx/scripts/systemd-hdd_boot
+RemainAfterExit=yes
diff --git a/server/modules/hdd-boot/etc/systemd/system/multi-user.target.wants/hdd_boot.service b/server/modules/hdd-boot/etc/systemd/system/multi-user.target.wants/hdd_boot.service
new file mode 120000
index 00000000..515407f5
--- /dev/null
+++ b/server/modules/hdd-boot/etc/systemd/system/multi-user.target.wants/hdd_boot.service
@@ -0,0 +1 @@
+../hdd_boot.service \ No newline at end of file
diff --git a/server/modules/hdd-boot/opt/openslx/hdd-boot/grub.cfg b/server/modules/hdd-boot/opt/openslx/hdd-boot/grub.cfg
new file mode 100644
index 00000000..611b3785
--- /dev/null
+++ b/server/modules/hdd-boot/opt/openslx/hdd-boot/grub.cfg
@@ -0,0 +1,146 @@
+#
+# DO NOT EDIT THIS FILE
+#
+# It is automatically generated by grub-mkconfig using templates
+# from /etc/grub.d and settings from /etc/default/grub
+#
+
+### BEGIN /etc/grub.d/00_header ###
+if [ -s $prefix/grubenv ]; then
+ set have_grubenv=true
+ load_env
+fi
+if [ "${next_entry}" ] ; then
+ set default="${next_entry}"
+ set next_entry=
+ save_env next_entry
+ set boot_once=true
+else
+ set default="0"
+fi
+
+if [ x"${feature_menuentry_id}" = xy ]; then
+ menuentry_id_option="--id"
+else
+ menuentry_id_option=""
+fi
+
+export menuentry_id_option
+
+if [ "${prev_saved_entry}" ]; then
+ set saved_entry="${prev_saved_entry}"
+ save_env saved_entry
+ set prev_saved_entry=
+ save_env prev_saved_entry
+ set boot_once=true
+fi
+
+function savedefault {
+ if [ -z "${boot_once}" ]; then
+ saved_entry="${chosen}"
+ save_env saved_entry
+ fi
+}
+function recordfail {
+ set recordfail=1
+ if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
+}
+function load_video {
+ if [ x$feature_all_video_module = xy ]; then
+ insmod all_video
+ else
+ insmod efi_gop
+ insmod efi_uga
+ insmod ieee1275_fb
+ insmod vbe
+ insmod vga
+ insmod video_bochs
+ insmod video_cirrus
+ fi
+}
+
+if [ x$feature_default_font_path = xy ] ; then
+ font=unicode
+else
+insmod part_msdos
+insmod lvm
+insmod ext2
+set root='lvmid/ZvOK2H-W5xA-QoO2-zy2n-Sjr7-cpu8-M3zL6F/FzLrNP-IhMk-pB8d-vEEW-Jxxk-ujc7-NWSegg'
+if [ x$feature_platform_search_hint = xy ]; then
+ search --no-floppy --fs-uuid --set=root --hint='lvmid/ZvOK2H-W5xA-QoO2-zy2n-Sjr7-cpu8-M3zL6F/FzLrNP-IhMk-pB8d-vEEW-Jxxk-ujc7-NWSegg' 0bec626d-2d44-417d-acfd-83acbbcf2b34
+else
+ search --no-floppy --fs-uuid --set=root 0bec626d-2d44-417d-acfd-83acbbcf2b34
+fi
+ font="/usr/share/grub/unicode.pf2"
+fi
+
+if loadfont $font ; then
+ set gfxmode=auto
+ load_video
+ insmod gfxterm
+ set locale_dir=$prefix/locale
+ set lang=pt_PT
+ insmod gettext
+fi
+terminal_output gfxterm
+if [ "${recordfail}" = 1 ] ; then
+ set timeout=-1
+else
+ if [ x$feature_timeout_style = xy ] ; then
+ set timeout_style=menu
+ set timeout=10
+ # Fallback normal timeout code in case the timeout_style feature is
+ # unavailable.
+ else
+ set timeout=10
+ fi
+fi
+### END /etc/grub.d/00_header ###
+
+### BEGIN /etc/grub.d/05_debian_theme ###
+set menu_color_normal=white/black
+set menu_color_highlight=black/light-gray
+### END /etc/grub.d/05_debian_theme ###
+
+### BEGIN /etc/grub.d/06_mint_theme ###
+set menu_color_normal=white/black
+set menu_color_highlight=white/light-gray
+### END /etc/grub.d/06_mint_theme ###
+
+### BEGIN /etc/grub.d/10_linux ###
+### END /etc/grub.d/10_linux ###
+
+### BEGIN /etc/grub.d/10_lupin ###
+### END /etc/grub.d/10_lupin ###
+
+### BEGIN /etc/grub.d/20_linux_xen ###
+
+### END /etc/grub.d/20_linux_xen ###
+
+### BEGIN /etc/grub.d/20_memtest86+ ###
+### END /etc/grub.d/20_memtest86+ ###
+
+### BEGIN /etc/grub.d/30_os-prober ###
+set timeout_style=menu
+if [ "${timeout}" = 0 ]; then
+ set timeout=10
+fi
+### END /etc/grub.d/30_os-prober ###
+
+### BEGIN /etc/grub.d/30_uefi-firmware ###
+### END /etc/grub.d/30_uefi-firmware ###
+
+### BEGIN /etc/grub.d/40_custom ###
+# This file provides an easy way to add custom menu entries. Simply type the
+# menu entries you want to add after this comment. Be careful not to change
+# the 'exec tail' line above.
+### END /etc/grub.d/40_custom ###
+
+### BEGIN /etc/grub.d/41_custom ###
+if [ -f ${config_directory}/custom.cfg ]; then
+ source ${config_directory}/custom.cfg
+elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
+ source $prefix/custom.cfg;
+fi
+### END /etc/grub.d/41_custom ###
+
diff --git a/server/modules/hdd-boot/opt/openslx/scripts/systemd-hdd_boot b/server/modules/hdd-boot/opt/openslx/scripts/systemd-hdd_boot
new file mode 100755
index 00000000..f975b697
--- /dev/null
+++ b/server/modules/hdd-boot/opt/openslx/scripts/systemd-hdd_boot
@@ -0,0 +1,116 @@
+#!/bin/bash
+set -x
+# Downloading all in SLX_BASE_PATH to /boot Example: Ubuntu_1404_x64
+# wget -N, update if the file has been changed
+boot_download () {
+ echo "Downloading $SLX_BASE_PATH ................."
+ wget -P /boot -N -r --tries=3 --timeout=5 --quiet -nH -l1 --no-parent --reject="index.html*" --reject="$SLX_BASE_PATH.*" $SLXSRV/$SLX_BASE_PATH #<---- ok =), but try with -nc too
+ RET=$?
+ [ $RET != 0 ] && { echo "Error - downloading 'http://$SLXSRV/$SLX_BASE_PATH/' via wget failed."; exit 1; } ||{ echo "Successfully downloaded 'http://$SLXSRV/$SLX_BASE_PATH' via wget."; return 0; }
+}
+
+# Getting informations from cmdline
+read KCL < "/proc/cmdline"
+for opts in ${KCL}; do
+ case "${opts}" in
+ slxbase=*) # BASE_PATH Example Ubuntu_1404_x64
+ SLX_BASE_PATH=${opts#slxbase=} ;;
+ slxsrv=*)
+ #SLX IP server info
+ SLXSRV=${opts#slxsrv=} ;;
+ BOOT_IMAGE=*)
+ BOOT_IMAGE=${opts} ;;
+ initrd=*)
+ initrd=${opts} ;;
+ esac
+done
+KCL=$(echo "$KCL" | sed "s|SLX_BASE_PATH|$SLX_BASE_PATH|g;s|$BOOT_IMAGE||g;s|$initrd||g")
+
+# Scan vm-store dir for vmware image xmls and copy
+if [ -d /cache/export/dnbd3 -a -d /mnt/vmstore ]; then
+ [ ! -d /boot/vmstore ] && mkdir /boot/vmstore
+ for FILE in $(find /cache/export/dnbd3 -iname "*.vmdk*" ! -iname "*map"); do
+ [ -e "${FILE}.map" ] && continue
+ image_name=$(echo $(basename "$FILE") | cut -d "." -f1)
+ cd /mnt/vmstore
+ for XML in $(grep -rIl --include "*.xml" "$image_name" .); do
+ xmldir=$(dirname $XML)
+ mkdir -p /boot/vmstore/${xmldir}
+ cp $XML /boot/vmstore/${xmldir}/
+ done
+ cd - >/dev/null
+ done
+fi
+
+# Bind mount available vmstore in /boot to /mnt/vmstore if not already present
+if ! grep -qs '/mnt/vmstore' /proc/mounts; then
+ [ ! -d /mnt/vmstore ] && mkdir -p /mnt/vmstore
+ [ -d /boot/vmstore ] && mount --bind /boot/vmstore /mnt/vmstore
+fi
+
+# if SLX_BASE_PATH already exists, just update. Does not make the menu again.
+[ -d /boot/$SLX_BASE_PATH ] && { boot_download; echo "$SLX_BASE_PATH updated"; } || { boot_download; echo "New base $SLX_BASE_PATH downloaded to HDD"; }
+
+# Installing GRUB
+
+#Find disk of /boot
+BOOT_DISK=$(df | grep /boot | awk '{print $1}' | tr -d '[0-9]' | cut -c 6-)
+BOOT_PART=$(df | grep /boot | awk '{print $1}' | tr -dc '[0-9]')
+[ -z "$BOOT_DISK" ] && { echo "BOOT DISK could not be found, exiting."; exit 1; }
+
+#Check if disk is msdos or GPT
+if sgdisk /dev/$BOOT_DISK | grep -qs 'invalid GPT'; then
+ BOOT_TYPE='msdos'
+else
+ BOOT_TYPE='gpt'
+fi
+
+if [ ! -d /boot/grub ]; then
+
+ grub-install --boot-directory=/boot /dev/$BOOT_DISK
+ update-grub-gfxpayload
+
+ RET=$?
+ [ $RET != 0 ] && { echo "Could not install GRUB"; exit 1; } || echo "GRUB successfully installed"
+
+ # First, copy grub.cfg
+ [ -e /opt/openslx/hdd-boot/grub.cfg ] && cp -r /opt/openslx/hdd-boot/grub.cfg /boot/grub/
+fi
+
+#Add new base to grub.cfg
+if ! grep -qs "menuentry '$SLX_BASE_PATH'" /boot/grub/grub.cfg; then
+
+ #GRUB ok, so lets make the menu
+ echo "BOOT DISK is $BOOT_DISK" #Just for test
+ case $BOOT_DISK in
+ sda) GRUB_DISK=hd0 ;;
+ sdb) GRUB_DISK=hd1 ;;
+ sdc) GRUB_DISK=hd2 ;;
+ sdd) GRUB_DISK=hd3 ;;
+ sde) GRUB_DISK=hd4 ;;
+ *) echo "GRUB_DISK was not found"
+ exit 1 ;;
+ esac
+
+ [ -e /boot/grub/grub.cfg ] || { echo "Could not find grub.cfg"; exit 1; }
+
+cat <<EOF >> /boot/grub/grub.cfg
+#########################
+ menuentry '$SLX_BASE_PATH' {
+ linux ($GRUB_DISK,${BOOT_TYPE}$BOOT_PART)/$SLX_BASE_PATH/kernel hdd_boot=${BOOT_DISK}$BOOT_PART $KCL
+ initrd ($GRUB_DISK,${BOOT_TYPE}$BOOT_PART)/$SLX_BASE_PATH/initramfs-stage31
+}
+#########################
+EOF
+
+fi
+
+true
+
+
+
+
+
+
+
+
diff --git a/server/modules/local_accounts/etc/cron.d/openslx-local_accounts b/server/modules/local_accounts/etc/cron.d/openslx-local_accounts
new file mode 100644
index 00000000..948ee329
--- /dev/null
+++ b/server/modules/local_accounts/etc/cron.d/openslx-local_accounts
@@ -0,0 +1,6 @@
+# Trigger scripts that checks idle status of machine and triggers actions
+
+SHELL=/bin/ash
+PATH=/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin
+
+*/5 * * * * root /opt/openslx/scripts/local_accounts-cron_script
diff --git a/server/modules/local_accounts/etc/login.defs b/server/modules/local_accounts/etc/login.defs
new file mode 100644
index 00000000..9bca35e0
--- /dev/null
+++ b/server/modules/local_accounts/etc/login.defs
@@ -0,0 +1,335 @@
+#
+# /etc/login.defs - Configuration control definitions for the login package.
+#
+# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH.
+# If unspecified, some arbitrary (and possibly incorrect) value will
+# be assumed. All other items are optional - if not specified then
+# the described action or option will be inhibited.
+#
+# Comment lines (lines beginning with "#") and blank lines are ignored.
+#
+# Modified for Linux. --marekm
+
+# REQUIRED for useradd/userdel/usermod
+# Directory where mailboxes reside, _or_ name of file, relative to the
+# home directory. If you _do_ define MAIL_DIR and MAIL_FILE,
+# MAIL_DIR takes precedence.
+#
+# Essentially:
+# - MAIL_DIR defines the location of users mail spool files
+# (for mbox use) by appending the username to MAIL_DIR as defined
+# below.
+# - MAIL_FILE defines the location of the users mail spool files as the
+# fully-qualified filename obtained by prepending the user home
+# directory before $MAIL_FILE
+#
+# NOTE: This is no more used for setting up users MAIL environment variable
+# which is, starting from shadow 4.0.12-1 in Debian, entirely the
+# job of the pam_mail PAM modules
+# See default PAM configuration files provided for
+# login, su, etc.
+#
+# This is a temporary situation: setting these variables will soon
+# move to /etc/default/useradd and the variables will then be
+# no more supported
+MAIL_DIR /var/mail
+#MAIL_FILE .mail
+
+#
+# Enable logging and display of /var/log/faillog login failure info.
+# This option conflicts with the pam_tally PAM module.
+#
+FAILLOG_ENAB yes
+
+#
+# Enable display of unknown usernames when login failures are recorded.
+#
+# WARNING: Unknown usernames may become world readable.
+# See #290803 and #298773 for details about how this could become a security
+# concern
+LOG_UNKFAIL_ENAB no
+
+#
+# Enable logging of successful logins
+#
+LOG_OK_LOGINS no
+
+#
+# Enable "syslog" logging of su activity - in addition to sulog file logging.
+# SYSLOG_SG_ENAB does the same for newgrp and sg.
+#
+SYSLOG_SU_ENAB yes
+SYSLOG_SG_ENAB yes
+
+#
+# If defined, all su activity is logged to this file.
+#
+#SULOG_FILE /var/log/sulog
+
+#
+# If defined, file which maps tty line to TERM environment parameter.
+# Each line of the file is in a format something like "vt100 tty01".
+#
+#TTYTYPE_FILE /etc/ttytype
+
+#
+# If defined, login failures will be logged here in a utmp format
+# last, when invoked as lastb, will read /var/log/btmp, so...
+#
+FTMP_FILE /var/log/btmp
+
+#
+# If defined, the command name to display when running "su -". For
+# example, if this is defined as "su" then a "ps" will display the
+# command is "-su". If not defined, then "ps" would display the
+# name of the shell actually being run, e.g. something like "-sh".
+#
+SU_NAME su
+
+#
+# If defined, file which inhibits all the usual chatter during the login
+# sequence. If a full pathname, then hushed mode will be enabled if the
+# user's name or shell are found in the file. If not a full pathname, then
+# hushed mode will be enabled if the file exists in the user's home directory.
+#
+HUSHLOGIN_FILE .hushlogin
+#HUSHLOGIN_FILE /etc/hushlogins
+
+#
+# *REQUIRED* The default PATH settings, for superuser and normal users.
+#
+# (they are minimal, add the rest in the shell startup files)
+ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
+
+#
+# Terminal permissions
+#
+# TTYGROUP Login tty will be assigned this group ownership.
+# TTYPERM Login tty will be set to this permission.
+#
+# If you have a "write" program which is "setgid" to a special group
+# which owns the terminals, define TTYGROUP to the group number and
+# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign
+# TTYPERM to either 622 or 600.
+#
+# In Debian /usr/bin/bsd-write or similar programs are setgid tty
+# However, the default and recommended value for TTYPERM is still 0600
+# to not allow anyone to write to anyone else console or terminal
+
+# Users can still allow other people to write them by issuing
+# the "mesg y" command.
+
+TTYGROUP tty
+TTYPERM 0600
+
+#
+# Login configuration initializations:
+#
+# ERASECHAR Terminal ERASE character ('\010' = backspace).
+# KILLCHAR Terminal KILL character ('\025' = CTRL/U).
+# UMASK Default "umask" value.
+#
+# The ERASECHAR and KILLCHAR are used only on System V machines.
+#
+# UMASK is the default umask value for pam_umask and is used by
+# useradd and newusers to set the mode of the new home directories.
+# 022 is the "historical" value in Debian for UMASK
+# 027, or even 077, could be considered better for privacy
+# There is no One True Answer here : each sysadmin must make up his/her
+# mind.
+#
+# Prefix these values with "0" to get octal, "0x" to get hexadecimal.
+#
+ERASECHAR 0177
+KILLCHAR 025
+UMASK 022
+
+#
+# Password aging controls:
+#
+# PASS_MAX_DAYS Maximum number of days a password may be used.
+# PASS_MIN_DAYS Minimum number of days allowed between password changes.
+# PASS_WARN_AGE Number of days warning given before a password expires.
+#
+PASS_MAX_DAYS 99999
+PASS_MIN_DAYS 0
+PASS_WARN_AGE 7
+
+#
+# Min/max values for automatic uid selection in useradd
+#
+UID_MIN 2000
+UID_MAX 60000
+# System accounts
+#SYS_UID_MIN 100
+#SYS_UID_MAX 999
+
+#
+# Min/max values for automatic gid selection in groupadd
+#
+GID_MIN 2000
+GID_MAX 60000
+# System accounts
+#SYS_GID_MIN 100
+#SYS_GID_MAX 999
+
+#
+# Max number of login retries if password is bad. This will most likely be
+# overriden by PAM, since the default pam_unix module has it's own built
+# in of 3 retries. However, this is a safe fallback in case you are using
+# an authentication module that does not enforce PAM_MAXTRIES.
+#
+LOGIN_RETRIES 5
+
+#
+# Max time in seconds for login
+#
+LOGIN_TIMEOUT 60
+
+#
+# Which fields may be changed by regular users using chfn - use
+# any combination of letters "frwh" (full name, room number, work
+# phone, home phone). If not defined, no changes are allowed.
+# For backward compatibility, "yes" = "rwh" and "no" = "frwh".
+#
+CHFN_RESTRICT rwh
+
+#
+# Should login be allowed if we can't cd to the home directory?
+# Default in no.
+#
+DEFAULT_HOME yes
+
+#
+# If defined, this command is run when removing a user.
+# It should remove any at/cron/print jobs etc. owned by
+# the user to be removed (passed as the first argument).
+#
+#USERDEL_CMD /usr/sbin/userdel_local
+
+#
+# If set to yes, userdel will remove the user´s group if it contains no
+# more members, and useradd will create by default a group with the name
+# of the user.
+#
+# Other former uses of this variable such as setting the umask when
+# user==primary group are not used in PAM environments, such as Debian
+#
+USERGROUPS_ENAB yes
+
+#
+# Instead of the real user shell, the program specified by this parameter
+# will be launched, although its visible name (argv[0]) will be the shell's.
+# The program may do whatever it wants (logging, additional authentification,
+# banner, ...) before running the actual shell.
+#
+# FAKE_SHELL /bin/fakeshell
+
+#
+# If defined, either full pathname of a file containing device names or
+# a ":" delimited list of device names. Root logins will be allowed only
+# upon these devices.
+#
+# This variable is used by login and su.
+#
+#CONSOLE /etc/consoles
+#CONSOLE console:tty01:tty02:tty03:tty04
+
+#
+# List of groups to add to the user's supplementary group set
+# when logging in on the console (as determined by the CONSOLE
+# setting). Default is none.
+#
+# Use with caution - it is possible for users to gain permanent
+# access to these groups, even when not logged in on the console.
+# How to do it is left as an exercise for the reader...
+#
+# This variable is used by login and su.
+#
+#CONSOLE_GROUPS floppy:audio:cdrom
+
+#
+# If set to "yes", new passwords will be encrypted using the MD5-based
+# algorithm compatible with the one used by recent releases of FreeBSD.
+# It supports passwords of unlimited length and longer salt strings.
+# Set to "no" if you need to copy encrypted passwords to other systems
+# which don't understand the new algorithm. Default is "no".
+#
+# This variable is deprecated. You should use ENCRYPT_METHOD.
+#
+#MD5_CRYPT_ENAB no
+
+#
+# If set to MD5 , MD5-based algorithm will be used for encrypting password
+# If set to SHA256, SHA256-based algorithm will be used for encrypting password
+# If set to SHA512, SHA512-based algorithm will be used for encrypting password
+# If set to DES, DES-based algorithm will be used for encrypting password (default)
+# Overrides the MD5_CRYPT_ENAB option
+#
+# Note: It is recommended to use a value consistent with
+# the PAM modules configuration.
+#
+ENCRYPT_METHOD SHA512
+
+#
+# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512.
+#
+# Define the number of SHA rounds.
+# With a lot of rounds, it is more difficult to brute forcing the password.
+# But note also that it more CPU resources will be needed to authenticate
+# users.
+#
+# If not specified, the libc will choose the default number of rounds (5000).
+# The values must be inside the 1000-999999999 range.
+# If only one of the MIN or MAX values is set, then this value will be used.
+# If MIN > MAX, the highest value will be used.
+#
+# SHA_CRYPT_MIN_ROUNDS 5000
+# SHA_CRYPT_MAX_ROUNDS 5000
+
+################# OBSOLETED BY PAM ##############
+# #
+# These options are now handled by PAM. Please #
+# edit the appropriate file in /etc/pam.d/ to #
+# enable the equivelants of them.
+#
+###############
+
+#MOTD_FILE
+#DIALUPS_CHECK_ENAB
+#LASTLOG_ENAB
+#MAIL_CHECK_ENAB
+#OBSCURE_CHECKS_ENAB
+#PORTTIME_CHECKS_ENAB
+#SU_WHEEL_ONLY
+#CRACKLIB_DICTPATH
+#PASS_CHANGE_TRIES
+#PASS_ALWAYS_WARN
+#ENVIRON_FILE
+#NOLOGINS_FILE
+#ISSUE_FILE
+#PASS_MIN_LEN
+#PASS_MAX_LEN
+#ULIMIT
+#ENV_HZ
+#CHFN_AUTH
+#CHSH_AUTH
+#FAIL_DELAY
+
+################# OBSOLETED #######################
+# #
+# These options are no more handled by shadow. #
+# #
+# Shadow utilities will display a warning if they #
+# still appear. #
+# #
+###################################################
+
+# CLOSE_SESSIONS
+# LOGIN_STRING
+# NO_PASSWORD_CONSOLE
+# QMAIL_DIR
+
+
+
diff --git a/server/modules/local_accounts/etc/systemd/system/local_accounts.service b/server/modules/local_accounts/etc/systemd/system/local_accounts.service
new file mode 100644
index 00000000..37488705
--- /dev/null
+++ b/server/modules/local_accounts/etc/systemd/system/local_accounts.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Runs the OpenSLX Create Users Tool
+Wants=display-manager.service getty@tty1.service getty@ttyUSB0.service
+Before=display-manager.service getty@tty1.service getty@ttyUSB0.service
+
+[Service]
+Type=oneshot
+ExecStart=/opt/openslx/scripts/systemd-local_accounts
+RemainAfterExit=yes
diff --git a/server/modules/local_accounts/etc/systemd/system/multi-user.target.wants/local_accounts.service b/server/modules/local_accounts/etc/systemd/system/multi-user.target.wants/local_accounts.service
new file mode 120000
index 00000000..578ecc01
--- /dev/null
+++ b/server/modules/local_accounts/etc/systemd/system/multi-user.target.wants/local_accounts.service
@@ -0,0 +1 @@
+../../../../etc/systemd/system/local_accounts.service \ No newline at end of file
diff --git a/server/modules/local_accounts/opt/openslx/scripts/local_accounts-cron_script b/server/modules/local_accounts/opt/openslx/scripts/local_accounts-cron_script
new file mode 100755
index 00000000..8d38401a
--- /dev/null
+++ b/server/modules/local_accounts/opt/openslx/scripts/local_accounts-cron_script
@@ -0,0 +1,9 @@
+#!/bin/ash
+
+# create .patches for next session
+
+if [ -d /home/openslx ]; then
+ for file in passwd shadow group; do
+ diff -u /home/openslx/.$file.backup /etc/$file > /home/openslx/.$file.patch
+ done
+fi
diff --git a/server/modules/local_accounts/opt/openslx/scripts/systemd-local_accounts b/server/modules/local_accounts/opt/openslx/scripts/systemd-local_accounts
new file mode 100755
index 00000000..5cabd4fd
--- /dev/null
+++ b/server/modules/local_accounts/opt/openslx/scripts/systemd-local_accounts
@@ -0,0 +1,66 @@
+#!/bin/ash
+
+. /opt/openslx/config || { echo "Could not source config!"; exit 23; }
+
+#generate new user with useradd and insert password in /etc/shadow if exists
+create_user(){
+ local username="$1"
+ local password="$2"
+ uset IFS
+
+ #if the users doesn't exists, create him without the password
+ if useradd -s /bin/bash -m "$username" -K UID_MIN=1000 -K GID_MIN=1000; then
+ if [ -n "$password" ]; then
+ #set the password in the /etc/shadow file
+ sed -i "s#^${username}:[^:]*:#${username}:${password}:#" "/etc/shadow"
+ fi
+ else
+ echo 'user ${username} already exists'
+ #if the user already exists, check if the password has changed
+ if [ -n "$password" ] && [ $(grep ^${username}: /etc/shadow | cut -d ':' -f2) != "$password" ]; then
+ echo "User password changed, updating /etc/shadow to new one"
+ #set the password in the /etc/shadow file
+ sed -i "s#^${username}:[^:]*:#${username}:${password}:#" "/etc/shadow"
+ fi
+ fi
+}
+
+# check if the /home partition exists
+if mount | grep "/home" > /dev/null; then
+ echo "/home partition found"
+
+ #try to create the 'openslx' user in whose home dir backups and patch files will be stored
+ if useradd -s /bin/bash -m openslx -K UID_MIN=1000 -K GID_MIN=1000; then
+ echo "user openslx created"
+ #set the password in the /etc/shadow file
+ sed -i "s#^openslx:[^:]*:#openslx:$OPENSLX_PASS:#" "/etc/shadow"
+ fi
+
+ #create the accounts specified in the SLX_USERS config.
+ for line in $SLX_USERS; do
+ IFS=,
+ set $line
+ create_user $1 $2
+ done
+
+ #patch passwd, shadow and group with changes the local admin made in that machine
+ for file in passwd shadow group; do
+ #backup files before patching to save slxbox state
+ echo "Backing up /etc/${file} at /home/openslx/.${file}.backup"
+ cp /etc/${file} /home/openslx/.${file}.backup
+
+ #apply patch of users created by the admin in the last session.
+ if [ -e /home/openslx/.${file}.patch ]; then
+ patch /etc/${file} < /home/openslx/.${file}.patch
+ fi
+ done
+
+else
+ #if no /home partition was found, will create the user but won't do the patch and backup.
+ echo "No /home partition found on hdd. Creating non permanent users from slxbox."
+ for line in $SLX_USERS; do # create the accounts specified in the SLX_USERS config.
+ IFS=,
+ set $line
+ create_user $1 $2
+ done
+fi
diff --git a/server/modules/partitioner/etc/systemd/system/multi-user.target.wants/partitioner.service b/server/modules/partitioner/etc/systemd/system/multi-user.target.wants/partitioner.service
new file mode 120000
index 00000000..48defa3e
--- /dev/null
+++ b/server/modules/partitioner/etc/systemd/system/multi-user.target.wants/partitioner.service
@@ -0,0 +1 @@
+../partitioner.service \ No newline at end of file
diff --git a/server/modules/partitioner/etc/systemd/system/partitioner.service b/server/modules/partitioner/etc/systemd/system/partitioner.service
new file mode 100644
index 00000000..85b41597
--- /dev/null
+++ b/server/modules/partitioner/etc/systemd/system/partitioner.service
@@ -0,0 +1,20 @@
+[Unit]
+Description=Runs the OpenSLX Partitioning Tool
+After=killsplash.service
+After=systemd-vconsole-setup.service
+Before=display-manager.service getty@tty1.service getty@ttyUSB0.service
+Before=serial-getty@ttyS0.service serial-getty@ttyO0.service serial-getty@ttyO2.service
+Before=serial-getty@ttyAMA0.service serial-getty@ttymxc0.service serial-getty@ttymxc3.service
+Conflicts=killsplash.service
+ConditionKernelCommandLine=partitioner
+
+[Service]
+Type=oneshot
+ExecStart=/opt/openslx/scripts/systemd-partitioner
+TimeoutSec=0
+RemainAfterExit=yes
+SysVStartPriority=99
+StandardInput=tty
+StandardOutput=tty
+StandardError=syslog
+
diff --git a/server/modules/partitioner/opt/openslx/scripts/systemd-partitioner b/server/modules/partitioner/opt/openslx/scripts/systemd-partitioner
new file mode 100755
index 00000000..d8fa0c6d
--- /dev/null
+++ b/server/modules/partitioner/opt/openslx/scripts/systemd-partitioner
@@ -0,0 +1,497 @@
+#!/bin/ash
+# 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
+
+#############################################################################
+
+perror () {
+ echo "ERROR: $@" 1>&2
+ if [ "$SLX_AUTOMATIC_PARTITIONING" != "yes" ]; then
+ dialog --title "ERROR" --stdout --msgbox "$@" 15 60
+ else
+ dialog --title "ERROR" --no-cancel --stdout --pause "$@\n\nReboot in:" 15 60 600
+ reboot
+ fi
+ exit 1
+}
+
+pwarning () {
+ echo "WARNING: $@" 1>&2
+ if [ "$SLX_AUTOMATIC_PARTITIONING" != "yes" ]; then
+ dialog --title "WARNING" --stdout --msgbox "$@" 15 60
+ else
+ dialog --title "WARNING" --stdout --infobox "$@" 15 60
+ sleep 5
+ fi
+}
+
+. /opt/openslx/config || perror "Could not source config."
+
+#set -x
+#exec > /log 2>&1
+
+
+#--------------------------------------------------------------------------------------
+#Gathering partition information
+
+# BLOCKSIZE=$(sfdisk -l /dev/$SLX_CHOOSEN_DISK | grep -o -e "blocks of [0-9]* bytes" | cut -d ' ' -f3)
+BLOCKSIZE=1024
+
+# pick the size of a sector (usually 512 bytes)
+# SECTORSIZE=$(sfdisk /dev/$SLX_CHOOSEN_DISK -l -u S 2> /dev/null | grep Units | cut -d ' ' -f5)
+SECTORSIZE=512
+
+# Partition that should be set as extended partition (only partitions 2-4 can be extended partitions)
+EXTENDED_PARTITION_NR=4
+
+PARTITIONSPATH="/proc/partitions"
+# picking disk that will be used
+DISKS=$(cat $PARTITIONSPATH | tr -s ' ' | cut -d ' ' -f5 | grep -e "[a-z]$")
+if [ -z "$DISKS" ]; then
+ perror "Can't find an hard disk."
+fi
+#--------------------------------------------------------------------------------------
+
+define_partition_table() {
+ if [ -z "$SLX_PARTITION_TABLE" ]; then
+ SLX_PARTITION_TABLE='
+ 44,10G,/tmp
+ 45,10G,/var/scratch
+ 82,4G'
+ pwarning "You didn't define a partition table in config. Using default partition table:\n$SLX_PARTITION_TABLE"
+ fi
+}
+
+size_conv() {
+ [ $(echo "$1<1024" | bc) -eq 1 ] && { echo "$1 B"; exit 0; }
+ local result="$(echo $1 | awk '{ sum=$1; hum[1024^3]="GB"; hum[1024^2]="MB"; hum[1024]="KB";
+ for (x=1024^3; x>=1024; x/=1024){
+ if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break }
+ }
+ }')"
+ echo $result
+}
+
+choose_disk() {
+ local disk_number=$(echo $DISKS | tr ' ' \\n | wc -l)
+ if [ "$SLX_AUTOMATIC_PARTITIONING" = "yes" ]; then
+ if [ -n "$SLX_CHOOSEN_DISK" ]; then
+ echo $DISKS | grep -wq "$SLX_CHOOSEN_DISK" || perror "ERROR: Automatic partitioning enabled, but in config specified $SLX_CHOOSEN_DISK was not found."
+ elif [ "$disk_number" -eq 1 ]; then
+ SLX_CHOOSEN_DISK=$DISKS
+ pwarning "Automatic partitioning enabled, but SLX_CHOOSEN_DISK not specified in config. Choosing only existing disk: $DISKS for partitioning."
+ else
+ perror "Automatic partitioning enabled, but SLX_CHOOSEN_DISK not specified in config. More than one disk exists, please specify disk in config and run again."
+ fi
+ else
+ local dialog_string="Existing disks with partition tables:\n\n"
+ local disksize=""
+ local freespace=0
+ local parts=""
+ local partsize=0
+ local used=0
+ local options=""
+
+ for disk in $DISKS; do
+ disksize=$(echo "$(cat $PARTITIONSPATH | grep -e $disk$ | tr -s ' ' | cut -d ' ' -f4)*$BLOCKSIZE" | bc)
+ parts=$(cat $PARTITIONSPATH | grep -e $disk[0-9] | tr -s ' ' | cut -d ' ' -f5)
+ dialog_string="${dialog_string}$disk $(size_conv $disksize)\n"
+ used=0
+ options="${options}$disk $disk "
+
+ for part in $parts; do
+ partsize=$(echo "$(cat $PARTITIONSPATH | grep -e $part$ | tr -s ' ' | cut -d ' ' -f4)*$BLOCKSIZE" | bc)
+ used=$(echo "$used+$partsize" | bc)
+ dialog_string="${dialog_string} $part $(size_conv $partsize)\n"
+ done
+
+ dialog_string=$dialog_string"--------------------------------\n"
+ freespace=$(echo "$disksize-$used" | bc)
+ dialog_string="${dialog_string}Used $(size_conv $used)\n"
+ dialog_string="${dialog_string}Free $(size_conv $freespace)\n\n"
+ done
+
+ if [ $(echo $DISKS | tr ' ' \\n | wc -l) -gt 0 ]; then
+ SLX_CHOOSEN_DISK=$(echo $options | xargs dialog --title "Choose a disk to partition:" --no-tags --cr-wrap --no-collapse --stdout --menu "${dialog_string}" 0 0 0)
+ if [ -z $SLX_CHOOSEN_DISK ]; then
+ pwarning "Partitioning aborted by user."
+ exit 1
+ fi
+ else
+ perror "Can't find a hard disk."
+ fi
+ fi
+ CHOOSEN_DISK_SIZE=$(echo "$(cat $PARTITIONSPATH | grep -e $SLX_CHOOSEN_DISK$ | tr -s ' ' | cut -d ' ' -f4)*$BLOCKSIZE" | bc)
+ CHOOSEN_DISK_PARTS=$(cat $PARTITIONSPATH | grep -e $SLX_CHOOSEN_DISK[0-9] | tr -s ' ' | cut -d ' ' -f5)
+}
+
+check_disk_size() {
+ # check if the choosen disk is greater than the new partition table size.
+ local part_number=$(echo $SLX_PARTITION_TABLE | wc -w)
+ local part_space=$(echo $SLX_PARTITION_TABLE | grep -oE '[0-9]+G' | awk '{ SUM += $0 } END { print SUM }')
+ NEEDED_DISK_SPACE=$(echo "$part_space*1024*1024*1024+$part_number*1024*1024" | bc)
+
+ if [ $(echo "$CHOOSEN_DISK_SIZE<$NEEDED_DISK_SPACE" | bc) -eq 1 ]; then
+ perror "Insufficient space on disk /dev/$SLX_CHOOSEN_DISK\n DISK SIZE: $(size_conv $CHOOSEN_DISK_SIZE)\n REQUIRED SIZE: $(size_conv $NEEDED_DISK_SPACE)"
+ fi
+}
+
+select_partition_type() {
+ # choosing the partition type (MSDOS or GPT) if it wasn't set in config file
+ if [ -z "$SLX_PARTITION_TYPE" ]; then
+ if [ "$SLX_AUTOMATIC_PARTITIONING" = "yes" ]; then
+ pwarning "SLX_PARTITION_TYPE not defined in config, using default: msdos"
+ SLX_PARTITION_TYPE=msdos
+ else
+ SLX_PARTITION_TYPE=$(dialog --no-tags --title "Choose a partition type:" --menu --stdout "Partitions types:" 0 0 0 "msdos" " MSDOS " "GPT" " GPT ")
+ if [ -z $SLX_PARTITION_TYPE ]; then
+ pwarning "Partitioning aborted by user."
+ exit 1
+ fi
+ fi
+ fi
+}
+
+confirm_partitioning() {
+ local dialog_string="New partition table after partitioning:\n\n"
+ local counter=1
+ local id=0
+ local size=0
+ local mountpoint=""
+ local bootable=0
+ local part_type="Primary"
+ for part in $SLX_PARTITION_TABLE; do
+ IFS=,
+ set $part
+
+ id=$1
+ shift
+ size=${1%G}
+ shift
+ [ -n $1 ] && mountpoint=$1
+ shift
+ case "$*" in
+ *bootable*) bootable=1 ;;
+ *) bootable=0 ;;
+ esac
+
+ [ "$id" = "82" ] && mountpoint="swap"
+
+ if [ $SLX_PARTITION_TYPE = 'GPT' ]; then
+ #update dialog status
+ dialog_string="${dialog_string}${mountpoint} (/dev/"${SLX_CHOOSEN_DISK}${counter}")\n"
+ if [ "${id}" = "82" ]; then
+ dialog_string="${dialog_string} GUID: 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F\n"
+ elif [ "${id}" = "83" ]; then
+ dialog_string="${dialog_string} GUID: 0FC63DAF-8483-4772-8E79-3D69D8477DE4\n"
+ else
+ dialog_string="${dialog_string} GUID: "$id"000000-0000-0000-0000-000000000000\n"
+ fi
+ dialog_string="${dialog_string} Size: "$size" GB\n"
+ else
+ if [ $counter -eq $EXTENDED_PARTITION_NR ]; then
+ part_type="Logical"
+ counter=$(($counter+1))
+ fi
+ #update dialog
+ dialog_string="${dialog_string}$mountpoint (/dev/${SLX_CHOOSEN_DISK}$counter)\n"
+ dialog_string="${dialog_string} Type: $part_type\n"
+ dialog_string="${dialog_string} ID: $id\n"
+ dialog_string="${dialog_string} Size: $size GB\n"
+ fi
+
+ counter=$(($counter+1))
+ done
+ unset IFS
+
+ dialog_string="${dialog_string}\nAll existing partitions on /dev/$SLX_CHOOSEN_DISK will be deleted, continue?"
+
+ # asking confirmation to create the partitions
+ dialog --title "WARNING" --stdout --defaultno --yesno "$dialog_string" 0 0
+ if [ $? -eq 1 ]; then
+ pwarning "Partitioning aborted by user."
+ exit 1
+ fi
+}
+
+# function to create gpt type partition tables (uses sgdisk)
+partition_disk_gpt() {
+ # delete partition table
+ sgdisk -Z /dev/$SLX_CHOOSEN_DISK > /dev/null 2>&1 || perror "Error erasing old partition table"
+
+ #set dialog
+ dialog_string="Partitions created:\n\n"
+ echo "0" | dialog --title "Partitioner" --stdout --gauge "$dialog_string" 0 0 0
+
+ # loop that will create each GPT partition, change GUIDS, change names, and set bootable flags.
+ local counter=1
+ local part_number=$(echo $SLX_PARTITION_TABLE | wc -w)
+ local id=0
+ local size=0
+ local mountpoint=""
+ local bootable=0
+ for part in $SLX_PARTITION_TABLE; do
+ IFS=,
+ set $part
+
+ id=$1
+ shift
+ size=${1%G}
+ shift
+ [ -n $1 ] && mountpoint=$1
+ shift
+ case "$*" in
+ *bootable*) bootable=1 ;;
+ *) bootable=0 ;;
+ esac
+
+ #create boot partition and set boot flag
+ if [ "$bootable" -eq 1 ]; then
+ sgdisk /dev/${SLX_CHOOSEN_DISK} -n ${counter}:0:+1M 1>&2 || perror "Error setting size of GPT partition ${SLX_CHOOSEN_DISK}${counter}"
+ sgdisk /dev/${SLX_CHOOSEN_DISK} -t ${counter}:21686148-6449-6E6F-744E-656564454649 1>&2 || perror "Error setting id ${id} of GPT partition ${SLX_CHOOSEN_DISK}${counter}"
+ sgdisk /dev/${SLX_CHOOSEN_DISK} -A ${counter}:set:2 1>&2 || perror "Error setting boot flag for GPT partition ${SLX_CHOOSEN_DISK}${counter}"
+ dialog_string="${dialog_string}Special bootloader partition (/dev/${SLX_CHOOSEN_DISK}${counter})\n"
+ dialog_string="${dialog_string} GUID: 21686148-6449-6E6F-744E-656564454649\n"
+ dialog_string="${dialog_string} Size: 1 MB\n"
+ counter=$(($counter+1))
+ part_number=$(($part_number+1))
+ fi
+
+ #set size of partition
+ sgdisk /dev/${SLX_CHOOSEN_DISK} -n ${counter}:0:+${size}G 1>&2 || perror "Error setting size of GPT partition ${SLX_CHOOSEN_DISK}${counter}"
+
+ #set id of partition
+ if [ "${id}" = "82" ] || [ "${id}" = "83" ]; then
+ sgdisk /dev/${SLX_CHOOSEN_DISK} -t ${counter}:${id}00 1>&2 || perror "Error setting id ${id} of GPT partition ${SLX_CHOOSEN_DISK}${counter}"
+ else
+ sgdisk /dev/${SLX_CHOOSEN_DISK} -t ${counter}:${id}000000-0000-0000-0000-000000000000 -c ${counter}:\"${mountpoint}\" 1>&2 || perror "Error setting id ${id} of GPT partition ${SLX_CHOOSEN_DISK}${counter}"
+ fi
+
+ #update dialog status
+ [ "$id" = "82" ] && mountpoint="swap"
+ dialog_string="${dialog_string}${mountpoint} (/dev/${SLX_CHOOSEN_DISK}${counter})\n"
+ if [ "${id}" = "82" ]; then
+ dialog_string="${dialog_string} GUID: 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F\n"
+ elif [ "${id}" = "83" ]; then
+ dialog_string="${dialog_string} GUID: 0FC63DAF-8483-4772-8E79-3D69D8477DE4\n"
+ else
+ dialog_string="${dialog_string} GUID: ${id}000000-0000-0000-0000-000000000000\n"
+ fi
+ dialog_string="${dialog_string} Size: ${size} GB\n"
+ echo $(echo "(100/$part_number)*$counter" | bc) | dialog --title "Partitioner" --stdout --gauge "${dialog_string}" 0 0 0
+
+ counter=$(($counter+1))
+ done
+ unset IFS
+
+ if [ "$SLX_AUTOMATIC_PARTITIONING" != "yes" ]; then
+ dialog --title "Partitioner" --stdout --msgbox "$dialog_string" 0 0
+ fi
+}
+
+#function to create msdos type partition tables (uses sfdisk)
+partition_disk_msdos(){
+ # delete partition table
+ sgdisk -Z /dev/$SLX_CHOOSEN_DISK > /dev/null 2>&1 || perror "Error erasing old partition table"
+
+ #set dialog
+ dialog_string="Partitions created:\n\n"
+
+ # constructing the sfdisk input file
+ echo "unit: sectors"> /tmp/partitiontable.tmp
+
+ # loop that will create each GPT partition, change GUIDS, change names, and set bootable flags.
+ local counter=1
+ local id=0
+ local size=0
+ local mountpoint=""
+ local bootable=0
+ local part_type="Primary"
+ local start=$(echo "1*1024*1024/$SECTORSIZE" | bc)
+ for part in $SLX_PARTITION_TABLE; do
+ IFS=,
+ set $part
+
+ id=$1
+ shift
+ size=${1%G}
+ shift
+ [ -n $1 ] && mountpoint=$1
+ shift
+ case "$*" in
+ *bootable*) bootable=1 ;;
+ *) bootable=0 ;;
+ esac
+
+ if [ $counter -eq $EXTENDED_PARTITION_NR ]; then
+ echo "/dev/${SLX_CHOOSEN_DISK}$counter : start= $start, size= $(echo "${CHOOSEN_DISK_SIZE}/$SECTORSIZE-1" | bc), Id= 5" >> /tmp/partitiontable.tmp
+ part_type="Logical"
+ start=$(echo "$start+1*1024*1024/$SECTORSIZE" | bc)
+ counter=$(($counter+1))
+ fi
+
+ size_bytes=$(echo "${size}*1024*1024*1024/$SECTORSIZE" | bc)
+
+ if [ "$bootable" -eq 1 ]; then
+ echo "/dev/${SLX_CHOOSEN_DISK}$counter : start= $start, size= $size_bytes, Id= $id, bootable " >> /tmp/partitiontable.tmp
+ else
+ echo "/dev/${SLX_CHOOSEN_DISK}$counter : start= $start, size= $size_bytes, Id= $id" >> /tmp/partitiontable.tmp
+ fi
+
+ start=$(echo "$start+$size_bytes+1*1024*1024/$SECTORSIZE" |bc)
+
+ #update dialog
+ [ "$id" = "82" ] && mountpoint="swap"
+ dialog_string="${dialog_string}$mountpoint (/dev/${SLX_CHOOSEN_DISK}$counter)\n"
+ dialog_string="${dialog_string} Type: $part_type\n"
+ dialog_string="${dialog_string} ID: $id\n"
+ dialog_string="${dialog_string} Size: $size GB\n"
+
+ counter=$(($counter+1))
+ done
+ unset IFS
+
+ sfdisk -q --no-reread -f /dev/${SLX_CHOOSEN_DISK} < /tmp/partitiontable.tmp 1>&2 || return 0
+ # rm -f /tmp/partitiontable.tmp
+
+ if [ "$SLX_AUTOMATIC_PARTITIONING" != "yes" ]; then
+ dialog --title "Partitioner" --stdout --msgbox "$dialog_string" 0 0
+ else
+ dialog --title "Partitioner" --stdout --infobox "$dialog_string" 0 0
+ sleep 5
+ fi
+}
+
+
+define_partition_table
+choose_disk
+select_partition_type
+if [ "$SLX_AUTOMATIC_PARTITIONING" != "yes" ]; then
+ confirm_partitioning
+fi
+check_disk_size
+
+if [ $SLX_PARTITION_TYPE = 'GPT' ]; then
+ partition_disk_gpt
+else
+ partition_disk_msdos
+fi
+
+if [ "$SLX_AUTOMATIC_PARTITIONING" != "yes" ]; then
+ #reboot prompt
+ dialog --title "reboot computer" --stdout --yes-label "Reboot" --no-label "Continue" --yesno "For changes to take effect you have to reboot your machine." 5 65
+ [ $? -eq 0 ] && reboot || exit 0
+else
+ reboot
+fi
+
+####################### CODE FOR THE PRESERVATION OF EXISTING PARTITIONS (EXPERIMENTAL) #########################
+#elif [ $(sfdisk -d /dev/$SLX_CHOOSEN_DISK 2> /dev/null | grep $SLX_CHOOSEN_DISK'1' | tr -s ' ' | cut -d ' ' -f7 | cut -d '=' -f2) = 'ee' ]; then
+## finding existent partitions in GPT
+# echo 'GPT'
+# NONEXISTENT_PARTITIONS=0
+# for (( i = 1; i < $COUNTER; i++ )); do
+# if [ $i -ne 4 ]; then
+# for PART in $PARTS; do
+# if [ "${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}" = "82" ]; then
+# sgdisk /dev/$SLX_CHOOSEN_DISK -i ${PART:3} 2> /dev/null | grep "0657FD6D-A4AB-43C4-84E5-0933C84B4F4F" > /dev/null
+# elif [ "${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}" = "83" ]; then
+# sgdisk /dev/$SLX_CHOOSEN_DISK -i ${PART:3} 2> /dev/null | grep "0FC63DAF-8483-4772-8E79-3D69D8477DE4" > /dev/null
+# else
+# sgdisk /dev/$SLX_CHOOSEN_DISK -i ${PART:3} 2> /dev/null | grep ${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}"000000-0000-0000-0000-000000000000" > /dev/null
+# fi
+# if [ $? -eq 0 ]; then
+# PARTTBL["$SLX_CHOOSEN_DISK$i/exists"]=$PART
+# NEEDED_SPACE=$(($NEEDED_SPACE-${PARTTBL["$SLX_CHOOSEN_DISK$i/size"]}*1024*1024*1024))
+# break
+# fi
+# done
+# if [[ ${PARTTBL["$SLX_CHOOSEN_DISK$i/exists"]} = "0" ]]; then
+# NONEXISTENT_PARTITIONS=$(($NONEXISTENT_PARTITIONS+1))
+# fi
+# fi
+# done
+# # checking if there's sufficient space for the new partitions.
+# if [[ $FREESPACE -lt $NEEDED_SPACE ]]; then
+# dialog --msgbox "ERROR: Insufficient free space in disk /dev/$SLX_CHOOSEN_DISK." 6 40
+# exit 1
+# fi
+# if [[ $NONEXISTENT_PARTITIONS -eq 0 ]]; then
+# dialog_string="All your requested partitions already exists.\n\n"
+# dialog_string=$dialog_string"Partition ID\n"
+# for (( i = 1; i < $COUNTER; i++ )); do
+# if [[ $i -ne 4 ]]; then
+# dialog_string=$dialog_string"${PARTTBL["$SLX_CHOOSEN_DISK$i/exists"]} ${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}\n"
+# fi
+# done
+# else
+# dialog_string="Creating partitions...\n\n"
+# echo "0" | dialog --gauge "$dialog_string" 0 0 0
+# CREATED=0
+# for (( i = 1; i < $COUNTER; i++ )); do
+# j=1
+# if [[ $i -ne 4 ]]; then
+# if [[ "${PARTTBL["$SLX_CHOOSEN_DISK$i/exists"]}" = "0" ]]; then
+# sgdisk /dev/$SLX_CHOOSEN_DISK -n $j:0:+${PARTTBL["$SLX_CHOOSEN_DISK$i/size"]}G 2> /dev/null > /dev/null
+# while [[ $? -eq 4 ]]; do
+# j=$(($j+1))
+# sgdisk /dev/$SLX_CHOOSEN_DISK -n $j:0:+${PARTTBL["$SLX_CHOOSEN_DISK$i/size"]}G 2> /dev/null > /dev/null
+# done
+# PARTTBL["$SLX_CHOOSEN_DISK$i/exists"]=$SLX_CHOOSEN_DISK$j
+# SIZE=$((${PARTTBL["$SLX_CHOOSEN_DISK$i/size"]}*1024*1024*1024))
+# ID=${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}
+# MOUNTPOINT=${PARTTBL["$SLX_CHOOSEN_DISK$i/mountpoint"]}
+# dialog_string=$dialog_string$MOUNTPOINT" (/dev/"${PARTTBL["$SLX_CHOOSEN_DISK$i/exists"]}")\n"
+# if [ "${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}" = "82" ]; then
+# dialog_string=$dialog_string" GUID: 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F\n"
+# elif [ "${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}" = "83" ]; then
+# dialog_string=$dialog_string" GUID: 0FC63DAF-8483-4772-8E79-3D69D8477DE4\n"
+# else
+# sgdisk /dev/$SLX_CHOOSEN_DISK -t $j:$ID"000000-0000-0000-0000-000000000000" -c $j:$MOUNTPOINT >/dev/null 2>/dev/null
+# dialog_string=$dialog_string" GUID: "$ID"000000-0000-0000-0000-000000000000\n"
+# fi
+# dialog_string=$dialog_string" Size: "$SIZE" Bytes ("${PARTTBL["$SLX_CHOOSEN_DISK$i/size"]}" GB)\n"
+# CREATED=$(($CREATED+1))
+# echo $(( $CREATED*100/($NONEXISTENT_PARTITIONS) )) | dialog --gauge "$dialog_string" 0 0 0
+# fi
+# if [ ${PARTTBL["$SLX_CHOOSEN_DISK$i/bootable"]} -eq 1 ]; then
+# sgdisk /dev/$SLX_CHOOSEN_DISK -A $j:set:2 >/dev/null 2>/dev/null
+# fi
+# fi
+# done
+# fi
+#else
+## finding existent partitions in MS-DOS
+# echo 'MSDOS'
+# for PART in $PARTS; do
+# for (( i = 1; i < $COUNTER; i++ )); do
+# if [ $i -ne 4 ]; then
+# if [ ${PARTTBL["$SLX_CHOOSEN_DISK$i/exists"]} = 0 ]; then
+# sfdisk -d /dev/$SLX_CHOOSEN_DISK 2> /dev/null | grep $PART | tr -s ' ' | cut -d ' ' -f7 | grep ${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]} > /dev/null
+# if [ $? -eq 0 ]; then
+# echo "the partition $PART is the ${PARTTBL["$SLX_CHOOSEN_DISK$i/mountpoint"]} partition."
+# PARTTBL["$SLX_CHOOSEN_DISK$i/exists"]=$PART
+# NEEDED_SPACE=$(($NEEDED_SPACE-${PARTTBL["$SLX_CHOOSEN_DISK$i/size"]}*1024*1024*1024))
+# break
+# fi
+# fi
+# fi
+# done
+# done
+# echo "FREESPACE="$FREESPACE
+# echo "NEEDED_SPACE="$NEEDED_SPACE
+# if [[ $FREESPACE -lt $NEEDED_SPACE ]]; then
+# dialog --msgbox "ERROR: Insufficient free space in disk /dev/$SLX_CHOOSEN_DISK." 6 40
+# exit 1
+# fi
+#fi
diff --git a/vim.log b/vim.log
new file mode 100644
index 00000000..735a9340
--- /dev/null
+++ b/vim.log
@@ -0,0 +1,282 @@
+
+chdir(/usr/share/vim)
+fchdir() to previous dir
+sourcing "$VIM/vimrc"
+Searching for "debian.vim" in "/home/michael/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/home/michael/.vim/after"
+Searching for "/home/michael/.vim/debian.vim"
+Searching for "/usr/share/vim/vimfiles/debian.vim"
+Searching for "/usr/share/vim/vim74/debian.vim"
+chdir(/usr/share/vim/vim74)
+fchdir() to previous dir
+line 10: sourcing "/usr/share/vim/vim74/debian.vim"
+finished sourcing /usr/share/vim/vim74/debian.vim
+continuing in /usr/share/vim/vimrc
+Searching for "/usr/share/vim/vimfiles/after/debian.vim"
+Searching for "/home/michael/.vim/after/debian.vim"
+chdir(/usr/share/vim/vim74/syntax)
+fchdir() to previous dir
+line 20: sourcing "/usr/share/vim/vim74/syntax/syntax.vim"
+Searching for "syntax/synload.vim" in "/home/michael/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/michael/.vim/after"
+Searching for "/home/michael/.vim/syntax/synload.vim"
+Searching for "/var/lib/vim/addons/syntax/synload.vim"
+Searching for "/usr/share/vim/vimfiles/syntax/synload.vim"
+Searching for "/usr/share/vim/vim74/syntax/synload.vim"
+chdir(/usr/share/vim/vim74/syntax)
+fchdir() to previous dir
+line 19: sourcing "/usr/share/vim/vim74/syntax/synload.vim"
+Searching for "syntax/syncolor.vim" in "/home/michael/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/michael/.vim/after"
+Searching for "/home/michael/.vim/syntax/syncolor.vim"
+Searching for "/var/lib/vim/addons/syntax/syncolor.vim"
+Searching for "/usr/share/vim/vimfiles/syntax/syncolor.vim"
+Searching for "/usr/share/vim/vim74/syntax/syncolor.vim"
+chdir(/usr/share/vim/vim74/syntax)
+fchdir() to previous dir
+line 21: sourcing "/usr/share/vim/vim74/syntax/syncolor.vim"
+finished sourcing /usr/share/vim/vim74/syntax/syncolor.vim
+continuing in /usr/share/vim/vim74/syntax/synload.vim
+Searching for "/usr/share/vim/vimfiles/after/syntax/syncolor.vim"
+Searching for "/var/lib/vim/addons/after/syntax/syncolor.vim"
+Searching for "/home/michael/.vim/after/syntax/syncolor.vim"
+finished sourcing /usr/share/vim/vim74/syntax/synload.vim
+continuing in /usr/share/vim/vim74/syntax/syntax.vim
+Searching for "filetype.vim" in "/home/michael/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/michael/.vim/after"
+Searching for "/home/michael/.vim/filetype.vim"
+Searching for "/var/lib/vim/addons/filetype.vim"
+Searching for "/usr/share/vim/vimfiles/filetype.vim"
+Searching for "/usr/share/vim/vim74/filetype.vim"
+chdir(/usr/share/vim/vim74)
+fchdir() to previous dir
+line 25: sourcing "/usr/share/vim/vim74/filetype.vim"
+Searching for "ftdetect/*.vim" in "/home/michael/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/michael/.vim/after"
+Searching for "/home/michael/.vim/ftdetect/*.vim"
+Searching for "/var/lib/vim/addons/ftdetect/*.vim"
+Searching for "/usr/share/vim/vimfiles/ftdetect/*.vim"
+Searching for "/usr/share/vim/vim74/ftdetect/*.vim"
+Searching for "/usr/share/vim/vimfiles/after/ftdetect/*.vim"
+Searching for "/var/lib/vim/addons/after/ftdetect/*.vim"
+Searching for "/home/michael/.vim/after/ftdetect/*.vim"
+not found in 'runtimepath': "ftdetect/*.vim"
+finished sourcing /usr/share/vim/vim74/filetype.vim
+continuing in /usr/share/vim/vim74/syntax/syntax.vim
+Searching for "/usr/share/vim/vimfiles/after/filetype.vim"
+Searching for "/var/lib/vim/addons/after/filetype.vim"
+Searching for "/home/michael/.vim/after/filetype.vim"
+finished sourcing /usr/share/vim/vim74/syntax/syntax.vim
+continuing in /usr/share/vim/vimrc
+finished sourcing $VIM/vimrc
+chdir(/home/michael)
+fchdir() to previous dir
+sourcing "$HOME/.vimrc"
+Searching for "syntax/syncolor.vim" in "/home/michael/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/michael/.vim/after"
+Searching for "/home/michael/.vim/syntax/syncolor.vim"
+Searching for "/var/lib/vim/addons/syntax/syncolor.vim"
+Searching for "/usr/share/vim/vimfiles/syntax/syncolor.vim"
+Searching for "/usr/share/vim/vim74/syntax/syncolor.vim"
+chdir(/usr/share/vim/vim74/syntax)
+fchdir() to previous dir
+line 2: sourcing "/usr/share/vim/vim74/syntax/syncolor.vim"
+finished sourcing /usr/share/vim/vim74/syntax/syncolor.vim
+continuing in /home/michael/.vimrc
+Searching for "/usr/share/vim/vimfiles/after/syntax/syncolor.vim"
+Searching for "/var/lib/vim/addons/after/syntax/syncolor.vim"
+Searching for "/home/michael/.vim/after/syntax/syncolor.vim"
+Searching for "colors/xoria256.vim" in "/home/michael/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/michael/.vim/after"
+Searching for "/home/michael/.vim/colors/xoria256.vim"
+chdir(/home/michael/.vim/colors)
+fchdir() to previous dir
+line 2: sourcing "/home/michael/.vim/colors/xoria256.vim"
+Searching for "syntax/syncolor.vim" in "/home/michael/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/michael/.vim/after"
+Searching for "/home/michael/.vim/syntax/syncolor.vim"
+Searching for "/var/lib/vim/addons/syntax/syncolor.vim"
+Searching for "/usr/share/vim/vimfiles/syntax/syncolor.vim"
+Searching for "/usr/share/vim/vim74/syntax/syncolor.vim"
+chdir(/usr/share/vim/vim74/syntax)
+fchdir() to previous dir
+line 27: sourcing "/usr/share/vim/vim74/syntax/syncolor.vim"
+finished sourcing /usr/share/vim/vim74/syntax/syncolor.vim
+continuing in /home/michael/.vim/colors/xoria256.vim
+Searching for "/usr/share/vim/vimfiles/after/syntax/syncolor.vim"
+Searching for "/var/lib/vim/addons/after/syntax/syncolor.vim"
+Searching for "/home/michael/.vim/after/syntax/syncolor.vim"
+Searching for "syntax/syncolor.vim" in "/home/michael/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/michael/.vim/after"
+Searching for "/home/michael/.vim/syntax/syncolor.vim"
+Searching for "/var/lib/vim/addons/syntax/syncolor.vim"
+Searching for "/usr/share/vim/vimfiles/syntax/syncolor.vim"
+Searching for "/usr/share/vim/vim74/syntax/syncolor.vim"
+chdir(/usr/share/vim/vim74/syntax)
+fchdir() to previous dir
+line 29: sourcing "/usr/share/vim/vim74/syntax/syncolor.vim"
+finished sourcing /usr/share/vim/vim74/syntax/syncolor.vim
+continuing in /home/michael/.vim/colors/xoria256.vim
+Searching for "/usr/share/vim/vimfiles/after/syntax/syncolor.vim"
+Searching for "/var/lib/vim/addons/after/syntax/syncolor.vim"
+Searching for "/home/michael/.vim/after/syntax/syncolor.vim"
+Searching for "syntax/syncolor.vim" in "/home/michael/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/michael/.vim/after"
+Searching for "/home/michael/.vim/syntax/syncolor.vim"
+Searching for "/var/lib/vim/addons/syntax/syncolor.vim"
+Searching for "/usr/share/vim/vimfiles/syntax/syncolor.vim"
+Searching for "/usr/share/vim/vim74/syntax/syncolor.vim"
+chdir(/usr/share/vim/vim74/syntax)
+fchdir() to previous dir
+line 32: sourcing "/usr/share/vim/vim74/syntax/syncolor.vim"
+finished sourcing /usr/share/vim/vim74/syntax/syncolor.vim
+continuing in /home/michael/.vim/colors/xoria256.vim
+Searching for "/usr/share/vim/vimfiles/after/syntax/syncolor.vim"
+Searching for "/var/lib/vim/addons/after/syntax/syncolor.vim"
+Searching for "/home/michael/.vim/after/syntax/syncolor.vim"
+finished sourcing /home/michael/.vim/colors/xoria256.vim
+continuing in /home/michael/.vimrc
+chdir(/usr/share/vim/vim74/syntax)
+fchdir() to previous dir
+line 3: sourcing "/usr/share/vim/vim74/syntax/syntax.vim"
+chdir(/usr/share/vim/vim74/syntax)
+fchdir() to previous dir
+line 15: sourcing "/usr/share/vim/vim74/syntax/nosyntax.vim"
+finished sourcing /usr/share/vim/vim74/syntax/nosyntax.vim
+continuing in /usr/share/vim/vim74/syntax/syntax.vim
+Searching for "syntax/synload.vim" in "/home/michael/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/michael/.vim/after"
+Searching for "/home/michael/.vim/syntax/synload.vim"
+Searching for "/var/lib/vim/addons/syntax/synload.vim"
+Searching for "/usr/share/vim/vimfiles/syntax/synload.vim"
+Searching for "/usr/share/vim/vim74/syntax/synload.vim"
+chdir(/usr/share/vim/vim74/syntax)
+fchdir() to previous dir
+line 19: sourcing "/usr/share/vim/vim74/syntax/synload.vim"
+Searching for "colors/xoria256.vim" in "/home/michael/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/michael/.vim/after"
+Searching for "/home/michael/.vim/colors/xoria256.vim"
+chdir(/home/michael/.vim/colors)
+fchdir() to previous dir
+line 19: sourcing "/home/michael/.vim/colors/xoria256.vim"
+Searching for "syntax/syncolor.vim" in "/home/michael/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/michael/.vim/after"
+Searching for "/home/michael/.vim/syntax/syncolor.vim"
+Searching for "/var/lib/vim/addons/syntax/syncolor.vim"
+Searching for "/usr/share/vim/vimfiles/syntax/syncolor.vim"
+Searching for "/usr/share/vim/vim74/syntax/syncolor.vim"
+chdir(/usr/share/vim/vim74/syntax)
+fchdir() to previous dir
+line 29: sourcing "/usr/share/vim/vim74/syntax/syncolor.vim"
+finished sourcing /usr/share/vim/vim74/syntax/syncolor.vim
+continuing in /home/michael/.vim/colors/xoria256.vim
+Searching for "/usr/share/vim/vimfiles/after/syntax/syncolor.vim"
+Searching for "/var/lib/vim/addons/after/syntax/syncolor.vim"
+Searching for "/home/michael/.vim/after/syntax/syncolor.vim"
+Searching for "syntax/syncolor.vim" in "/home/michael/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/michael/.vim/after"
+Searching for "/home/michael/.vim/syntax/syncolor.vim"
+Searching for "/var/lib/vim/addons/syntax/syncolor.vim"
+Searching for "/usr/share/vim/vimfiles/syntax/syncolor.vim"
+Searching for "/usr/share/vim/vim74/syntax/syncolor.vim"
+chdir(/usr/share/vim/vim74/syntax)
+fchdir() to previous dir
+line 32: sourcing "/usr/share/vim/vim74/syntax/syncolor.vim"
+finished sourcing /usr/share/vim/vim74/syntax/syncolor.vim
+continuing in /home/michael/.vim/colors/xoria256.vim
+Searching for "/usr/share/vim/vimfiles/after/syntax/syncolor.vim"
+Searching for "/var/lib/vim/addons/after/syntax/syncolor.vim"
+Searching for "/home/michael/.vim/after/syntax/syncolor.vim"
+finished sourcing /home/michael/.vim/colors/xoria256.vim
+continuing in /usr/share/vim/vim74/syntax/synload.vim
+finished sourcing /usr/share/vim/vim74/syntax/synload.vim
+continuing in /usr/share/vim/vim74/syntax/syntax.vim
+finished sourcing /usr/share/vim/vim74/syntax/syntax.vim
+continuing in /home/michael/.vimrc
+finished sourcing $HOME/.vimrc
+Searching for "plugin/**/*.vim" in "/home/michael/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/michael/.vim/after"
+Searching for "/home/michael/.vim/plugin/**/*.vim"
+chdir(/home/michael/.vim/plugin)
+fchdir() to previous dir
+sourcing "/home/michael/.vim/plugin/detectindent.vim"
+finished sourcing /home/michael/.vim/plugin/detectindent.vim
+Searching for "/var/lib/vim/addons/plugin/**/*.vim"
+Searching for "/usr/share/vim/vimfiles/plugin/**/*.vim"
+Searching for "/usr/share/vim/vim74/plugin/**/*.vim"
+chdir(/usr/share/vim/vim74/plugin)
+fchdir() to previous dir
+sourcing "/usr/share/vim/vim74/plugin/getscriptPlugin.vim"
+finished sourcing /usr/share/vim/vim74/plugin/getscriptPlugin.vim
+chdir(/usr/share/vim/vim74/plugin)
+fchdir() to previous dir
+sourcing "/usr/share/vim/vim74/plugin/gzip.vim"
+finished sourcing /usr/share/vim/vim74/plugin/gzip.vim
+chdir(/usr/share/vim/vim74/plugin)
+fchdir() to previous dir
+sourcing "/usr/share/vim/vim74/plugin/matchparen.vim"
+finished sourcing /usr/share/vim/vim74/plugin/matchparen.vim
+chdir(/usr/share/vim/vim74/plugin)
+fchdir() to previous dir
+sourcing "/usr/share/vim/vim74/plugin/netrwPlugin.vim"
+finished sourcing /usr/share/vim/vim74/plugin/netrwPlugin.vim
+chdir(/usr/share/vim/vim74/plugin)
+fchdir() to previous dir
+sourcing "/usr/share/vim/vim74/plugin/rrhelper.vim"
+finished sourcing /usr/share/vim/vim74/plugin/rrhelper.vim
+chdir(/usr/share/vim/vim74/plugin)
+fchdir() to previous dir
+sourcing "/usr/share/vim/vim74/plugin/spellfile.vim"
+finished sourcing /usr/share/vim/vim74/plugin/spellfile.vim
+chdir(/usr/share/vim/vim74/plugin)
+fchdir() to previous dir
+sourcing "/usr/share/vim/vim74/plugin/tarPlugin.vim"
+finished sourcing /usr/share/vim/vim74/plugin/tarPlugin.vim
+chdir(/usr/share/vim/vim74/plugin)
+fchdir() to previous dir
+sourcing "/usr/share/vim/vim74/plugin/tohtml.vim"
+finished sourcing /usr/share/vim/vim74/plugin/tohtml.vim
+chdir(/usr/share/vim/vim74/plugin)
+fchdir() to previous dir
+sourcing "/usr/share/vim/vim74/plugin/vimballPlugin.vim"
+finished sourcing /usr/share/vim/vim74/plugin/vimballPlugin.vim
+chdir(/usr/share/vim/vim74/plugin)
+fchdir() to previous dir
+sourcing "/usr/share/vim/vim74/plugin/zipPlugin.vim"
+finished sourcing /usr/share/vim/vim74/plugin/zipPlugin.vim
+Searching for "/usr/share/vim/vimfiles/after/plugin/**/*.vim"
+Searching for "/var/lib/vim/addons/after/plugin/**/*.vim"
+Searching for "/home/michael/.vim/after/plugin/**/*.vim"
+Reading viminfo file "/home/michael/.viminfo" info oldfiles
+chdir(/home/michael/tm-scripts)
+fchdir() to previous dir
+ "vim.log"
+"vim.log" [noeol] 206L, 12288C
+Reading viminfo file "/home/michael/.viminfo" marks
+Searching for "scripts.vim" in "/home/michael/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/home/michael/.vim/after"
+Searching for "/home/michael/.vim/scripts.vim"
+chdir(/home/michael/.vim)
+fchdir() to previous dir
+line 0: sourcing "/home/michael/.vim/scripts.vim"
+finished sourcing /home/michael/.vim/scripts.vim
+continuing in BufRead Auto commands for "*"
+Searching for "/var/lib/vim/addons/scripts.vim"
+Searching for "/usr/share/vim/vimfiles/scripts.vim"
+Searching for "/usr/share/vim/vim74/scripts.vim"
+chdir(/usr/share/vim/vim74)
+fchdir() to previous dir
+line 0: sourcing "/usr/share/vim/vim74/scripts.vim"
+finished sourcing /usr/share/vim/vim74/scripts.vim
+continuing in BufRead Auto commands for "*"
+Searching for "/usr/share/vim/vimfiles/after/scripts.vim"
+Searching for "/var/lib/vim/addons/after/scripts.vim"
+Searching for "/home/michael/.vim/after/scripts.vim"
+; leading_tabs_num: 0, leading_spaces_num: 0, leading_spaces 1: 0, leading_spaces 2: 0, leading_spaces 3: 0, leading_spaces 4: 0, leading_spaces 5: 0, leading_spaces 6: 0, leading_spaces 7: 0, leading_spaces 8: 0
+/.vimrc
+
+/.vimrc
+
+/.vimrc
+
+/.vimrc
+
+/.vimrc
+
+/.vimrc
+
+/.vimrc
+
+/.vimrc
+
+/.vimrc
+-- INSERT --
+
+
+E492: Not an editor command: Q!
+
+Writing viminfo file "/home/michael/.viminfo" \ No newline at end of file