summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmltk5
-rwxr-xr-xremote/setup_tools124
-rw-r--r--remote/tools/base/base.build26
-rw-r--r--remote/tools/base/base.conf23
-rw-r--r--remote/tools/base/data/etc/keymaps/de_DEbin0 -> 2823 bytes
-rw-r--r--remote/tools/dbus/dbus.build2
-rw-r--r--remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.build6
-rw-r--r--remote/tools/systemd/data/etc/systemd/system/activate-swap30
-rw-r--r--remote/tools/systemd/data/etc/systemd/system/analyse-disk.sh120
-rw-r--r--remote/tools/systemd/data/etc/systemd/system/fetch-config178
l---------remote/tools/systemd/data/etc/systemd/system/getty.target.wants/load-german-keymap.service1
-rw-r--r--remote/tools/systemd/data/etc/systemd/system/ip-dns-conf86
-rw-r--r--remote/tools/systemd/data/etc/systemd/system/load-german-keymap.service5
-rw-r--r--remote/tools/systemd/data/etc/systemd/system/network-interface@.service8
-rw-r--r--remote/tools/systemd/data/etc/systemd/system/openslx-mnt.mount9
-rw-r--r--remote/tools/systemd/data/etc/systemd/system/udhcpc@.service (renamed from remote/tools/systemd/data/etc/systemd/system/network@.service)8
l---------remote/tools/systemd/data/etc/systemd/system/udhcpc@.service.wants/openslx-mnt.mount1
-rw-r--r--remote/tools/systemd/data/usr/lib/udev/rules.d/99-systemd.rules2
-rw-r--r--remote/tools/systemd/systemd.build2
-rw-r--r--remote/tools/xorg/xorg.build4
-rwxr-xr-xserver/build_core11
21 files changed, 580 insertions, 71 deletions
diff --git a/mltk b/mltk
index 0e244752..2329e707 100755
--- a/mltk
+++ b/mltk
@@ -100,10 +100,13 @@ read_params() {
shift
;;
*)
- break
+ break
;;
esac
done
+
+ # exit if no command
+ [ "x$BUILD" = "x" -a "x$CLEAN" = "x" ] && print_usage && exit 1
TOOLS="$@"
}
diff --git a/remote/setup_tools b/remote/setup_tools
index ed6f58e9..bb1895d0 100755
--- a/remote/setup_tools
+++ b/remote/setup_tools
@@ -6,14 +6,15 @@ MODULE_DIR=${ROOT_DIR}/remote
TOOL_DIR=${MODULE_DIR}/tools
INIT_DIR=${MODULE_DIR}/stage3.2
-setup_git ()
+initial_checks ()
{
- if [ ! -z "${GIT}" ]; then
- GIT_BIN=$(which git)
- [ -z "${GIT_BIN}" ] && echo "Installing git..." && apt-get install git
- fi
+ for BIN in $(which git) $(which locate)
+ do
+ [ -z $BIN ] && echo "Installing $BIN..." && apt-get install $BIN
+ done
}
+
read_config ()
{
TOOL_CONFIG=${TOOL_DIR}/${TOOL}/${TOOL}.conf
@@ -46,45 +47,62 @@ copyfileswithdependencies ()
COPYFILES_LIST="list_wanted_stage3.2"
[ -e ${COPYFILES_LIST} ] && rm ${COPYFILES_LIST}
-
+
+
+ echo -e "\n\n*********************************************************"
+ echo "*"
+ echo "* Copying required binaries from config file..."
+ echo "*"
+ echo -e "*********************************************************\n\n"
for FILENAME in ${REQUIRED_BINARIES}
do
FILE=$(find . -name ${FILENAME} -type f -executable | xargs grep -l ELF)
if [ -z "$FILE" ]; then
- echo "No Binary found for ${FILENAME}. Skipping."
+ echo -e "\tNo Binary found for ${FILENAME}. Skipping."
echo "-----------------------------------------------------------------"
continue
fi
- echo "Found ${FILENAME} at ${FILE}. Searching libraries..."
+ echo -e "\tFound ${FILENAME} at ${FILE}"
echo ${FILE} >> ${COPYFILES_LIST}
# fetch dependencies
# quick fix to exclude libc*, else it copies unneeded libs...
+ # workaround for
+ ldd ${FILE} &>/dev/null
+ ldd_exit_code=$?
+ if [ "x$ldd_exit_code" != "x0" ];
+ then
+ echo -e "\tldd $FILE failed."
+ continue
+ fi
for i in $(ldd ${FILE} |awk '{print $1 $2 $3}'|grep -v ld-linux|grep -v libc.so*|grep -v linux-gate|grep -v linux-vdso)
do
arrIN=(${i//=>/ })
- echo "--------------------------------------------------------"
- echo "Searching ${arrIN[0]} under $(pwd)..."
- LOCAL_MATCHES=$(find . -name $(echo ${arrIN[0]}|awk -F "." '{print $1}').*)
+ echo -en "\t\t${arrIN[0]}"
+ LOCAL_MATCHES=$(find . -name $(echo ${arrIN[0]}|awk -F "." '{print $1}').so*)
if [ "x${LOCAL_MATCHES}" != "x" ];
then
for llib in ${LOCAL_MATCHES};
do
- echo "Copying ${llib}"
+ echo -ne " ->${llib}"
echo ${llib} >> ${COPYFILES_LIST}
done
+ echo ""
else
- echo "Did not found ${arrIN[0]} in $(pwd)"
if [ -e ${arrIN[1]} ];
then
- echo -n "Trying ${arrIN[1]} ..."
- echo " found! Copying."
echo ${arrIN[1]} >> ${COPYFILES_LIST}
- [ -L ${arrIN[1]} ] && echo $(readlink -f ${arrIN[1]}) >> ${COPYFILES_LIST}
+
+ if [ ! -L ${arrIN[1]} ];
+ then
+ echo -e " -> ${arrIN[1]}"
+ else
+ echo -e " -> ${arrIN[1]} -> $(readlink -f ${arrIN[1]})"
+ echo $(readlink -f ${arrIN[1]}) >> ${COPYFILES_LIST}
+ fi
fi
fi
done
- echo "Copied ${FILENAME}."
- echo "-----------------------------------------------------------------"
+ echo -e "\t-------------------------------------------------------------------------------------------------------------"
done
for LIB in ${REQUIRED_LIBRARIES}
@@ -95,49 +113,60 @@ copyfileswithdependencies ()
done
done
- echo "Copying required directories from config file..."
+ echo -e "\n\n*********************************************************"
+ echo "*"
+ echo "* Copying required directories from config file..."
+ echo "*"
+ echo -e "*********************************************************\n\n"
for ENTRY in ${REQUIRED_DIRECTORIES}
do
echo ".${ENTRY}" >> ${COPYFILES_LIST}
- for LIB in $(find .${ENTRY} -type f -not -name "*.a" | xargs grep -l ELF)
+ for BIN in $(find .${ENTRY} -type f -not -name "*.a" | xargs grep -l ELF)
do
- for i in $(ldd ${LIB} |awk '{print $1 $2 $3}'|grep -v ld-linux|grep -v libc.so*|grep -v linux-gate|grep -v linux-vdso)
+ echo -e "\tSearching libs for ${BIN}..."
+ for i in $(ldd ${BIN} |awk '{print $1 $2 $3}'|grep -v ld-linux|grep -v libc.so*|grep -v linux-gate|grep -v linux-vdso)
do
arrIN=(${i//=>/ })
- echo "--------------------------------------------------------"
- echo "Searching ${arrIN[0]} under $(pwd)..."
- LOCAL_MATCHES=$(find . -name $(echo ${arrIN[0]}|awk -F "." '{print $1}').*)
+ echo -e "\t\t---------------------------------------------------------"
+ echo -ne "\t\tSearching ${arrIN[0]} under $(pwd)..."
+ LOCAL_MATCHES=$(find . -name $(echo ${arrIN[0]}|awk -F "." '{print $1}').so*)
if [ "x${LOCAL_MATCHES}" != "x" ];
then
for llib in ${LOCAL_MATCHES};
do
- echo "Copying ${llib}"
+ echo -en "\n\t\tCopying ${llib}"
echo ${llib} >> ${COPYFILES_LIST}
done
+ echo ""
else
- echo "Did not found ${arrIN[0]} in $(pwd)"
+ echo " not found."
if [ ! -z ${arrIN[1]} ];
then
- echo -n "Trying ${arrIN[1]} ..."
- echo " found! Copying."
+ echo -e "\t\tCopying from system ${arrIN[1]} ..."
echo ${arrIN[1]} >> ${COPYFILES_LIST}
[ -L ${arrIN[1]} ] && echo $(readlink -f ${arrIN[1]}) >> ${COPYFILES_LIST}
fi
fi
done
- echo "Copied ${LIB}."
- echo "-----------------------------------------------------------------"
+ echo -e "\tCopied $BIN"
+ echo -e "\t-------------------------------------------------------------------------------------------------------------"
done
done
- echo "Copying required files from config file..."
+ echo "*********************************************************"
+ echo "*"
+ echo "* Copying required files from config file..."
+ echo "*"
+ echo "*********************************************************"
for ENTRY in ${REQUIRED_FILES}
do
echo ".${ENTRY}" >> ${COPYFILES_LIST}
done
+
#copy to initramfsdir
- tar -cpv $(cat ${COPYFILES_LIST}|sort -u) | tar -xpv -C ${INIT_DIR} &>/dev/null
+ echo "[stage32] Completed file list generation at ${TOOL_DIR}/${TOOL}/build/${COPYFILES_LIST}."
+ (tar -cpv $(cat ${COPYFILES_LIST}|sort -u) | tar -xpv -C ${INIT_DIR}) &>/dev/null
unset REQUIRED_BINARIES
unset REQUIRED_LIBRARIES
unset REQUIRED_DIRECTORIES
@@ -149,53 +178,64 @@ get_basic_libs () {
[ ! -d ${INIT_DIR} ] && mkdir ${INIT_DIR}
# copy libc and ld-linux separatly
- echo "Looking for libc and ld-linux used for ${SHELL}..."
+ echo "----------------------------------------------------"
BASICLIBS=""
for i in $(ldd ${SHELL})
do
if [ $(echo $i | grep '^/' | grep -c ld) -eq 1 -o $(echo $i | grep '^/' | grep -c libc.so) -eq 1 ];
then
- echo "Found basic lib at: $i"
+ echo "Copied $i"
BASICLIBS="${BASICLIBS} $i $(readlink -f "$i")"
fi
done
- tar -cpv ${BASICLIBS} | tar -xpv -C ${INIT_DIR} &>/dev/null
- echo "Basic libs copied."
+ (tar -cpv ${BASICLIBS} | tar -xpv -C ${INIT_DIR}) &>/dev/null
}
generate_stage32 () {
+ initial_checks
+
+ get_basic_libs
+
# if no arguments assume all.
if [ "x$1" = "x" -o "x$1" = "xall" ]; then
tools=$(ls ${TOOL_DIR})
set -- $tools
fi
- # first copy libc and ld-linux
- get_basic_libs
-
# now iterate over given tools and copy them
cd ${TOOL_DIR}
while (( "$#" )); do
- TOOL=$1
+ TOOL=$1
if [ -d ${TOOL} ];
then
+ echo "###################################################################################"
+ echo "# BUILDING $TOOL"
+ echo "#"
+
+ [ "x$DEBUG" != "x1" ] \
+ && echo "Logging to ${TOOL_DIR}/${TOOL}/stage32.log" \
+ && exec 6>&1 > ${TOOL_DIR}/${TOOL}/stage32.log
cd ${TOOL}
read_config
read_build
- setup_git
install_dependencies
fetch_source
build
copyfileswithdependencies
post_copy
cd ${TOOL_DIR}
+
+ # reset pipes
+ [ "x$DEBUG" != "x1" ] && exec 1>&6 6>&-
+ echo "#"
+ echo "# DONE"
+ echo "###################################################################################"
else
echo "Tool directory not found."
fi
shift
done
-
}
clean_tools() {
diff --git a/remote/tools/base/base.build b/remote/tools/base/base.build
index 91cbfa3f..95b9de65 100644
--- a/remote/tools/base/base.build
+++ b/remote/tools/base/base.build
@@ -17,8 +17,16 @@ build() {
for BIN in ${REQUIRED_BINARIES}
do
BIN_LOCATION=$(which ${BIN})
- [ -e ${BIN_LOCATION} ] && echo ${BIN_LOCATION} >> ${FILELIST}
- [ -L ${BIN_LOCATION} ] && echo $(readlink ${BIN_LOCATION}) >> ${FILELIST}
+ if [ ! -z ${BIN_LOCATION} -a -e ${BIN_LOCATION} ];
+ then
+ echo "[$TOOL] Processing $BIN at $BIN_LOCATION ..."
+ echo ${BIN_LOCATION} >> ${FILELIST}
+ [ -L ${BIN_LOCATION} ] \
+ && echo "[$TOOL] ${BIN_LOCATION} is a symbolic link, copying $(readlink -f ${BIN_LOCATION})" \
+ && echo $(readlink -f ${BIN_LOCATION}) >> ${FILELIST}
+ else
+ echo "[$TOOL] ${BIN} not found on the system!"
+ fi
done
for LIB in ${REQUIRED_LIBRARIES}
@@ -38,13 +46,15 @@ build() {
[ ! -d ${FILE} ] && echo ${FILE} >> ${FILELIST}
done
- tar -cpv $(cat ${FILELIST}) | tar -xpv -C ${BUILDDIR} &>/dev/null
+ echo "[$TOOL] File list generated as ${BUILDDIR}/${FILELIST}."
+ echo "--------------------------------------------------------------------"
+ (tar -cpv $(cat ${FILELIST}) | tar -xpv -C ${BUILDDIR}) &>/dev/null
}
post_copy() {
# make basic directory structure
- mkdir -p ${INIT_DIR}/{bin,dev,proc,lib,etc,mnt,sys,var/run,var/lock,var/log,run/lock,run/shm}
+ mkdir -p ${INIT_DIR}/{bin,dev,proc,lib,etc,mnt,sys,var/run,var/lock,var/log,run/lock,run/shm,openslx/mnt}
# copy devices from running system
cp -a /dev/{console,kmsg,mem,null,shm,tty,tty0,tty1,tty9,fb0,urandom,zero} \
@@ -57,14 +67,15 @@ post_copy() {
# copy static files
cp -r ${TOOL_DIR}/${TOOL}/data/* ${INIT_DIR}
+ # better: dirname $(ldd $SHELL|grep libc | awk -F " " '{print $3}')
# copy pam modules, TODO: better way to find arch-dependant interfix...
- tar -cpv $(dirname $(locate pam_unix.so|grep ^/lib/)) | tar -xpv -C ${INIT_DIR} &>/dev/null
+ (tar -cpv $(dirname $(locate pam_unix.so|grep ^/lib/)) | tar -xpv -C ${INIT_DIR}) &>/dev/null
# quick fix for /etc/fstab
echo "# no configuration" >> ${INIT_DIR}/etc/fstab
# link /etc/mtab, needed for systemd
- ln -s /proc/self/mounts ${INIT_DIR}/etc/mtab
+ [ ! -e ${INIT_DIR}/etc/mtab ] && ln -s /proc/self/mounts ${INIT_DIR}/etc/mtab
# quick fix for missing group in /etc/group
echo "lock:x:128:" >> ${INIT_DIR}/etc/group
@@ -80,5 +91,6 @@ post_copy() {
#cp -r /lib/modules/$(uname -r) ${INIT_DIR}/lib/modules/$(uname -r)
#quick fix xterm symlink
- ln -s /usr/lib/libXaw7.so.7.0.0 ${INIT_DIR}/usr/lib/libXaw7.so.7
+ [ -e /usr/lib/libXaw7.so.7.0.0 ] && \
+ ln -s /usr/lib/libXaw7.so.7.0.0 ${INIT_DIR}/usr/lib/libXaw7.so.7
}
diff --git a/remote/tools/base/base.conf b/remote/tools/base/base.conf
index 5e97fe51..8b5fe899 100644
--- a/remote/tools/base/base.conf
+++ b/remote/tools/base/base.conf
@@ -8,6 +8,9 @@ REQUIRED_BINARIES=" bash
sulogin
mount
umount
+ mount.nfs
+ mount.aufs
+ umount.aufs
rm
ldd
strace
@@ -15,7 +18,10 @@ REQUIRED_BINARIES=" bash
modprobe
xterm
rsyslogd
- ps"
+ ps
+ sshd
+ scp
+ ssh"
REQUIRED_LIBRARIES=" libcap
libcidn
libcom_err
@@ -31,18 +37,27 @@ REQUIRED_LIBRARIES=" libcap
libpam
libutil
libtinfo
- libresolv"
+ libresolv
+ libau"
REQUIRED_DIRECTORIES=" /etc/pam.d
/etc/security"
-REQUIRED_FILES=" /etc/passwd
+REQUIRED_FILES=" /sbin/mount.nfs4
+ /sbin/umount.nfs4
+ /etc/passwd
/etc/shadow
/etc/group
/etc/hostname
/etc/environment
/etc/pam.conf
/etc/issue
+ /etc/inputrc
/etc/localtime
/etc/login.defs
/etc/nsswitch.conf
/etc/securetty
- /etc/default/locale"
+ /etc/default/locale
+ /etc/default/aufs
+ /etc/protocols
+ /etc/services
+ /etc/networks
+ /etc/netconfig"
diff --git a/remote/tools/base/data/etc/keymaps/de_DE b/remote/tools/base/data/etc/keymaps/de_DE
new file mode 100644
index 00000000..375c2012
--- /dev/null
+++ b/remote/tools/base/data/etc/keymaps/de_DE
Binary files differ
diff --git a/remote/tools/dbus/dbus.build b/remote/tools/dbus/dbus.build
index 6c6faaf5..5254497f 100644
--- a/remote/tools/dbus/dbus.build
+++ b/remote/tools/dbus/dbus.build
@@ -21,7 +21,7 @@ build() {
# prepare target dir & copy there
[ ! -d ${BUILDDIR} ] && mkdir -p ${BUILDDIR}
- tar -cpv $(cat ${COPYLIST}|sort -u) | tar -xpv -C ${BUILDDIR}
+ (tar -cpv $(cat ${COPYLIST}|sort -u) | tar -xpv -C ${BUILDDIR}) &> /dev/null
}
post_copy() {
diff --git a/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.build b/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.build
index 20c46015..7738c1e7 100644
--- a/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.build
+++ b/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.build
@@ -46,9 +46,11 @@ build () {
}
post_copy() {
- #copyi static data files
+ #copy static data files
cp -r ${TOOL_DIR}/${TOOL}/data/* ${INIT_DIR}
- gdk-pixbuf-query-loaders > ${INIT_DIR}/usr/lib/i386-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache
+ # TODO: FIX PATH TO TRIPLET...
+ TRIPLET=$(basename $(dirname $(ldd $SHELL|grep libc | awk -F " " '{print $3}')))
+ gdk-pixbuf-query-loaders > ${INIT_DIR}/usr/lib/${TRIPLET}/gdk-pixbuf-2.0/2.10.0/loaders.cache
pango-querymodules > ${INIT_DIR}/etc/pango/pango.modules
gtk-update-icon-cache-3.0 ${INIT_DIR}/usr/share/icons/hicolor/
update-mime-database ${INIT_DIR}/usr/share/mime
diff --git a/remote/tools/systemd/data/etc/systemd/system/activate-swap b/remote/tools/systemd/data/etc/systemd/system/activate-swap
new file mode 100644
index 00000000..10cb42e9
--- /dev/null
+++ b/remote/tools/systemd/data/etc/systemd/system/activate-swap
@@ -0,0 +1,30 @@
+#!/bin/sh
+# Copyright (c) 2013 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found under http://openslx.org
+#
+# Initialize swap for OpenSLX linux stateless clients, both for swap on local
+# disk partitions as well as compressed ramzswap or similar
+
+#############################################################################
+
+# depends on mount-disk.sh
+# depends on availability of the appropriate kernel module/functionality
+
+# try to enable compressed RAM SWAP / ZRAM
+if modprobe ${MODPRV} ramzswap 2>/dev/null && [ -f /usr/bin/rzscontrol ] ; then
+ rzscontrol /dev/ramzswap0 --init
+ swapon /dev/ramzswap0 2>/dev/null
+ #hdswap="# disk swap disabled because of enabled compressed ramswap"
+elif modprobe ${MODPRV} zram 2>/dev/null ; then
+ # assign a quarter of total mem to zram
+ echo $(( $(free -k | awk '/^Mem:/ { print $2 }') * 256 )) > /sys/block/zram0/disksize
+ mkswap /dev/zram0 2>/dev/null
+ swapon /dev/zram0 2>/dev/null
+fi
diff --git a/remote/tools/systemd/data/etc/systemd/system/analyse-disk.sh b/remote/tools/systemd/data/etc/systemd/system/analyse-disk.sh
new file mode 100644
index 00000000..0c152dbf
--- /dev/null
+++ b/remote/tools/systemd/data/etc/systemd/system/analyse-disk.sh
@@ -0,0 +1,120 @@
+#!/bin/sh
+# Copyright (c) 2013 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found under http://openslx.org
+#
+# Local hard disk autoconfiguration script for OpenSLX linux stateless
+# clients, detecting swap and special partitions
+
+#############################################################################
+
+# Todo:
+# * This script should be run just once per boot!
+# * The activation of swap could/should be handled in separate script!?
+# * The mounting of /tmp could/should be done separately?
+# * Same for other partitions, use information of /etc/fstab for that?
+# * Should we just install xfs in the source system and boil down everything
+# onto that?
+
+# General formatter for the /tmp partition on a local harddisk
+diskfm () {
+local target=$1
+local mntpnt=$2
+local fs
+local path
+for fs in xfs reiserfs ext2 ; do
+ if strinfile "$fs" /proc/filesystems || modprobe ${MODPRV} $fs ; then
+ unset $found
+ for path in /sbin /bin /usr/sbin /usr/bin ; do
+ if test -x /mnt/$path/mkfs.$fs ; then
+ found=yes
+ case mkfs.$fs in
+ mkfs.xfs)
+ fopt="-f"
+ mopt="-o noexec"
+ ;;
+ mkfs.ext2)
+ fopt="-Fq"
+ mopt="-o nocheck,noexec"
+ ;;
+ mkfs.reiserfs)
+ fopt="-f"
+ mopt="-o noexec"
+ ;;
+ esac
+ mkfs.$fs $fopt $target >/dev/null 2>&1 #|| error
+ if [ -z $mntpnt ] ; then
+ umount /tmp 2>/dev/null
+ if mount -t $fs -n $mopt $target /tmp 2>/dev/null; then
+ return 0
+ else
+ mount -n -t tmpfs none /tmp
+ fi
+ else
+ mkdir -p $mntpnt
+ mount -t $fs -n -o loop $target $mntpnt 2>/dev/null
+ return 0
+ fi
+ fi
+ done
+ [ -z $found ] && continue
+ else break
+ fi
+done
+}
+
+# Check for local harddisks and appropriate partitions
+fdisk -l /dev/$hd|sed -n "/^\/dev\//p" >/etc/disk.partition
+
+# Check for standard swap partitions and make them available to the system
+for hdpartnr in $(cat /etc/disk.partition | \
+ sed -n -e "/ 82 /p"|sed -e "s/[[:space:]].*//") ; do
+ echo -e "$hdpartnr\tswap\t\tswap\t\tdefaults\t 0 0" >>/etc/fstab
+done
+
+# We use special non assigned partition type (id44) for harddisk scratch
+# space, thus no normal filesystem will be incidentally deleted or
+# corrupted
+for hdpartnr in $(cat /etc/disk.partition | \
+ sed -n -e "/ 44 /p"|sed -e "s/[[:space:]].*//") ; do
+ # check for supported filesystem and formatter
+ ( if diskfm $hdpartnr ; then
+ echo "$hdpartnr is mounted to /mnt/tmp at $(sysup)" >/tmp/tmpready
+ echo -e "$hdpartnr\t/tmp\t\tauto\t\tdefaults\t 0 0" >>/etc/fstab
+ else
+ echo "formatting failed for some reason ($(sysup))" >/tmp/tmpready
+ fi ) &
+ break
+done
+
+# Put detected linux partitions (83) into /etc/fstab with "noauto", special
+# partition 45 (persistent scratch) to /var/scratch and 46 to /var/openslx
+for partid in 83 45 46 ; do
+ for hdpartnr in $(cat /etc/disk.partition | \
+ sed -n -e "/ ${partid} /p"|sed -e "s/[[:space:]].*//") ; do
+ mkdir -p /media/${hdpartnr#/dev/*} 2>/dev/null
+ if [ ${partid} -eq 83 ] ; then
+ echo -e "$hdpartnr\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto,\
+noexec\t 0 0" >>/tmp/fstab
+ elif [ ${partid} -eq 45 ] ; then
+ #mount -t auto ${hdpartnr} /media/${hdpartnr#/dev/*}
+ #ln -sf /media/${hdpartnr#/dev/*} /var/scratch
+ echo -e "${hdpartnr}\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto\
+\t\t 0 0" >>/tmp/fstab
+ elif [ ${partid} -eq 46 ] ; then
+ # Mount a home directory to (/mnt)/var/home
+ #mount -t auto ${hdpartnr} /mnt/media/${hdpartnr#/dev/*} \n\
+ #test -d /mnt/media/${hdpartnr#/dev/*}/home && \
+ # ln -sf /media/${hdpartnr#/dev/*} /var/home
+ echo -e "${hdpartnr}\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto\
+\t\t 0 0" >>/tmp/fstab
+ fi
+ done
+done
+
diff --git a/remote/tools/systemd/data/etc/systemd/system/fetch-config b/remote/tools/systemd/data/etc/systemd/system/fetch-config
new file mode 100644
index 00000000..556f0f41
--- /dev/null
+++ b/remote/tools/systemd/data/etc/systemd/system/fetch-config
@@ -0,0 +1,178 @@
+#!/bin/sh
+# Copyright (c) 2013 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found under http://openslx.org
+#
+# Fetch configuration from server ...
+
+#############################################################################
+
+# Depends on configured networking, provides configuration
+
+
+# Todo: rewrite for next-gen system - principle would be the same ...
+
+# Function for retrieving configuration file (machine-setup) via tftp from a
+# predefined server or given source (file=tftp-server:/path via kernel
+# command line)
+unpack () {
+# $1 is config file name to get, $2 IP of server to get file from
+local dst=$1
+if [ -s $dst ] ; then
+ # fixme: handle different types of packaging (gzip/bzip2)??
+ if ! tar -xpzf $dst 2> /tmp/ConfTGZ-tar-error ; then
+ cat /tmp/ConfTGZ-tar-error
+ error "$unpack_ConfTGZ" nonfatal
+ rm /tmp/ConfTGZ-tar-error
+ fi
+ [ "$DEBUGLEVEL" -le 2 -o "$DEBUGLEVEL" -eq 8 ] && rm $dst
+ return 0
+else
+ return 1
+fi
+}
+
+# tftp wrapper
+# usage tftp_get <path> <tftpdserver> [count]
+# count is optional - default is 3 - use -1 for indefinit
+tftp_get () {
+ local file="$1"
+ local file_server="$2"
+ local download_successful=0
+ local countdown="$3"
+
+ if [ -z "$1" -o -z "$2" ]; then
+ [ $DEBUGLEVEL -ge 1 ] && \
+ echo "[tftp_get] Usage: tftp_get <path> <server> [count]"
+ return 1;
+ fi
+
+ [ "$countdown" = "" ] && countdown=3
+
+ until [ $download_successful -eq 1 ]
+ do
+ if [ "$countdown" = "0" ]; then
+ [ $DEBUGLEVEL -ge 1 ] && \
+ echo "[tftp_get] download of \"$file\" from \"$file_server\" ... failed"
+ return 0;
+ fi
+ tftp -g -r "/$file" -l /tmp/$(basename $file) $file_server
+ [ -s /tmp/$(basename $file) ] && download_successful=1
+ countdown=$(expr $countdown - 1)
+ usleep 200000
+ done
+ [ $DEBUGLEVEL -ge 1 ] && \
+ echo "[tftp_get] download of \"$file\" from \"$file_server\" ... successful"
+ return 0;
+}
+
+
+# wget wrapper
+# usage wget_get <path> <ftp/httpserver> [count]
+# count is optional - default is 3 - use -1 for indefinit
+wget_get () {
+ local file="$1"
+ local file_server="$2"
+ local download_successful=0
+ local countdown="$3"
+
+ if [ -z "$1" -o -z "$2" ]; then
+ [ $DEBUGLEVEL -ge 1 ] && \
+ echo "[wget_get] Usage: wget_get <path> <server> [count]"
+ return 1;
+ fi
+
+ [ "$countdown" = "" ] && countdown=3
+
+ until [ $download_successful -eq 1 ]
+ do
+ if [ "$countdown" = "0" ]; then
+ [ $DEBUGLEVEL -ge 1 ] && \
+ echo "[wget_get] download of \"$file\" from \"$file_server\" ... failed"
+ return 0;
+ fi
+ wget -q $file_server$file -O /tmp/$(basename $file)
+ [ -s /tmp/$(basename $file) ] && download_successful=1
+ countdown=$(expr $countdown - 1)
+ usleep 200000
+ done
+ [ $DEBUGLEVEL -ge 1 ] && \
+ echo "[wget_get] download of \"$file\" from \"$file_server\" ... successful"
+ return 0;
+}
+
+
+fileget () {
+# normally tftp would be used, alternatively use wget for ftp or http
+# if local device file is specified - mount and unmount after copying
+local cfgfile
+[ "x$fileprot" = "x" ] && fileprot=tftp
+if [ "x$filepath" != "x" ] ; then
+ cfgfile=${filepath}
+ [ "x$fileserv" = "x" ] && fileserv=$(checkip ${serverip})
+ # wait for dns if "fileserv" is a name and not lbd device
+ [ "$fileprot" != "lbd" ] && \
+ echo ${fileserv} | grep -qi [a-z]
+ [ $DEBUGLEVEL -ge 1 ] && echo "fileget - fileprot:$fileprot, filepath:\
+$filepath, fileserv:$fileserv" >>$LOGFILE
+ case "$fileprot" in
+ ftp|http)
+ wget_get $cfgfile $fileprot://$fileserv \
+ && { unpack /tmp/$(basename $cfgfile) && break; } 2>>$LOGFILE
+ ;;
+ lbd)
+ local ldev=$fileserv
+ echo "Waiting for configuration file ${cfgfile} ...."
+ [ $DEBUGLEVEL -ge 1 ] && echo "fileget - fileprot:$fileprot, filepath:\
+$filepath, fileserv:$fileserv" >>$LOGFILE
+ waitfor /mnt/${cfgfile} 10000
+ if [ -f /mnt/${cfgfile} ]; then
+ unpack /mnt/$cfgfile
+ else
+ error "$init_errlfg"
+ fi
+ ;;
+ *)
+ tftp_get $cfgfile $fileserv \
+ && unpack /tmp/$(basename $cfgfile) 2>>$LOGFILE
+ ;;
+ esac
+else
+ # predefined value for OpenSLX environment; it is expected that this
+ # directory is just below the tftpboot (path to which the daemon is
+ # restricted to)
+ filepath="client-config"
+ [ "x$fileserv" = "x" ] && fileserv=$(checkip ${serverip})
+ [ $DEBUGLEVEL -ge 1 ] && echo "fileget - fileprot:$fileprot, filepath:\
+$filepath, fileserv:$fileserv" >>$LOGFILE
+ # try to get configuration files successively; start with distro client
+ # and try last distro default ...
+ mac=$(echo $macaddr|sed "s/:/-/g")
+ for cfgfile in ${filepath}/${SYSTEM_NAME}/01-$mac.tgz \
+ ${filepath}/${SYSTEM_NAME}/default.tgz ; do
+ case "$fileprot" in
+ ftp|http)
+ wget $fileprot://$fileserv/$cfgfile -O /tmp/$(basename $cfgfile) \
+ 2>>$LOGFILE && { unpack /tmp/$(basename $cfgfile) && break; }
+ ;;
+ tftp)
+ tftp_get $cfgfile $fileserv \
+ 2>>$LOGFILE && { unpack /tmp/$(basename $cfgfile) && break; }
+ ;;
+ esac
+ done
+ echo -e "\n## Configuration via fileget from ${fileprot}://${fileserv}/\
+${cfgfile}\n# Hierarchy is distro client and as last distro/default" \
+ >>/tmp/confviafile
+fi
+cat /initramfs/machine-setup >>/tmp/confviafile 2>/dev/null || \
+ error "$nomachsetup"
+echo "fileget via $fileprot from $fileserv/$cfgfile finished" >/tmp/file-done
+[ $DEBUGLEVEL -ge 1 ] && echo "fileget from $cfgfile finished" >>$LOGFILE
+}
diff --git a/remote/tools/systemd/data/etc/systemd/system/getty.target.wants/load-german-keymap.service b/remote/tools/systemd/data/etc/systemd/system/getty.target.wants/load-german-keymap.service
new file mode 120000
index 00000000..d329f45a
--- /dev/null
+++ b/remote/tools/systemd/data/etc/systemd/system/getty.target.wants/load-german-keymap.service
@@ -0,0 +1 @@
+../load-german-keymap.service \ No newline at end of file
diff --git a/remote/tools/systemd/data/etc/systemd/system/ip-dns-conf b/remote/tools/systemd/data/etc/systemd/system/ip-dns-conf
new file mode 100644
index 00000000..f14ecd88
--- /dev/null
+++ b/remote/tools/systemd/data/etc/systemd/system/ip-dns-conf
@@ -0,0 +1,86 @@
+#!/bin/sh
+# Copyright (c) 2013 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found under http://openslx.org
+#
+# Set IP and DNS configuration ...
+
+#############################################################################
+
+# Depends on running network interface, provides IP and DNS configuration
+
+# Dns and ip configuration, hostname of the machine --> to be merged with udhcpc.default.script!!
+echo "$host_name" >/proc/sys/kernel/hostname
+echo -e "# /etc/hosts - file generated by $0 during OpenSLX stage3\
+\n#\n# IP-Address Full-Qualified-Hostname Short-Hostname\n#\n\
+127.0.0.1\tlocalhost\n::1\t\tlocalhost ipv6-localhost ipv6-loopback\n\
+fe00::0\t\tipv6-localnet\nff00::0\t\tipv6-mcastprefix\nff02::1\
+\t\tipv6-allnodes\nff02::2\t\tipv6-allrouters\nff02::3\t\t\
+ipv6-allhosts\n" >/etc/hosts
+if [ -n "${domain_name}" ]; then
+ echo -en "${clientip}\t" >>/etc/hosts
+ for name in ${domain_name}; do
+ echo -en "${host_name}.${name} " >>/etc/hosts
+ done
+ echo -e "${host_name}" >>/etc/hosts
+else
+ echo -e "${clientip}\t${host_name}" >>/etc/hosts
+fi
+# set up domainname and resolving
+#rm -rf /etc/resolv.conf
+
+out=/etc/resolv.conf
+echo -e "# /etc/resolv.conf - file generated by\n#\t$0:\n\
+#\t${date}\n#options timeout:1 attempts:1 rotate" > $out
+
+[ "x${domain_name}" != "x" ] && echo -e "domain ${domain_name}" >> $out
+[ "x${domain_search}" != "x" ] && echo -e "search ${domain_search}" >> $out
+# fallback
+[ "x${domain_search}" == "x" ] && [ "x${domain_name}" != "x" ] && \
+ echo -e "search ${domain_name}" >> $out
+
+[ -n "${domain_name_servers}" ] && {
+ for name in ${domain_name_servers}; do
+ echo nameserver ${name} >> $out;
+ done; }
+
+# Create hostname file
+[ -n ${host_name} ] && [ -n ${domain_name} ] && \
+ echo "${host_name}.${domain_name}" > /etc/hostname
+
+
+# Set greeting and add information on booted system
+len=$(expr length ${SLXVERSION}${SYSTEM_NAME})
+if [ $len -le 28 ] ; then
+ vdstr="Stateless Workstation (V${SLXVERSION}/${SYSTEM_NAME})"
+ smax=28
+else
+ vdstr="V${SLXVERSION}/${SYSTEM_NAME}"
+ smax=52
+fi
+while [ $len -le $smax ] ; do
+ vdstr="$vdstr "
+ len=$(($len + 1))
+done
+len=$(expr length ${host_name})
+while [ $len -le 30 ] ; do
+ space="$space "
+ len=$(($len + 1))
+done
+echo "
+ WELCOME TO $space \n (\l)
+ _____ ______ ______ __ __ _______ __ __ __
+ / _ | _ | ___| | | | | ____| | | | | |
+ | | | | |_| | |_ | | | | |___ | | / /
+ | | | | ___/| _| | | ____ | | | |
+ | |_| | | | |___| | | | ____| | |___ / /
+ _____/|__| |______|__| |__| |_______|______|__| |__|
+
+ $vdstr (c) <OpenSLX.ORG>
+" >/etc/issue
diff --git a/remote/tools/systemd/data/etc/systemd/system/load-german-keymap.service b/remote/tools/systemd/data/etc/systemd/system/load-german-keymap.service
new file mode 100644
index 00000000..74753259
--- /dev/null
+++ b/remote/tools/systemd/data/etc/systemd/system/load-german-keymap.service
@@ -0,0 +1,5 @@
+[Unit]
+Description=Setup german keyboard layout
+
+[Service]
+ExecStart=/bin/bash -c 'exec /openslx/sbin/loadkmap < /etc/keymaps/de_DE'
diff --git a/remote/tools/systemd/data/etc/systemd/system/network-interface@.service b/remote/tools/systemd/data/etc/systemd/system/network-interface@.service
new file mode 100644
index 00000000..b3c67d09
--- /dev/null
+++ b/remote/tools/systemd/data/etc/systemd/system/network-interface@.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Brings interface %i up
+Wants=udhcpc@%i.service
+Before=udhcpc@%i.service
+
+[Service]
+Type=simple
+ExecStart=/openslx/bin/ip link set dev %I up
diff --git a/remote/tools/systemd/data/etc/systemd/system/openslx-mnt.mount b/remote/tools/systemd/data/etc/systemd/system/openslx-mnt.mount
new file mode 100644
index 00000000..70c1d4c8
--- /dev/null
+++ b/remote/tools/systemd/data/etc/systemd/system/openslx-mnt.mount
@@ -0,0 +1,9 @@
+[Unit]
+Description=Mount NFS Share [TEST]
+After=udhcpc@%i.service
+
+[Mount]
+What=132.230.4.6:/srv/openslx/export/nfs/ubuntu-12.04-test
+Where=/openslx/mnt
+Type=nfs
+Options=ro,async,nolock
diff --git a/remote/tools/systemd/data/etc/systemd/system/network@.service b/remote/tools/systemd/data/etc/systemd/system/udhcpc@.service
index 01f3a526..6c5c289b 100644
--- a/remote/tools/systemd/data/etc/systemd/system/network@.service
+++ b/remote/tools/systemd/data/etc/systemd/system/udhcpc@.service
@@ -1,12 +1,8 @@
[Unit]
-Description=Setup Network Connection
-Wants=network.target
-Before=network.target
+Description=DHCP Client
[Service]
-Type=oneshot
-RemainAfterExit=yes
-ExecStart=/openslx/bin/ip link set dev %I up
+Type=simple
ExecStart=/openslx/sbin/udhcpc -O domain -O nissrv -O nisdomain -t 8 -s /etc/udhcpc.default.script -i %I
[Install]
diff --git a/remote/tools/systemd/data/etc/systemd/system/udhcpc@.service.wants/openslx-mnt.mount b/remote/tools/systemd/data/etc/systemd/system/udhcpc@.service.wants/openslx-mnt.mount
new file mode 120000
index 00000000..70ba668d
--- /dev/null
+++ b/remote/tools/systemd/data/etc/systemd/system/udhcpc@.service.wants/openslx-mnt.mount
@@ -0,0 +1 @@
+../openslx-mnt.mount \ No newline at end of file
diff --git a/remote/tools/systemd/data/usr/lib/udev/rules.d/99-systemd.rules b/remote/tools/systemd/data/usr/lib/udev/rules.d/99-systemd.rules
index 52377d1f..387a5754 100644
--- a/remote/tools/systemd/data/usr/lib/udev/rules.d/99-systemd.rules
+++ b/remote/tools/systemd/data/usr/lib/udev/rules.d/99-systemd.rules
@@ -31,7 +31,7 @@ SUBSYSTEM=="block", KERNEL!="ram*|loop*", ENV{DM_UUID}=="CRYPT-*", ENV{ID_PART_T
#
# http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=libudev/libudev-enumerate.c;h=da831449dcaf5e936a14409e8e68ab12d30a98e2;hb=HEAD#l742
-SUBSYSTEM=="net", KERNEL!="lo", TAG+="systemd", ENV{SYSTEMD_ALIAS}="/sys/subsystem/net/devices/$name", ENV{SYSTEMD_WANTS}="network@$name.service"
+SUBSYSTEM=="net", KERNEL!="lo", TAG+="systemd", ENV{SYSTEMD_ALIAS}="/sys/subsystem/net/devices/$name", ENV{SYSTEMD_WANTS}="network-interface@$name.service"
SUBSYSTEM=="bluetooth", TAG+="systemd", ENV{SYSTEMD_ALIAS}="/sys/subsystem/bluetooth/devices/%k"
SUBSYSTEM=="bluetooth", TAG+="systemd", ENV{SYSTEMD_WANTS}="bluetooth.target"
diff --git a/remote/tools/systemd/systemd.build b/remote/tools/systemd/systemd.build
index 6df35629..d198f821 100644
--- a/remote/tools/systemd/systemd.build
+++ b/remote/tools/systemd/systemd.build
@@ -19,7 +19,7 @@ install_dependencies() {
add-apt-repository --yes ppa:pitti/systemd
apt-get update --force-yes
fi
- apt-get install -y $DEPS
+ apt-get install -y $DEPS &>/dev/null
}
build () {
diff --git a/remote/tools/xorg/xorg.build b/remote/tools/xorg/xorg.build
index 5eaff345..590d0bb0 100644
--- a/remote/tools/xorg/xorg.build
+++ b/remote/tools/xorg/xorg.build
@@ -25,13 +25,13 @@ build() {
# prepare target dir & copy there
[ ! -d $BUILDDIR ] && mkdir -p $BUILDDIR
- tar -cpv $(cat $COPYLIST|sort -u) | tar -xpv -C $BUILDDIR
+ (tar -cpv $(cat $COPYLIST|sort -u) | tar -xpv -C $BUILDDIR) &>/dev/null
}
post_copy() {
[ ! -d $INIT_DIR/etc/X11 ] && mkdir -p $INIT_DIR/etc/X11
- ln -s /usr/bin/Xorg ${INIT_DIR}/etc/X11/X
+ [ ! -e ${INIT_DIR}/etc/X11/X ] && ln -s /usr/bin/Xorg ${INIT_DIR}/etc/X11/X
[ ! -d $INIT_DIR/var/lib/xkb ] && mkdir -p $INIT_DIR/var/lib/xkb
cp /var/lib/xkb/server* $INIT_DIR/var/lib/xkb
}
diff --git a/server/build_core b/server/build_core
index c9aa7add..6367e9e5 100755
--- a/server/build_core
+++ b/server/build_core
@@ -28,7 +28,7 @@ STAGE32_DIR=${ROOT_DIR}/remote/stage3.2
initial_checks() {
if [ ! -d ${STAGE32_DIR} ];
then
- echo "No stage3.2 directory found. Please run setup_tools first."
+ echo "No stage3.2 directory found. Please run \"./mltk tools build\" first."
exit 1
fi
@@ -53,6 +53,7 @@ initial_checks() {
cp -r /lib/modules/$(uname -r) ${STAGE32_DIR}/lib/modules/
fi
+ # TODO: check for aufs and squaskfs modules
}
generate_initramfs() {
@@ -70,6 +71,10 @@ generate_initramfs() {
# copy busybox, its libs and static data to stage3.1
cp -r ${STAGE32_DIR}/openslx/* ${STAGE31_STATIC_DIR}/* ${STAGE31_DIR}
+ # fix for aufs & squashfs modules needed for stage 3.1
+ cp /lib/modules/$(uname -r)/kernel/fs/squashfs/squashfs.ko ${STAGE31_DIR}/lib/modules
+ cp /lib/modules/$(uname -r)/kernel/ubuntu/aufs/aufs.ko ${STAGE31_DIR}/lib/modules
+
# fetch the libraries needed for busybox
BASICLIBS=""
for i in $(ldd ${STAGE31_DIR}/bin/busybox);
@@ -77,18 +82,16 @@ generate_initramfs() {
if [ $(echo $i | grep '^/' | grep -c ld) -eq 1 \
-o $(echo $i | grep '^/' | grep -c libc.so) -eq 1 ];
then
- echo $i
BASICLIBS="$BASICLIBS $i $(readlink -f "$i")"
fi
done
- tar cpv $BASICLIBS | tar xpv -C ${STAGE31_DIR} &>/dev/null
+ (tar cpv $BASICLIBS | tar xpv -C ${STAGE31_DIR}) &>/dev/null
}
generate_squashfs() {
# finalize the initramfs target
- [ ! -d ${STAGE32_DIR} ] && echo "No stage3.2 directory found. Please run setup_tools first." && exit 1
[ -e ${STAGE31_DIR}/mnt/openslx.sqfs ] && rm ${STAGE31_DIR}/mnt/openslx.sqfs
mksquashfs ${STAGE32_DIR} ${STAGE31_DIR}/mnt/openslx.sqfs -comp xz -b 1M -no-recovery 2>/dev/null