diff options
46 files changed, 1475 insertions, 212 deletions
diff --git a/doc/boot_config_vars b/doc/boot_config_vars index 36293d87..07866031 100644 --- a/doc/boot_config_vars +++ b/doc/boot_config_vars @@ -52,3 +52,34 @@ remote logging: SLX_REMOTE_LOG URL where to post log to, eg. 'http://server/log.php' POST variables: type, description, longdesc +partitioner & setp 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/beamergui/data/opt/openslx/vmchooser/sessionstart.d/99-kill_beamergui b/remote/modules/beamergui/data/opt/openslx/vmchooser/sessionstart.d/99-kill_beamergui index 13d9c4ed..1b4e61c8 100644..100755 --- a/remote/modules/beamergui/data/opt/openslx/vmchooser/sessionstart.d/99-kill_beamergui +++ b/remote/modules/beamergui/data/opt/openslx/vmchooser/sessionstart.d/99-kill_beamergui @@ -1,3 +1,3 @@ #!/bin/ash killall beamergui -true +exit 0 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/cpugovernor/data/etc/systemd/system/basic.target.wants/cpu-governor.service b/remote/modules/cpugovernor/data/etc/systemd/system/basic.target.wants/cpu-governor.service new file mode 120000 index 00000000..878a1676 --- /dev/null +++ b/remote/modules/cpugovernor/data/etc/systemd/system/basic.target.wants/cpu-governor.service @@ -0,0 +1 @@ +../cpu-governor.service
\ No newline at end of file diff --git a/remote/modules/cpugovernor/data/etc/systemd/system/cpu-governor.service b/remote/modules/cpugovernor/data/etc/systemd/system/cpu-governor.service new file mode 100644 index 00000000..e2ba1491 --- /dev/null +++ b/remote/modules/cpugovernor/data/etc/systemd/system/cpu-governor.service @@ -0,0 +1,6 @@ +[Unit] +Description=Sets the CPU governor + +[Service] +Type=oneshot +ExecStart=/opt/openslx/scripts/systemd-cpu_governor diff --git a/remote/modules/cpugovernor/data/opt/openslx/scripts/systemd-cpu_governor b/remote/modules/cpugovernor/data/opt/openslx/scripts/systemd-cpu_governor new file mode 100755 index 00000000..115163c7 --- /dev/null +++ b/remote/modules/cpugovernor/data/opt/openslx/scripts/systemd-cpu_governor @@ -0,0 +1,62 @@ +#!/bin/ash +# +# Script to set the CPU governor to ondemand on all cores +# + +# source global config +. /opt/openslx/config || \ + { echo "ERROR: Could not source /opt/openslx/config."; exit 1; } + +# set the governor to the one given in SLX_GOVERNOR +TARGET_GOVERNOR="" +if [ -n "$SLX_GOVERNOR" ]; then + TARGET_GOVERNOR="$SLX_GOVERNOR" +else + # use 'ondemand' per default + TARGET_GOVERNOR="ondemand" +fi +echo "Setting governor to $TARGET_GOVERNOR" +# global information needed +# CORES is the range of cores present, on bwpc4 it has the value '0-3' +# thus the split: MINCORE=0 MAXCORE=3 +CORES="$(cat /sys/devices/system/cpu/present)" +MINCORE="$(echo $CORES | awk -F "-" '{print $1}')" +MAXCORE="$(echo $CORES | awk -F "-" '{print $2}')" + +# Helper function 'test_for_gov' +# Usage: +# test_for_gov <governor> +# Example: +# test_for_gov "ondemand" +# Return 0 if it is supported by all cpus, 1 otherwise +test_for_gov() { + # if no argument is given, print error and exit (yes exit the whole script!) + [ $# -ne 1 ] && echo "Usage: test_for_gov <governor>. No arguments given!" && exit 1 + local GOVERNOR="$1" + + # check for each cpu just to be safe + # ash-style loop .... + local i=$MINCORE + while [ $i -le $MAXCORE ]; do + # check if the given governor is supported + grep -q "${GOVERNOR}" /sys/devices/system/cpu/cpu${i}/cpufreq/scaling_available_governors || return 1; + # increment + true $(( i++ )) + done + return 0; +} +# now actually test the cpus for the 'ondemand' cpu governor +if test_for_gov "${TARGET_GOVERNOR}"; then + # ok, so now set the governor to 'ondemand' for all cores + i=$MINCORE + while [ $i -le $MAXCORE ]; do + if ! echo "${TARGET_GOVERNOR}" > /sys/devices/system/cpu/cpu${i}/cpufreq/scaling_governor; then + echo "ERROR: Could not set the cpu governor to '${TARGET_GOVERNOR}'!" + exit 1 + fi + true $(( i++ )) + done +else + echo "ERROR: '${TARGET_GOVERNOR}' is not supported by this machine!" + exit 1 +fi diff --git a/remote/modules/cpugovernor/module.build b/remote/modules/cpugovernor/module.build new file mode 100644 index 00000000..97e93235 --- /dev/null +++ b/remote/modules/cpugovernor/module.build @@ -0,0 +1,11 @@ +fetch_source() { + : +} + +build() { + : +} + +post_copy() { + : +} diff --git a/remote/modules/cpugovernor/module.conf b/remote/modules/cpugovernor/module.conf new file mode 100644 index 00000000..0cd03752 --- /dev/null +++ b/remote/modules/cpugovernor/module.conf @@ -0,0 +1,3 @@ +REQUIRED_BINARIES="" +REQUIRED_LIBRARIES="" +REQUIRED_DIRECTORIES="" diff --git a/remote/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx b/remote/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx index 66ab2189..dd8cd8ba 100755 --- a/remote/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx +++ b/remote/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx @@ -78,7 +78,7 @@ case "$1" in fi # get domain, hostname and thus fqdn from DNS - dns_fqdn=$(rdns "$ip") + dns_fqdn=$(/opt/openslx/bin/busybox timeout -t 3 rdns "$ip") dns_short="${dns_fqdn%%.*}" # check if it is fqdn if [ "$dns_fqdn" == "$dns_short" ]; then 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/pvs2/data/opt/openslx/vmchooser/sessionstart.d/50-PVSclient b/remote/modules/pvs2/data/opt/openslx/vmchooser/sessionstart.d/50-PVSclient index bef2449b..7b28889d 100644..100755 --- a/remote/modules/pvs2/data/opt/openslx/vmchooser/sessionstart.d/50-PVSclient +++ b/remote/modules/pvs2/data/opt/openslx/vmchooser/sessionstart.d/50-PVSclient @@ -2,9 +2,8 @@ # If the ENV var PVS has been set by vmchooser start pvsclient if [ -n "$PVS_AUTO_CONNECT" -a "$PVS_AUTO_CONNECT" == "TRUE" ]; then - pvsclient --auto & - else - pvsclient & - fi + pvsclient --auto & +else + pvsclient & fi - +exit 0 diff --git a/server/modules/pvs2mgr-freiburg/opt/openslx/xsessions/default.desktop b/remote/modules/pvs2/data/opt/openslx/xsessions/pvs2mgr.desktop index b718716a..dbe80eb3 100755 --- a/server/modules/pvs2mgr-freiburg/opt/openslx/xsessions/default.desktop +++ b/remote/modules/pvs2/data/opt/openslx/xsessions/pvs2mgr.desktop @@ -1,9 +1,7 @@ [Desktop Entry] Encoding=UTF-8 -Name=PVS MNGR -Name[de]=PVS -Comment=PVS TEST -Comment[de]=PVS TEST +Name=PVS Steuerkonsole +Name[de]=PVS Steuerkonsole Exec=/opt/openslx/scripts/setup-pvsmgr TryExec=/opt/openslx/bin/pvsmgr Icon= 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/modules/vbox/data/opt/openslx/scripts/vmchooser-xml_filter b/remote/modules/vbox/data/opt/openslx/scripts/vmchooser-xml_filter deleted file mode 100755 index c50b01a5..00000000 --- a/remote/modules/vbox/data/opt/openslx/scripts/vmchooser-xml_filter +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -# Probably needs bash somewhere -# ----------------------------------------------------------------------------- -# Copyright (c) 2007..2009 - RZ Uni FR -# Copyright (c) 2007..2011 - 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 suggestions, praise, or complaints to feedback@openslx.org -# -# General information about OpenSLX can be found at http://openslx.org/ -# ----------------------------------------------------------------------------- -# xmlfilter.sh -# - This script is invoked by the vmchooser tool. It simply filters xml- -# files (taking the path to these files in $1). You might modify it in any -# way to match your needs, e.g. ask some database instead. You can re- -# implement it in any other programming language too. You simply have to -# return a list of proper xml files to be interpreted by the vmchooser -# binary). Please check for vmchooser.sh too ... -# ----------------------------------------------------------------------------- - -# This script . -# -# currently: -# - filter for slxgrp (which comes from /etc/machine-setup) -# - -# include default directories -. /opt/openslx/config - -if [ -f "${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser/vmchooser.conf" ]; then - . "${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser/vmchooser.conf" -fi - -function handlePersistentVM() { - if grep --extended-regexp -q "<persistent param=\"(|.+:)$USER(|:.+)\"" "$1"; then - # If this virtual machine is useable as persistent version for current - # user we provide an additional persistent version. - # TODO: This evil black magic needs to be rewritten some day (by someone who understands it) - local originalImagePath=$(grep -io '<image_name param=.*"' "$1" | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }') - local imageName=$(basename "$originalImagePath") - eval export SLX_VM_PERSISTENT_PATH="${SLX_VM_PERSISTENT_PATH}" && \ - local imagePath="${SLX_VM_PERSISTENT_PATH}${imageName}" - local persistentConfigVersionFilePath="$(mktemp --directory)/$(basename "$1")" - local vmchooserFilePath="$(dirname "$0")/vmchooser-clc" - if [ ! -f "$vmchooserFilePath" ]; then - vmchooserFilePath='/opt/openslx/scripts/vmchooser-clc' - fi - "$vmchooserFilePath" "$1" "$persistentConfigVersionFilePath" \ - --create-persistent-config "$imagePath" && \ - echo "$persistentConfigVersionFilePath" - fi -} - -for FILE in $(find -L "$1" -iname "*.xml"); do - # filter all xmls which aren't set active - grep -i -q "<active param=.*true.*" "$FILE" || continue - # HACK: filter all virtualbox images, as vbox is not ready yet - #grep -i -q "<virtualmachine param=.*virtualbox.*" "$FILE" && continue - if [ -n "${SLX_VM_POOL_FILTER}" ]; then - # filter all xmls with pool-param not equal to vmchooser::env - if [ $(grep "<pools param=\"${SLX_VM_POOL_FILTER}\"" "$FILE" | wc -l) -eq 1 ]; then - handlePersistentVM "$FILE" - echo "$FILE" - fi - else - handlePersistentVM "$FILE" - # if there is no pool set, just take all available xmls - echo "$FILE" - fi -done - diff --git a/remote/modules/vmchooser2/data/opt/openslx/vmchooser/sessionstart b/remote/modules/vmchooser2/data/opt/openslx/vmchooser/sessionstart index 86511458..be3235c1 100755 --- a/remote/modules/vmchooser2/data/opt/openslx/vmchooser/sessionstart +++ b/remote/modules/vmchooser2/data/opt/openslx/vmchooser/sessionstart @@ -4,7 +4,7 @@ SOURCEPATH="/opt/openslx/vmchooser/sessionstart.d" if [ -d "$SOURCEPATH" ]; then for file in $SOURCEPATH/*; do - . "$file" || slxlog "vmchooser-sessionstart" "Could not source $file at session start!" "$file" + "$file" || slxlog "vmchooser-sessionstart" "Could not source $file at session start!" "$file" done fi diff --git a/remote/rootfs/rootfs-stage31/data/inc/activate_sysconfig b/remote/rootfs/rootfs-stage31/data/inc/activate_sysconfig index eb0e6d99..858102d2 100644 --- a/remote/rootfs/rootfs-stage31/data/inc/activate_sysconfig +++ b/remote/rootfs/rootfs-stage31/data/inc/activate_sysconfig @@ -37,7 +37,6 @@ fetch_config_files() { update_sysconfig() { # sanity checks [ ! -e "${CONFIG}" ] && { echo "Cannot update. '$CONFIG' does not exist."; return 1; } - [ ! -e "${CONFIG}.tgz" ] && { echo "Cannot update. '$CONFIG' does not exist."; return 1; } # write IP and SLX_SERVER configuration to $CONFIG cat >> "$CONFIG" <<HEREEND @@ -49,6 +48,8 @@ SLX_PXE_DNS='$DNS_SERVER' SLX_PXE_MAC='$BRIDGEMAC' HEREEND + [ ! -e "${CONFIG}.tgz" ] && { echo "Cannot update. '$CONFIG' does not exist."; return 1; } + # setup hardware clock . "${CONFIG}" if [ "x$SLX_BIOS_CLOCK" == "xlocal" ]; then diff --git a/remote/rootfs/rootfs-stage31/data/inc/udhcpc-trigger b/remote/rootfs/rootfs-stage31/data/inc/udhcpc-trigger index dfed3168..02987f21 100755 --- a/remote/rootfs/rootfs-stage31/data/inc/udhcpc-trigger +++ b/remote/rootfs/rootfs-stage31/data/inc/udhcpc-trigger @@ -59,7 +59,7 @@ done if [ -z "$domain" ]; then # try to get domain via reverse lookup if empty echo "..trying to get domain via DNS, as DHCP didn't supply one.." - fqdn=$(nslookup "$ip" | grep -E "^Address +[0-9]+: +$ip " | head -n 1 | awk '{print $4}') + fqdn=$(timeout -t 3 nslookup "$ip" | grep -E "^Address +[0-9]+: +$ip " | head -n 1 | awk '{print $4}') domain="${fqdn#*.}" fi if [ -n "$domain" ]; then @@ -76,7 +76,7 @@ fi if [ -z "$hostname" ]; then # as with domain, if there's no hostname, try to get via DNS echo "..trying to get hostname via DNS, as DHCP didn't supply one.." - [ -z "$fqdn" ] && fqdn=$(nslookup "$ip" | grep -E "^Address +[0-9]+: +$ip " | head -n 1 | awk '{print $4}') + [ -z "$fqdn" ] && fqdn=$(timeout -t 3 nslookup "$ip" | grep -E "^Address +[0-9]+: +$ip " | head -n 1 | awk '{print $4}') hostname="${fqdn%%.*}" elif [ -n "$domain" ]; then fqdn="${hostname}.${domain%% *}" # in case domain is a list 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/module.conf b/remote/rootfs/rootfs-stage32/module.conf index 4e1350a6..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,11 @@ REQUIRED_BINARIES=" getent ldconfig grep + sfdisk + sgdisk + dialog + useradd + patch wget " REQUIRED_LIBRARIES=" 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/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/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-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/cups-freiburg/etc/cups/ppd/ZRZ_DELL.ppd b/server/modules/cups-freiburg/etc/cups/ppd/ZRZ_DELL.ppd index 6e042097..c66e36d1 100644 --- a/server/modules/cups-freiburg/etc/cups/ppd/ZRZ_DELL.ppd +++ b/server/modules/cups-freiburg/etc/cups/ppd/ZRZ_DELL.ppd @@ -5,13 +5,13 @@ *% *% This file is published under the GNU General Public License *% -*% PPD-O-MATIC (3.0.0 or newer) generated this PPD file. It is for use with +*% PPD-O-MATIC (4.0.0 or newer) generated this PPD file. It is for use with *% all programs and environments which use PPD files for dealing with *% printer capability information. The printer must be configured with the -*% "foomatic-rip" backend filter script of Foomatic 3.0.0 or newer. This +*% "foomatic-rip" backend filter script of Foomatic 4.0.0 or newer. This *% file and "foomatic-rip" work together to support PPD-controlled printer -*% driver option access with arbitrary free software printer drivers and -*% printing spoolers. +*% driver option access with all supported printer drivers and printing +*% spoolers. *% *% To save this file on your disk, wait until the download has completed *% (the animation of the browser logo must stop) and then use the @@ -20,24 +20,25 @@ *% DO NOT cut and paste this file into an editor with your mouse. This can *% introduce additional line breaks which lead to unexpected results. *% -*% You may save this file as 'Dell-3100cn-Postscript.ppd' +*% You may save this file as 'Dell-3100cn-pxlcolor.ppd' *% *% *FormatVersion: "4.3" *FileVersion: "1.1" *LanguageVersion: English *LanguageEncoding: ISOLatin1 -*PCFileName: "POSTSCRI.PPD" +*PCFileName: "PXLCOLOR.PPD" *Manufacturer: "Dell" *Product: "(Laser Printer 3100cn)" *cupsVersion: 1.0 *cupsManualCopies: True *cupsModelNumber: 2 -*cupsFilter: "application/vnd.cups-postscript 0 foomatic-rip" +*cupsFilter: "application/vnd.cups-postscript 100 foomatic-rip" +*cupsFilter: "application/vnd.cups-pdf 0 foomatic-rip" *%pprRIP: foomatic-rip other *ModelName: "Dell 3100cn" -*ShortNickName: "Dell 3100cn Postscript" -*NickName: "Dell 3100cn Foomatic/Postscript" +*ShortNickName: "Dell 3100cn pxlcolor" +*NickName: "Dell 3100cn Foomatic/pxlcolor (recommended)" *PSVersion: "(3010.000) 550" *PSVersion: "(3010.000) 651" *PSVersion: "(3010.000) 652" @@ -45,6 +46,14 @@ *PSVersion: "(3010.000) 704" *PSVersion: "(3010.000) 705" *PSVersion: "(3010.000) 800" +*PSVersion: "(3010.000) 815" +*PSVersion: "(3010.000) 850" +*PSVersion: "(3010.000) 860" +*PSVersion: "(3010.000) 861" +*PSVersion: "(3010.000) 862" +*PSVersion: "(3010.000) 863" +*PSVersion: "(3010.000) 864" +*PSVersion: "(3010.000) 870" *LanguageLevel: "3" *ColorDevice: True *DefaultColorSpace: RGB @@ -52,63 +61,151 @@ *Throughput: "1" *LandscapeOrientation: Plus90 *TTRasterizer: Type42 -*1284DeviceID: "MFG:Dell;MDL:Laser Printer 3100cn;CMD:PJL,RASTER,DOWNLOAD,PCLXL,PCL,POSTSCRIPT;DES:Dell Laser Printer 3100cn;DRV:DPostscript,R0,M0,TP;" +*1284DeviceID: "MFG:Dell;MDL:Laser Printer 3100cn;CMD:PJL,RASTER,DOWNLOAD,PCLXL,PCL,POSTSCRIPT;DES:Dell Laser Printer 3100cn;DRV:Dpxlcolor,R1,M0,TG;" -*driverName Postscript/Postscript: "" -*driverType P/PostScript: "" -*driverUrl: "http://partners.adobe.com/public/developer/ps/index_specs.html" +*driverName pxlcolor: "" +*driverType G/Ghostscript built-in: "" +*driverUrl: "http://www.ghostscript.com/" *driverObsolete: False +*driverManufacturerSupplied: False +*DefaultResolution: 1200dpi -*VariablePaperSize: False +*HWMargins: 18 36 18 36 +*VariablePaperSize: True +*MaxMediaWidth: 100000 +*MaxMediaHeight: 100000 +*NonUIOrderDependency: 100 AnySetup *CustomPageSize +*CustomPageSize True: "pop pop pop pop pop +%% FoomaticRIPOptionSetting: PageSize=Custom" +*End +*FoomaticRIPOptionSetting PageSize=Custom: " -dDEVICEWIDTHPOINTS=0 -dD&& +EVICEHEIGHTPOINTS=0" +*End +*ParamCustomPageSize Width: 1 points 36 100000 +*ParamCustomPageSize Height: 2 points 36 100000 +*ParamCustomPageSize Orientation: 3 int 0 0 +*ParamCustomPageSize WidthOffset: 4 points 0 0 +*ParamCustomPageSize HeightOffset: 5 points 0 0 -*FoomaticIDs: Dell-3100cn Postscript -*FoomaticRIPCommandLine: "/opt/openslx/bin/cat%A%B%Z" -*FoomaticRIPNoPageAccounting: True +*FoomaticIDs: Dell-3100cn pxlcolor +*FoomaticRIPCommandLine: "gs -q -dBATCH -dPARANOIDSAFER -dNOPAUSE -dNO&& +INTERPOLATE%B%A%Z -sOutputFile=- -" +*End *OpenGroup: General/General +*OpenUI *PrintoutMode/Print Quality: PickOne +*FoomaticRIPOption PrintoutMode: enum Composite A +*OrderDependency: 10 AnySetup *PrintoutMode +*DefaultPrintoutMode: Normal +*PrintoutMode Draft/Draft: "%% FoomaticRIPOptionSetting: PrintoutMode=Draft" +*FoomaticRIPOptionSetting PrintoutMode=Draft: "PrinterResolution=600x6&& +00dpi ColorModel=Color" +*End +*PrintoutMode Draft.Gray/Draft Grayscale: "%% FoomaticRIPOptionSetting: PrintoutMode=Draft.Gray" +*FoomaticRIPOptionSetting PrintoutMode=Draft.Gray: "PrinterResolution=&& +600x600dpi ColorModel=Grayscale" +*End +*PrintoutMode Normal/Normal: "%% FoomaticRIPOptionSetting: PrintoutMode=Normal" +*FoomaticRIPOptionSetting PrintoutMode=Normal: "PrinterResolution=600x&& +600dpi ColorModel=Color" +*End +*PrintoutMode Normal.Gray/Normal Grayscale: "%% FoomaticRIPOptionSetting: PrintoutMode=Normal.Gray" +*FoomaticRIPOptionSetting PrintoutMode=Normal.Gray: "PrinterResolution&& +=600x600dpi ColorModel=Grayscale" +*End +*PrintoutMode High/High Quality: "%% FoomaticRIPOptionSetting: PrintoutMode=High" +*FoomaticRIPOptionSetting PrintoutMode=High: "PrinterResolution=1200x1&& +200dpi ColorModel=Color" +*End +*PrintoutMode High.Gray/High Quality Grayscale: "%% FoomaticRIPOptionSetting: PrintoutMode=High.Gray" +*FoomaticRIPOptionSetting PrintoutMode=High.Gray: "PrinterResolution=1&& +200x1200dpi ColorModel=Grayscale" +*End +*CloseUI: *PrintoutMode + *OpenUI *PageSize/Page Size: PickOne +*FoomaticRIPOption PageSize: enum CmdLine A *OrderDependency: 100 AnySetup *PageSize *DefaultPageSize: A4 -*PageSize A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice" -*PageSize Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice" -*PageSize 11x17/11x17: "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice" -*PageSize A3/A3: "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice" -*PageSize A5/A5: "<</PageSize[421 595]/ImagingBBox null>>setpagedevice" -*PageSize B5/B5 (JIS): "<</PageSize[516 729]/ImagingBBox null>>setpagedevice" -*PageSize Env10/Envelope #10: "<</PageSize[297 684]/ImagingBBox null>>setpagedevice" -*PageSize EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice" -*PageSize EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice" -*PageSize EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice" -*PageSize EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice" -*PageSize Executive/Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice" -*PageSize Legal/US Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice" +*PageSize Letter/US Letter: "%% FoomaticRIPOptionSetting: PageSize=Letter" +*FoomaticRIPOptionSetting PageSize=Letter: " -dDEVICEWIDTHPOINTS=612 -&& +dDEVICEHEIGHTPOINTS=792" +*End +*PageSize A4/A4: "%% FoomaticRIPOptionSetting: PageSize=A4" +*FoomaticRIPOptionSetting PageSize=A4: " -dDEVICEWIDTHPOINTS=595 -dDEV&& +ICEHEIGHTPOINTS=842" +*End +*PageSize 11x17/11x17: "%% FoomaticRIPOptionSetting: PageSize=11x17" +*FoomaticRIPOptionSetting PageSize=11x17: " -dDEVICEWIDTHPOINTS=792 -d&& +DEVICEHEIGHTPOINTS=1224" +*End +*PageSize A3/A3: "%% FoomaticRIPOptionSetting: PageSize=A3" +*FoomaticRIPOptionSetting PageSize=A3: " -dDEVICEWIDTHPOINTS=842 -dDEV&& +ICEHEIGHTPOINTS=1191" +*End +*PageSize A5/A5: "%% FoomaticRIPOptionSetting: PageSize=A5" +*FoomaticRIPOptionSetting PageSize=A5: " -dDEVICEWIDTHPOINTS=421 -dDEV&& +ICEHEIGHTPOINTS=595" +*End +*PageSize B5/B5 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B5" +*FoomaticRIPOptionSetting PageSize=B5: " -dDEVICEWIDTHPOINTS=516 -dDEV&& +ICEHEIGHTPOINTS=729" +*End +*PageSize Env10/Envelope #10: "%% FoomaticRIPOptionSetting: PageSize=Env10" +*FoomaticRIPOptionSetting PageSize=Env10: " -dDEVICEWIDTHPOINTS=297 -d&& +DEVICEHEIGHTPOINTS=684" +*End +*PageSize EnvC5/Envelope C5: "%% FoomaticRIPOptionSetting: PageSize=EnvC5" +*FoomaticRIPOptionSetting PageSize=EnvC5: " -dDEVICEWIDTHPOINTS=459 -d&& +DEVICEHEIGHTPOINTS=649" +*End +*PageSize EnvDL/Envelope DL: "%% FoomaticRIPOptionSetting: PageSize=EnvDL" +*FoomaticRIPOptionSetting PageSize=EnvDL: " -dDEVICEWIDTHPOINTS=312 -d&& +DEVICEHEIGHTPOINTS=624" +*End +*PageSize EnvISOB5/Envelope B5: "%% FoomaticRIPOptionSetting: PageSize=EnvISOB5" +*FoomaticRIPOptionSetting PageSize=EnvISOB5: " -dDEVICEWIDTHPOINTS=499&& + -dDEVICEHEIGHTPOINTS=709" +*End +*PageSize EnvMonarch/Envelope Monarch: "%% FoomaticRIPOptionSetting: PageSize=EnvMonarch" +*FoomaticRIPOptionSetting PageSize=EnvMonarch: " -dDEVICEWIDTHPOINTS=2&& +79 -dDEVICEHEIGHTPOINTS=540" +*End +*PageSize Executive/Executive: "%% FoomaticRIPOptionSetting: PageSize=Executive" +*FoomaticRIPOptionSetting PageSize=Executive: " -dDEVICEWIDTHPOINTS=52&& +2 -dDEVICEHEIGHTPOINTS=756" +*End +*PageSize Legal/US Legal: "%% FoomaticRIPOptionSetting: PageSize=Legal" +*FoomaticRIPOptionSetting PageSize=Legal: " -dDEVICEWIDTHPOINTS=612 -d&& +DEVICEHEIGHTPOINTS=1008" +*End *CloseUI: *PageSize *OpenUI *PageRegion: PickOne *OrderDependency: 100 AnySetup *PageRegion *DefaultPageRegion: A4 -*PageRegion A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice" -*PageRegion Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice" -*PageRegion 11x17/11x17: "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice" -*PageRegion A3/A3: "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice" -*PageRegion A5/A5: "<</PageSize[421 595]/ImagingBBox null>>setpagedevice" -*PageRegion B5/B5 (JIS): "<</PageSize[516 729]/ImagingBBox null>>setpagedevice" -*PageRegion Env10/Envelope #10: "<</PageSize[297 684]/ImagingBBox null>>setpagedevice" -*PageRegion EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice" -*PageRegion EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice" -*PageRegion EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice" -*PageRegion EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice" -*PageRegion Executive/Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice" -*PageRegion Legal/US Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice" +*PageRegion Letter/US Letter: "%% FoomaticRIPOptionSetting: PageSize=Letter" +*PageRegion A4/A4: "%% FoomaticRIPOptionSetting: PageSize=A4" +*PageRegion 11x17/11x17: "%% FoomaticRIPOptionSetting: PageSize=11x17" +*PageRegion A3/A3: "%% FoomaticRIPOptionSetting: PageSize=A3" +*PageRegion A5/A5: "%% FoomaticRIPOptionSetting: PageSize=A5" +*PageRegion B5/B5 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B5" +*PageRegion Env10/Envelope #10: "%% FoomaticRIPOptionSetting: PageSize=Env10" +*PageRegion EnvC5/Envelope C5: "%% FoomaticRIPOptionSetting: PageSize=EnvC5" +*PageRegion EnvDL/Envelope DL: "%% FoomaticRIPOptionSetting: PageSize=EnvDL" +*PageRegion EnvISOB5/Envelope B5: "%% FoomaticRIPOptionSetting: PageSize=EnvISOB5" +*PageRegion EnvMonarch/Envelope Monarch: "%% FoomaticRIPOptionSetting: PageSize=EnvMonarch" +*PageRegion Executive/Executive: "%% FoomaticRIPOptionSetting: PageSize=Executive" +*PageRegion Legal/US Legal: "%% FoomaticRIPOptionSetting: PageSize=Legal" *CloseUI: *PageRegion *DefaultImageableArea: A4 -*ImageableArea A4/A4: "18 36 577 806" *ImageableArea Letter/US Letter: "18 36 594 756" +*ImageableArea A4/A4: "18 36 577 806" *ImageableArea 11x17/11x17: "18 36 774 1188" *ImageableArea A3/A3: "18 36 824 1155" *ImageableArea A5/A5: "18 36 403 559" @@ -122,8 +219,8 @@ *ImageableArea Legal/US Legal: "18 36 594 972" *DefaultPaperDimension: A4 -*PaperDimension A4/A4: "595 842" *PaperDimension Letter/US Letter: "612 792" +*PaperDimension A4/A4: "595 842" *PaperDimension 11x17/11x17: "792 1224" *PaperDimension A3/A3: "842 1191" *PaperDimension A5/A5: "421 595" @@ -136,25 +233,70 @@ *PaperDimension Executive/Executive: "522 756" *PaperDimension Legal/US Legal: "612 1008" -*OpenUI *Resolution/Resolution: PickOne -*OrderDependency: 110 AnySetup *Resolution -*DefaultResolution: Unknown -*Resolution 150x150dpi/150 DPI: "<</HWResolution[150 150]>>setpagedevice" -*Resolution 300x300dpi/300 DPI: "<</HWResolution[300 300]>>setpagedevice" -*Resolution 600x600dpi/600 DPI: "<</HWResolution[600 600]>>setpagedevice" -*Resolution 1200x1200dpi/1200 DPI: "<</HWResolution[1200 1200]>>setpagedevice" -*CloseUI: *Resolution +*OpenUI *InputSlot/Media Source: PickOne +*FoomaticRIPOption InputSlot: enum CmdLine A +*OrderDependency: 100 AnySetup *InputSlot +*DefaultInputSlot: Default +*InputSlot Default/Printer Default: "%% FoomaticRIPOptionSetting: InputSlot=Default" +*FoomaticRIPOptionSetting InputSlot=Default: " -dMediaPosition=0" +*InputSlot Upper/Upper Tray: "%% FoomaticRIPOptionSetting: InputSlot=Upper" +*FoomaticRIPOptionSetting InputSlot=Upper: " -dMediaPosition=4" +*InputSlot Middle/Middle Tray: "%% FoomaticRIPOptionSetting: InputSlot=Middle" +*FoomaticRIPOptionSetting InputSlot=Middle: " -dMediaPosition=5" +*InputSlot Lower/Lower Tray: "%% FoomaticRIPOptionSetting: InputSlot=Lower" +*FoomaticRIPOptionSetting InputSlot=Lower: " -dMediaPosition=6" +*InputSlot Multipurpose/Multipurpose Tray: "%% FoomaticRIPOptionSetting: InputSlot=Multipurpose" +*FoomaticRIPOptionSetting InputSlot=Multipurpose: " -dMediaPosition=3" +*InputSlot Automatic/Automatic: "%% FoomaticRIPOptionSetting: InputSlot=Automatic" +*FoomaticRIPOptionSetting InputSlot=Automatic: " -dMediaPosition=1" +*InputSlot Manual/Manual Feeder: "%% FoomaticRIPOptionSetting: InputSlot=Manual" +*FoomaticRIPOptionSetting InputSlot=Manual: " -dMediaPosition=2" +*CloseUI: *InputSlot *OpenUI *Duplex/Double-Sided Printing: PickOne -*OrderDependency: 130 AnySetup *Duplex -*DefaultDuplex: DuplexTumble -*Duplex DuplexNoTumble/Long Edge (Standard): "<</Duplex true /Tumble false>>setpagedevice" -*Duplex DuplexTumble/Short Edge (Flip): "<</Duplex true /Tumble true>>setpagedevice" -*Duplex None/Off: "<</Duplex false>>setpagedevice" +*FoomaticRIPOption Duplex: enum CmdLine A +*OrderDependency: 100 AnySetup *Duplex +*DefaultDuplex: None +*Duplex DuplexNoTumble/On (Flip on Long Edge): "%% FoomaticRIPOptionSetting: Duplex=DuplexNoTumble" +*FoomaticRIPOptionSetting Duplex=DuplexNoTumble: " -dDuplex" +*Duplex DuplexTumble/On (Flip on Short Edge): "%% FoomaticRIPOptionSetting: Duplex=DuplexTumble" +*FoomaticRIPOptionSetting Duplex=DuplexTumble: " -dDuplex -dTumble" +*Duplex None/Off: "%% FoomaticRIPOptionSetting: Duplex=None" +*FoomaticRIPOptionSetting Duplex=None: "" *CloseUI: *Duplex *CloseGroup: General +*OpenGroup: PrintoutMode/Printout Mode + +*OpenUI *ColorModel/Color Mode: PickOne +*FoomaticRIPOption ColorModel: enum CmdLine B +*OrderDependency: 100 AnySetup *ColorModel +*DefaultColorModel: FromPrintoutMode +*ColorModel FromPrintoutMode/Controlled by 'Print Quality': "%% FoomaticRIPOptionSetting: ColorModel=@PrintoutMode" +*ColorModel Color/Color: "%% FoomaticRIPOptionSetting: ColorModel=Color" +*FoomaticRIPOptionSetting ColorModel=Color: " -sDEVICE=pxlcolor" +*ColorModel Grayscale/Monochrome: "%% FoomaticRIPOptionSetting: ColorModel=Grayscale" +*FoomaticRIPOptionSetting ColorModel=Grayscale: " -sDEVICE=pxlmono" +*CloseUI: *ColorModel + +*OpenUI *PrinterResolution/Resolution: PickOne +*FoomaticRIPOption PrinterResolution: enum CmdLine A +*OrderDependency: 100 AnySetup *PrinterResolution +*DefaultPrinterResolution: FromPrintoutMode +*PrinterResolution FromPrintoutMode/Controlled by 'Print Quality': "%% FoomaticRIPOptionSetting: PrinterResolution=@PrintoutMode" +*PrinterResolution 300x300dpi/300x300 DPI: "%% FoomaticRIPOptionSetting: PrinterResolution=300x300dpi" +*FoomaticRIPOptionSetting PrinterResolution=300x300dpi: " -r300x300" +*PrinterResolution 600x600dpi/600x600 DPI: "%% FoomaticRIPOptionSetting: PrinterResolution=600x600dpi" +*FoomaticRIPOptionSetting PrinterResolution=600x600dpi: " -r600x600" +*PrinterResolution 1200x1200dpi/1200x1200 DPI: "%% FoomaticRIPOptionSetting: PrinterResolution=1200x1200dpi" +*FoomaticRIPOptionSetting PrinterResolution=1200x1200dpi: " -r1200x120&& +0" +*End +*CloseUI: *PrinterResolution + +*CloseGroup: PrintoutMode + *% Generic boilerplate PPD stuff as standard PostScript fonts and so on @@ -195,3 +337,4 @@ *Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM *Font ZapfDingbats: Special "(001.004S)" Standard ROM + 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..3d9801ca --- /dev/null +++ b/server/modules/dnbd3-cache/opt/openslx/dnbd3-cache/alt-servers @@ -0,0 +1 @@ +-200.17.202.46 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/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/pam-freiburg/opt/openslx/scripts/pam_script_mount_persistent b/server/modules/pam-freiburg/opt/openslx/scripts/pam_script_mount_persistent index 7961f561..dbe6ef01 100644 --- a/server/modules/pam-freiburg/opt/openslx/scripts/pam_script_mount_persistent +++ b/server/modules/pam-freiburg/opt/openslx/scripts/pam_script_mount_persistent @@ -25,7 +25,7 @@ if ! grep -q "^${PAM_USER}:" "/etc/passwd"; then SIGNAL=$(mktemp) MOUNT_OUTPUT=$(mktemp) rm -f -- "${SIGNAL}" - ( mount ${MOUNT_OPTS} "${CIFS_VOLUME}" "${PERSISTENT_HOME_DIR}" > "$MOUNT_OUTPUT" 2>&1 || touch "${SIGNAL}" ) & + ( mount -v ${MOUNT_OPTS} "${CIFS_VOLUME}" "${PERSISTENT_HOME_DIR}" > "$MOUNT_OUTPUT" 2>&1 || touch "${SIGNAL}" ) & MOUNT_PID=$! for COUNTER in 1 2 4 4; do kill -0 "${MOUNT_PID}" 2>/dev/null || break @@ -78,7 +78,7 @@ if ! grep -q "^${PAM_USER}:" "/etc/passwd"; then SIGNAL=$(mktemp) MOUNT_OUTPUT=$(mktemp) rm -f -- "${SIGNAL}" - ( mount ${MOUNT_OPTS} "${FILESERVER}:${VOLUME}" "${PERSISTENT_HOME_DIR}" > "$MOUNT_OUTPUT" 2>&1 || touch "${SIGNAL}" ) & + ( mount -v ${MOUNT_OPTS} "${FILESERVER}:${VOLUME}" "${PERSISTENT_HOME_DIR}" > "$MOUNT_OUTPUT" 2>&1 || touch "${SIGNAL}" ) & MOUNT_PID=$! for COUNTER in 1 2 4 4; do kill -0 "${MOUNT_PID}" 2>/dev/null || break 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/server/modules/pvs2mgr-autologin/opt/openslx/xsessions/default.desktop b/server/modules/pvs2mgr-autologin/opt/openslx/xsessions/default.desktop new file mode 120000 index 00000000..90f83e2b --- /dev/null +++ b/server/modules/pvs2mgr-autologin/opt/openslx/xsessions/default.desktop @@ -0,0 +1 @@ +pvs2mgr.desktop
\ No newline at end of file |