From c009e71f911295079103f52b1bb6b541ac0ac559 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Fri, 15 Mar 2013 16:22:46 +0100 Subject: yet another new structure --- remote/modules/debug/debug.build | 19 +++ remote/modules/debug/debug.conf | 2 + remote/modules/hwinfo/hwinfo.build | 26 ++++ remote/modules/hwinfo/hwinfo.conf | 1 + remote/rootfs/rootfs-stage31/data/init | 168 +++++++++++++++++++++ remote/rootfs/rootfs-stage31/rootfs-stage31.build | 134 ++++++++++++++++ remote/rootfs/rootfs-stage31/rootfs-stage31.conf | 67 ++++++++ .../rootfs/rootfs-stage32/data/etc/keymaps/de_DE | Bin 0 -> 2823 bytes remote/rootfs/rootfs-stage32/data/etc/profile | 57 +++++++ .../rootfs-stage32/data/etc/udhcpc.openslx.script | 78 ++++++++++ remote/rootfs/rootfs-stage32/rootfs-stage32.build | 103 +++++++++++++ remote/rootfs/rootfs-stage32/rootfs-stage32.conf | 57 +++++++ .../rootfs-stage32/rootfs-stage32.conf.zypper | 56 +++++++ remote/targets/stage3.1/busybox | 1 + remote/targets/stage3.1/debug | 1 + remote/targets/stage3.1/hwinfo | 1 + remote/targets/stage3.1/plymouth | 1 + remote/targets/stage3.1/rootfs-stage31 | 1 + remote/targets/stage3.2/busybox | 1 + remote/targets/stage3.2/consolekit | 1 + remote/targets/stage3.2/dbus | 1 + remote/targets/stage3.2/debug | 1 + remote/targets/stage3.2/kdm | 1 + remote/targets/stage3.2/plymouth | 1 + remote/targets/stage3.2/policykit | 1 + remote/targets/stage3.2/rootfs-stage32 | 1 + remote/targets/stage3.2/rsyslogd | 1 + remote/targets/stage3.2/sshd | 1 + remote/targets/stage3.2/systemd | 1 + remote/targets/stage3.2/xorg | 1 + 30 files changed, 785 insertions(+) create mode 100644 remote/modules/debug/debug.build create mode 100644 remote/modules/debug/debug.conf create mode 100644 remote/modules/hwinfo/hwinfo.build create mode 100644 remote/modules/hwinfo/hwinfo.conf create mode 100755 remote/rootfs/rootfs-stage31/data/init create mode 100644 remote/rootfs/rootfs-stage31/rootfs-stage31.build create mode 100644 remote/rootfs/rootfs-stage31/rootfs-stage31.conf create mode 100644 remote/rootfs/rootfs-stage32/data/etc/keymaps/de_DE create mode 100644 remote/rootfs/rootfs-stage32/data/etc/profile create mode 100755 remote/rootfs/rootfs-stage32/data/etc/udhcpc.openslx.script create mode 100644 remote/rootfs/rootfs-stage32/rootfs-stage32.build create mode 100644 remote/rootfs/rootfs-stage32/rootfs-stage32.conf create mode 100644 remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper create mode 120000 remote/targets/stage3.1/busybox create mode 120000 remote/targets/stage3.1/debug create mode 120000 remote/targets/stage3.1/hwinfo create mode 120000 remote/targets/stage3.1/plymouth create mode 120000 remote/targets/stage3.1/rootfs-stage31 create mode 120000 remote/targets/stage3.2/busybox create mode 120000 remote/targets/stage3.2/consolekit create mode 120000 remote/targets/stage3.2/dbus create mode 120000 remote/targets/stage3.2/debug create mode 120000 remote/targets/stage3.2/kdm create mode 120000 remote/targets/stage3.2/plymouth create mode 120000 remote/targets/stage3.2/policykit create mode 120000 remote/targets/stage3.2/rootfs-stage32 create mode 120000 remote/targets/stage3.2/rsyslogd create mode 120000 remote/targets/stage3.2/sshd create mode 120000 remote/targets/stage3.2/systemd create mode 120000 remote/targets/stage3.2/xorg diff --git a/remote/modules/debug/debug.build b/remote/modules/debug/debug.build new file mode 100644 index 00000000..e791d347 --- /dev/null +++ b/remote/modules/debug/debug.build @@ -0,0 +1,19 @@ +fetch_source() { + : +} + +build() { + + for BIN in $REQUIRED_BINARIES; do + BIN_LOCATION=$(which ${BIN}) + if [ ! -z ${BIN_LOCATION} -a -e ${BIN_LOCATION} ]; then + tarcopy "$(get_link_chain ${BIN_LOCATION})" "${MODULE_BUILD_DIR}" + else + pwarning "'${BIN}' not found on the system." + fi + done +} + +post_copy() { + : +} diff --git a/remote/modules/debug/debug.conf b/remote/modules/debug/debug.conf new file mode 100644 index 00000000..3eb13363 --- /dev/null +++ b/remote/modules/debug/debug.conf @@ -0,0 +1,2 @@ +REQUIRED_BINARIES=" strace + ldd" diff --git a/remote/modules/hwinfo/hwinfo.build b/remote/modules/hwinfo/hwinfo.build new file mode 100644 index 00000000..383b8c2a --- /dev/null +++ b/remote/modules/hwinfo/hwinfo.build @@ -0,0 +1,26 @@ +fetch_source() { + [ ! -d "${MODULE_DIR}/src" ] && mkdir -p "${MODULE_DIR}/src" + cd "${MODULE_DIR}/src" + git clone git://gitorious.org/opensuse/hwinfo.git + git clone git://gitorious.org/x86emu/libx86emu.git + cd - &> /dev/null +} + +build() { + pdebug "Installing libx86emu in ${MODULE_DIR}/build..." + cd "${MODULE_DIR}/src/libx86emu" + make || perror "libx86emu: make failed." + DESTDIR="${MODULE_DIR}"/build make install || perror "libx86emu: make install failed." + cd - &> /dev/null + + pdebug "Installing hwinfo in ${MODULE_DIR}/build..." + cd "${MODULE_DIR}/src/hwinfo" + make || perror "hwinfo: make failed." + DESTDIR="${MODULE_DIR}/build" make install || perror "hwinfo: make install failed." + cd - &> /dev/null + +} + +post_copy() { + : +} diff --git a/remote/modules/hwinfo/hwinfo.conf b/remote/modules/hwinfo/hwinfo.conf new file mode 100644 index 00000000..af5783a2 --- /dev/null +++ b/remote/modules/hwinfo/hwinfo.conf @@ -0,0 +1 @@ +REQUIRED_BINARIES=" hwinfo" diff --git a/remote/rootfs/rootfs-stage31/data/init b/remote/rootfs/rootfs-stage31/data/init new file mode 100755 index 00000000..ef9c32a7 --- /dev/null +++ b/remote/rootfs/rootfs-stage31/data/init @@ -0,0 +1,168 @@ +#!/bin/sh +# Copyright (c) 2012 - 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 at http://openslx.org +# +# First script for initial ramfs for OpenSLX linux stateless clients +############################################################################# + +export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/openslx/bin:/openslx/sbin +export LD_LIBRARY_PATH=/usr/lib64 + +mount -n -t tmpfs -o 'mode=755' run "/run" + +# mount the important standard directories +[ ! -f /proc/cpuinfo ] && mount -n -t proc proc /proc +[ ! -d /sys/class ] && mount -n -t sysfs sysfs /sys + +echo "/sbin/mdev" > /proc/sys/kernel/hotplug +# read graphic and network adaptor configuration (without proprietary drivers yet) + +( hwinfo --gfxcard > /etc/hwinfo ) & +( hwinfo --netcard > /etc/netcard ) & + +# read kernel command line for debugging switch +read KCL < /proc/cmdline +export KCL +for opts in ${KCL}; do + case ${opts} in + debug*) + DEBUG=1;; + splash*) + SPLASH=1;; + ip=*) + # process IP info + ipinfo=${opts#ip=};; + nfs=*) + nfs=${opts#nfs=} + nfspath=${nfs#*:} + nfsserver=${nfs%:/*} + ;; + esac +done + +while ps | grep -v grep | grep -q " hwinfo --gfxcard" ; do usleep 10 ; done + +# always load framebuffer +modprobe uvesafb mode_option=1024x768-32 mtrr=3 scroll=ywrap + +case $(cat /etc/hwinfo) in + *i915*) + modprobe -a i915 2>/dev/null + ;; + *intel*|*Intel*) + modprobe -a i810 i830 i915 2>/dev/null + ;; + *nvidia*|*NVidia*|*nouveau*) + modprobe -q nouveau 2>/dev/null + ;; + *radeon*|*Radeon*) + modprobe -q radeon 2>/dev/null + ;; + *mga*|*matrox*|*Matrox*) + modprobe -q mga 2>/dev/null + ;; + *VMWARE*) + modprove -q vmwgfx 2>/dev/null + ;; + *) + modprobe -qa r128 savage sis tdfx ttm via viafb + ;; +esac +(modprobe -a drm; mdev -s ) & + +if [ "x$SPLASH" == "x1" ]; then + # start plymouth + plymouthd && plymouth show-splash +fi + +# load required network and usb controller drivers, filter out wireless adaptors +while ps | grep -v grep | grep -q " hwinfo --netcard" ; do usleep 10 ; done +nwcardlist="forcedeth|e1000e|e1000|e100|tg3|via-rhine|r8169|pcnet32" +echo "modprobe -qa usbhid hid-bright" >/etc/modprobe.base +grep modprobe /etc/netcard | grep -E "$nwcardlist" \ + | sed 's/.* Cmd: "//;s/"//;s/modprobe/modprobe -qb/' \ + | sort -u >>/etc/modprobe.base +# virtio hack +if [ $(grep -ic "virtio_pci" /etc/modprobe.base) -ge 1 ]; then + echo "modprobe -q virtio_net" >>/etc/modprobe.base +fi +/bin/sh /etc/modprobe.base; mdev -s + +# setup network +nwif="eth0" +# set up loopback networking +[ $DEBUGLEVEL -eq 20 ] && echo "** starting ip config at $(sysup)" +ip link set dev lo up 2>/dev/null +ip addr add 127.0.0.1/8 dev lo 2>/dev/null +ip link set dev $nwif up 2>/dev/null || { echo "No link for $nwif, dropping to shell.."; setsid sh -c 'exec sh /dev/tty1 2>&1'; } + +# analyze ip information from the kernel command line and put parts +# of it into several variables +if [ -n "$ipinfo" ] ; then + getip () { + local val="$ipinfo:"; i=$(($1 - 1)); + while [ $i -gt 0 ] ; do + val=${val#*:} ; i=$(($i - 1)); + done; + echo $val|sed "s/:.*//"; } + clientip=$(getip 1) + serverip=$(getip 2) + gateway=$(getip 3) + subnet_mask=$(getip 4) + broadcast_address=$(ipcalc -s -b $clientip $subnet_mask|sed s/.*=//) + [ -z "$broadcast_address" ] && broadcast_address=255.255.255.255 + # we might have an idea of the dns server via preboot + dns_srv=$(getip 5) + [ -n "$dns_srv" ] && echo nameserver $dns_srv >/etc/resolv.conf; + echo -e "# ip configuration written by $0 script:\nclientip=$clientip\n\ +subnet_mask=$subnet_mask\ngateway=$gateway\nserverip=$serverip\n\ +broadcast_address=$broadcast_address" >>/etc/initramfs-setup + # set static ip address + ip addr add $clientip/$(ipcalc -s -p $clientip $subnet_mask|sed s/.*=//) \ + broadcast $broadcast_address dev $nwif 2>/dev/null + ip route add default via $gateway 2>/dev/null +else + noipyet="yes" +fi + + +# load local file systems +modprobe aufs +modprobe squashfs + +mkdir -p /dev/shm/union /dev/shm/uniontmp /rorootfs +mount -n -t tmpfs none /dev/shm/uniontmp + +if [ -n "$nfs" ] ; then + mount -t nfs -o ro,async,nolock ${nfsserver}:${nfspath} /rorootfs || { echo "Problem mounting NFS-Directory from ${nfsserver}:${nfspath}. Dropping to DEBUG shell."; DEBUG=1; } +else + mount -n /mnt/openslx.sqfs /rorootfs || { echo "Problem mounting Squashfs. Dropping to DEBUG shell."; DEBUG=1; } +fi + +mount -n -t aufs -o br:/dev/shm/uniontmp:/rorootfs=ro none /mnt +mkdir -p /mnt/uniontmp /mnt/tmp +mount -n --move /dev/shm/uniontmp /mnt/uniontmp + +if [ $DEBUG -ge 1 ]; then + echo "Starting debug shell, CTRL + D will start Stage 3.2." + setsid sh -c 'exec sh /dev/tty1 2>&1' +else + #Debug is not set so hide kernel debug output + echo "0 0 0 0" >/proc/sys/kernel/printk +fi + +for mnt in proc sys run ; do + umount -n $mnt +done + +unset BOOT_IMAGE initrd +[ "x$SPLASH" = "x1" ] && plymouth update-root-fs --new-root-dir=/mnt +# new style of pivoting (switch_root or run-init) +exec /sbin/switch_root -c /dev/console /mnt /usr/lib/systemd/systemd diff --git a/remote/rootfs/rootfs-stage31/rootfs-stage31.build b/remote/rootfs/rootfs-stage31/rootfs-stage31.build new file mode 100644 index 00000000..d0a95238 --- /dev/null +++ b/remote/rootfs/rootfs-stage31/rootfs-stage31.build @@ -0,0 +1,134 @@ +#!/bin/bash +fetch_source() { + : +} + +build() { + + BUILDDIR="${TARGET_DIR}/${MODULE}/build" + + FILELIST="list_binaries_and_files" + [ -e "${FILELIST}" ] && rm "${FILELIST}" + + for BIN in ${REQUIRED_BINARIES} + do + BIN_LOCATION=$(which ${BIN}) + if [ ! -z ${BIN_LOCATION} -a -e ${BIN_LOCATION} ]; + then + pdebug "Processing $BIN at $BIN_LOCATION ..." + get_link_chain ${BIN_LOCATION} >> "${FILELIST}" + else + perror "${BIN} not found on the system! Please install it." + fi + done + + for FILE in ${REQUIRED_DIRECTORIES} + do + [ ! -d ${FILE} ] && perror "Missing required directory $FILE" + echo ${FILE} >> "${FILELIST}" + done + for FILE in ${REQUIRED_FILES} + do + [ ! -f ${FILE} ] && perror "Missing required file $FILE" + echo ${FILE} >> "${FILELIST}" + done + + local NUMFILES=$(cat "${FILELIST}" | wc -l) + if [ "x$NUMFILES" != "x" -a "x$NUMFILES" != "x0" ]; then + pinfo "File list generated at ${BUILDDIR}/${FILELIST} ($NUMFILES entries)" + tarcopy "$(cat "${FILELIST}")" "${BUILDDIR}" + fi +} + +post_copy() { + generate_rootfs + copy_kernel_modules + generate_modules_map_files + copy_firmware +} + +generate_rootfs() { + # create basic directory structure + mkdir -p "${TARGET_BUILD_DIR}"/{bin,dev,proc,run,etc,mnt,sys} \ + || perror "Cannot create basic directory structure in '${TARGET_BUILD_DIR}'" + + # copy device files from running system + cp -a /dev/{console,kmsg,mem,null,tty,tty0,tty1,tty9,urandom,zero} \ + "${TARGET_BUILD_DIR}"/dev || perror "Cannot copy devices from running system" + + # copy libc and ld-linux + tarcopy "$(list_basic_libs)" "${TARGET_BUILD_DIR}" + + # copy required files + tarcopy "${REQUIRED_FILES}" "${TARGET_BUILD_DIR}" + + # copy static data + cp -r "${MODULE_DIR}"/core/data/* "${TARGET_BUILD_DIR}" +} + +copy_kernel_modules() { + + local MODLIST="stage31_modules_list" + [ -e $MODLIST ] && rm -f $MODLIST + + # process modules list + for MOD in ${REQUIRED_MODULES}; do + local MOD_PATH="/lib/modules/${KERNEL_VERSION}/${MOD}" + if [ ! -e "${MOD_PATH}" ]; then + pwarning "Module $MOD not found. Skipping. (might cause problem on certain clients!)" + continue + else + pdebug "Copying "${MOD_PATH}"" + echo "${MOD_PATH}" >> "${MODLIST}" + fi + done + + if [ -s "$MODLIST" ]; then + local MODLISTCOUNT=$(cat "$MODLIST" | wc -l) + pinfo "Copying $MODLISTCOUNT modules to stage 3.1 target directory." + tarcopy "$(cat "$MODLIST")" "${TARGET_BUILD_DIR}" + fi + +} + +generate_modules_map_files() { + + # first strip modules.order of all the modules we don't use + cat /lib/modules/"${KERNEL_VERSION}"/modules.order | grep -E $(echo ${REQUIRED_MODULES} | tr '\ ' '|') \ + >> "${TARGET_BUILD_DIR}"/lib/modules/"${KERNEL_VERSION}"/modules.order + + # copy list of builtin kernel modules + cp /lib/modules/"${KERNEL_VERSION}"/modules.builtin "${TARGET_BUILD_DIR}"/lib/modules/"${KERNEL_VERSION}" + # with modules.order and modules.builtin, we can run depmod for the rest of the files + depmod -b "${TARGET_BUILD_DIR}" +} + +copy_firmware() { + + local FWLIST="stage31_firmware_list" + [ -e $FWLIST ] && rm -f $FWLIST + + local FW_PATH="/lib/firmware" + + # process firmware list + for FW in ${REQUIRED_FIRMWARE}; do + local FOUND=0 + if [ -e "${FW_PATH}"/"${FW}" ]; then + pdebug "Copying "${FW_PATH}"/"${FW}"" + echo "${FW_PATH}"/"${FW}" >> "$FWLIST" + FOUND=1 + fi + if [ -e "${FW_PATH}"/"${KERNEL_VERSION}"/"${FW}" ]; then + pdebug "Copying "${FW_PATH}"/"${KERNEL_VERSION}"/"${FW}"" + echo "${FW_PATH}"/"${KERNEL_VERSION}"/"${FW}" >> "$FWLIST" + FOUND=1 + fi + [ $FOUND -ne 1 ] && pwarning "Neither "${FW_PATH}"/"${FW}" nor "${FW_PATH}"/"${KERNEL_VERSION}"/"${FW}" found on the system." + done + + if [ -s "${FWLIST}" ]; then + local FWLISTCOUNT=$(cat "$FWLIST"|wc -l) + pinfo "Copying $FWLISTCOUNT firmware to stage 3.1 target directory." + tarcopy "$(cat "$FWLIST")" "${TARGET_BUILD_DIR}" + fi +} diff --git a/remote/rootfs/rootfs-stage31/rootfs-stage31.conf b/remote/rootfs/rootfs-stage31/rootfs-stage31.conf new file mode 100644 index 00000000..4015e4a3 --- /dev/null +++ b/remote/rootfs/rootfs-stage31/rootfs-stage31.conf @@ -0,0 +1,67 @@ +REQUIRED_MODULES=" kernel/drivers/video/sis/sisfb.ko + kernel/drivers/video/via/viafb.ko + kernel/drivers/video/uvesafb.ko + kernel/drivers/acpi/video.ko + kernel/drivers/ssb/ssb.ko + kernel/drivers/gpu/drm/ttm/ttm.ko + kernel/drivers/gpu/drm/via/via.ko + kernel/drivers/gpu/drm/drm.ko + kernel/drivers/gpu/drm/tdfx/tdfx.ko + kernel/drivers/gpu/drm/nouveau/nouveau.ko + kernel/drivers/gpu/drm/savage/savage.ko + kernel/drivers/gpu/drm/radeon/radeon.ko + kernel/drivers/gpu/drm/drm_kms_helper.ko + kernel/drivers/gpu/drm/i810/i810.ko + kernel/drivers/gpu/drm/i2c/ch7006.ko + kernel/drivers/gpu/drm/i2c/sil164.ko + kernel/drivers/gpu/drm/sis/sis.ko + kernel/drivers/gpu/drm/mga/mga.ko + kernel/drivers/gpu/drm/i915/i915.ko + kernel/drivers/gpu/drm/r128/r128.ko + kernel/drivers/gpu/drm/vmwgfx/vmwgfx.ko + kernel/drivers/i2c/algos/i2c-algo-bit.ko + kernel/drivers/net/netconsole.ko + kernel/drivers/net/ethernet/realtek/8139too.ko + kernel/drivers/net/ethernet/realtek/r8169.ko + kernel/drivers/net/ethernet/nvidia/forcedeth.ko + kernel/drivers/net/ethernet/via/via-rhine.ko + kernel/drivers/net/ethernet/amd/pcnet32.ko + kernel/drivers/net/ethernet/atheros/atl1e/atl1e.ko + kernel/drivers/net/ethernet/atheros/atl1c/atl1c.ko + kernel/drivers/net/ethernet/sis/sis900.ko + kernel/drivers/net/ethernet/broadcom/tg3.ko + kernel/drivers/net/ethernet/broadcom/b44.ko + kernel/drivers/net/ethernet/intel/e1000/e1000.ko + kernel/drivers/net/ethernet/intel/e1000e/e1000e.ko + kernel/drivers/net/ethernet/intel/e100.ko + kernel/drivers/net/ethernet/marvell/skge.ko + kernel/drivers/net/ethernet/3com/3c59x.ko + kernel/drivers/net/ethernet/dec/tulip/tulip.ko + kernel/drivers/hid/hid.ko + kernel/drivers/hid/usbhid/usbhid.ko + kernel/drivers/platform/x86/wmi.ko + kernel/drivers/platform/x86/mxm-wmi.ko + kernel/fs/configfs/configfs.ko + kernel/fs/nfs_common/nfs_acl.ko + kernel/fs/nfs/nfs.ko + kernel/fs/fscache/fscache.ko + kernel/fs/lockd/lockd.ko + kernel/fs/squashfs/squashfs.ko + kernel/net/sunrpc/sunrpc.ko + kernel/net/sunrpc/auth_gss/auth_rpcgss.ko + kernel/net/802/stp.ko + kernel/net/bridge/bridge.ko + kernel/ubuntu/aufs/aufs.ko" +REQUIRED_FIRMWARE=" 3com/ + e100/ + matrox/ + r128/ + radeon/ + RTL8192E/ + RTL8192SE/ + rtl_nic/ + tigon/" +REQUIRED_FILES=" /etc/netconfig + /etc/networks + /etc/protocols + /etc/services" diff --git a/remote/rootfs/rootfs-stage32/data/etc/keymaps/de_DE b/remote/rootfs/rootfs-stage32/data/etc/keymaps/de_DE new file mode 100644 index 00000000..375c2012 Binary files /dev/null and b/remote/rootfs/rootfs-stage32/data/etc/keymaps/de_DE differ diff --git a/remote/rootfs/rootfs-stage32/data/etc/profile b/remote/rootfs/rootfs-stage32/data/etc/profile new file mode 100644 index 00000000..3784e784 --- /dev/null +++ b/remote/rootfs/rootfs-stage32/data/etc/profile @@ -0,0 +1,57 @@ +# ~/.bashrc: executed by bash(1) for non-login interactive shells. + +export PATH=\ +/bin:\ +/sbin:\ +/usr/bin:\ +/usr/sbin:\ +/openslx/bin:\ +/openslx/sbin:\ +/openslx/usr/bin:\ +/openslx/usr/sbin + +# If running interactively, then: +if [ "$PS1" ]; then + + if [ "$BASH" ]; then + export PS1="[\u@\h \W]\\$ " + alias ll='ls --color=auto -laFh' + alias ls='ls --color=auto -F' + export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.png=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:'; + else + if [ "`id -u`" -eq 0 ]; then + export PS1='# ' + else + export PS1='$ ' + fi + fi + + export USER=`id -un` + export LOGNAME=$USER + export HOSTNAME=`hostname` + export HISTSIZE=1000 + export HISTFILESIZE=1000 + export PAGER='/bin/more ' + export EDITOR='/bin/vi' + export INPUTRC=/etc/inputrc + export DMALLOC_OPTIONS=debug=0x34f47d83,inter=100,log=logfile + + ### Some aliases + alias ps2='ps facux ' + alias ps1='ps faxo "%U %t %p %a" ' + alias af='ps af' + alias cls='clear' + alias df='df -h' + alias indent='indent -bad -bap -bbo -nbc -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -cp33 -cs -d0 -di1 -nfc1 -nfca -hnl -i4 -ip0 -l75 -lp -npcs -npsl -nsc -nsob -nss -ts4 ' + #alias bc='bc -l' + alias minicom='minicom -c on' + alias calc='calc -Cd ' + alias bc='calc -Cd ' +fi; + +# Source configuration files from /etc/profile.d +for i in /etc/profile.d/*.sh ; do + if [ -r "$i" ]; then + . $i + fi +done diff --git a/remote/rootfs/rootfs-stage32/data/etc/udhcpc.openslx.script b/remote/rootfs/rootfs-stage32/data/etc/udhcpc.openslx.script new file mode 100755 index 00000000..bff430ef --- /dev/null +++ b/remote/rootfs/rootfs-stage32/data/etc/udhcpc.openslx.script @@ -0,0 +1,78 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# +# Copyright (c) 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/ +# ----------------------------------------------------------------------------- +# +# Mini-Linux Toolkit +# +# ----------------------------------------------------------------------------- + + +RESOLV_CONF="/etc/resolv.conf" +IP_CONF="/tmp/udhcpc_ip_config" + +export PATH=$PATH:/openslx/sbin:/openslx/bin + +case $1 in + bound|renew) + + [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" + [ -n "$subnet" ] && NETMASK="netmask $subnet" + + ip addr add $ip/$(ipcalc -s -p $ip $subnet|sed s/.*=//) dev $interface + ip route add default via $router + + echo "ip=$ip" > $IP_CONF + echo "subnet=$subnet" >> $IP_CONF + echo "broadcast=$broadcast" >> $IP_CONF + echo "gateway=$router" >> $IP_CONF + + # Update resolver configuration file + R="" + [ -n "$domain" ] && R="domain $domain +" + count=1; + for i in $dns; do + echo "$0: Adding DNS $i" + R="${R}nameserver $i +" + count=$((count+1)); + done + + if [ -x /sbin/resolvconf ]; then + echo -n "$R" | resolvconf -a "${interface}.udhcpc" + else + echo -n "$R" > "$RESOLV_CONF" + fi + + # TODO i.e. event trigger + systemctl start nfs-mount.service + + ;; + + deconfig) + + ;; + + leasefail) + echo "$0: Lease failed: $message" + ;; + + nak) + echo "$0: Received a NAK: $message" + ;; + + *) + echo "$0: Unknown udhcpc command: $1"; + exit 1; + ;; +esac diff --git a/remote/rootfs/rootfs-stage32/rootfs-stage32.build b/remote/rootfs/rootfs-stage32/rootfs-stage32.build new file mode 100644 index 00000000..c704752b --- /dev/null +++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.build @@ -0,0 +1,103 @@ +#!/bin/bash +fetch_source() { + : +} + +build() { + + FILELIST="list_binaries_and_files" + [ -e "${FILELIST}" ] && rm "${FILELIST}" + + for BIN in ${REQUIRED_BINARIES} + do + BIN_LOCATION=$(which ${BIN}) + if [ ! -z ${BIN_LOCATION} -a -e ${BIN_LOCATION} ]; + then + pdebug "Processing $BIN at $BIN_LOCATION ..." + get_link_chain ${BIN_LOCATION} >> "${FILELIST}" + else + perror "${BIN} not found on the system! Please install it." + fi + done + + for LIB in ${REQUIRED_LIBRARIES} + do + for LIB_LOCATION in $(find /lib/ -name "${LIB}.so*") + do + get_link_chain "${LIB_LOCATION}" >> "${FILELIST}" + done + done + + for FILE in ${REQUIRED_DIRECTORIES} + do + [ ! -d ${FILE} ] && perror "Missing required directory $FILE" + echo ${FILE} >> "${FILELIST}" + done + for FILE in ${REQUIRED_FILES} + do + [ ! -f ${FILE} ] && perror "Missing required file $FILE" + echo ${FILE} >> "${FILELIST}" + done + + local NUMFILES=$(cat "${FILELIST}" | wc -l) + if [ "x$NUMFILES" != "x" -a "x$NUMFILES" != "x0" ]; then + pinfo "File list generated at ${MODULE_BUILD_DIR}/${FILELIST} ($NUMFILES entries)" + tarcopy "$(cat "${FILELIST}")" "${MODULE_BUILD_DIR}" + fi +} + +post_copy() { + + # make basic directory structure + mkdir -p "${TARGET_BUILD_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} \ + "${TARGET_BUILD_DIR}"/dev || perror "Copying devices from running system failed." + + # set /etc/environment to include /openslx/bin and /openslx/sbin + echo "PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/openslx/sbin:/openslx/bin\"" \ + > "${TARGET_BUILD_DIR}/etc/environment" + + # copy static files + cp -r "${MODULE_DIR}"/data/* "${TARGET_BUILD_DIR}" || perror "Copying static files from data/* failed." + + # quick fix for /etc/fstab + echo "# no configuration" >> "${TARGET_BUILD_DIR}/etc/fstab" + + # link /etc/mtab, needed for systemd + [ ! -e ${TARGET_BUILD_DIR}/etc/mtab ] && ln -s /proc/self/mounts ${TARGET_BUILD_DIR}/etc/mtab + + # passwd, group, shadow + init_users_and_groups + + # quick fix for missing group in /etc/group + add_group "lock" + + # setup root accoun + USER=root PASSWORD='!r00t' add_user + + mkdir -p ${TARGET_BUILD_DIR}/root + + echo "minilinux-$(hostname)" > "${TARGET_BUILD_DIR}/etc/hostname" + #check for kernel modules, if not present copy from system + if [ ! -d ${TARGET_BUILD_DIR}/lib/modules ]; + then + pinfo "Copying modules for kernel $(uname -r)..." + mkdir -p "${TARGET_BUILD_DIR}/lib/modules" || perror "Cannot create '${TARGET_BUILD_DIR}/lib/modules'" + cp -r "/lib/modules/$(uname -r)" "${TARGET_BUILD_DIR}/lib/modules/" || perror "Cannot copy kernel modules from '/lib/modules/$(uname -r)' '${TARGET_BUILD_DIR}/lib/modules/'" + else + pinfo "Not copying kernel modules from system, as '${TARGET_BUILD_DIR}/lib/modules/' already exists." + fi + + #check for firmware, if not present copy from system + if [ ! -d ${TARGET_BUILD_DIR}/lib/firmware ]; + then + pinfo "Copying firmware for kernel $(uname -r)..." + cp -r "/lib/firmware" "${TARGET_BUILD_DIR}/lib/" || perror "Cannot copy kernel modules from '/lib/firmware' '${TARGET_BUILD_DIR}/lib/'" + else + pinfo "Not copying firmware from system, as '${TARGET_BUILD_DIR}/lib/firmware' already exists." + fi + +} + diff --git a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf new file mode 100644 index 00000000..9f8f822d --- /dev/null +++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf @@ -0,0 +1,57 @@ +REQUIRED_DEPENDENCIES="nfs-common aufs-tools squashfs-tools whois" +REQUIRED_BINARIES=" bash + agetty + cat + false + loadkeys + setfont + login + sulogin + mount + umount + mount.nfs4 + umount.nfs4 + mount.aufs + rm + blkid + modprobe + ps + scp + ssh + xterm" +REQUIRED_LIBRARIES=" libcap + libcidn + libcom_err + libcrypt + libcrypto + libnsl + libnss_compat + libnss_dns + libnss_files + libnss_hesiod + libnss_nis + libnss_nisplus + libpam + libutil + libtinfo + libresolv + libau" +REQUIRED_DIRECTORIES=" /etc/pam.d + /etc/security + /lib/security + /lib/$ARCH_TRIPLET/security" +REQUIRED_FILES=" /etc/environment + /etc/pam.conf + /etc/issue + /etc/inputrc + /etc/localtime + /etc/login.defs + /etc/nsswitch.conf + /etc/securetty + /etc/default/locale + /etc/default/aufs + /etc/protocols + /etc/services + /etc/networks + /etc/netconfig + /etc/modprobe.d/blacklist.conf" diff --git a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper new file mode 100644 index 00000000..084bff5c --- /dev/null +++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper @@ -0,0 +1,56 @@ +REQUIRED_DEPENDENCIES="nfs-client aufs squashfs" +REQUIRED_BINARIES=" bash + agetty + cat + false + loadkeys + setfont + login + sulogin + mount + umount + mount.nfs4 + umount.nfs4 + mount.aufs + rm + ldd + strace + blkid + modprobe + rsyslogd + ps + scp + ssh" +REQUIRED_LIBRARIES=" libcap + libcidn + libcom_err + libcrypt + libcrypto + libnsl + libnss_compat + libnss_dns + libnss_files + libnss_hesiod + libnss_nis + libnss_nisplus + libpam + libutil + libtinfo + libresolv + libau" +REQUIRED_DIRECTORIES=" /etc/pam.d + /etc/security" +REQUIRED_FILES=" /etc/environment + /etc/pam.conf + /etc/issue + /etc/inputrc + /etc/localtime + /etc/login.defs + /etc/nsswitch.conf + /etc/securetty + /etc/default/locale + /etc/default/aufs + /etc/protocols + /etc/services + /etc/networks + /etc/netconfig" diff --git a/remote/targets/stage3.1/busybox b/remote/targets/stage3.1/busybox new file mode 120000 index 00000000..4f45cedf --- /dev/null +++ b/remote/targets/stage3.1/busybox @@ -0,0 +1 @@ +../../modules/busybox \ No newline at end of file diff --git a/remote/targets/stage3.1/debug b/remote/targets/stage3.1/debug new file mode 120000 index 00000000..c05237d6 --- /dev/null +++ b/remote/targets/stage3.1/debug @@ -0,0 +1 @@ +../../modules/debug \ No newline at end of file diff --git a/remote/targets/stage3.1/hwinfo b/remote/targets/stage3.1/hwinfo new file mode 120000 index 00000000..6007a018 --- /dev/null +++ b/remote/targets/stage3.1/hwinfo @@ -0,0 +1 @@ +../../modules/hwinfo \ No newline at end of file diff --git a/remote/targets/stage3.1/plymouth b/remote/targets/stage3.1/plymouth new file mode 120000 index 00000000..66a16832 --- /dev/null +++ b/remote/targets/stage3.1/plymouth @@ -0,0 +1 @@ +../../modules/plymouth \ No newline at end of file diff --git a/remote/targets/stage3.1/rootfs-stage31 b/remote/targets/stage3.1/rootfs-stage31 new file mode 120000 index 00000000..05a91970 --- /dev/null +++ b/remote/targets/stage3.1/rootfs-stage31 @@ -0,0 +1 @@ +../../rootfs/rootfs-stage31 \ No newline at end of file diff --git a/remote/targets/stage3.2/busybox b/remote/targets/stage3.2/busybox new file mode 120000 index 00000000..4f45cedf --- /dev/null +++ b/remote/targets/stage3.2/busybox @@ -0,0 +1 @@ +../../modules/busybox \ No newline at end of file diff --git a/remote/targets/stage3.2/consolekit b/remote/targets/stage3.2/consolekit new file mode 120000 index 00000000..261968c7 --- /dev/null +++ b/remote/targets/stage3.2/consolekit @@ -0,0 +1 @@ +../../modules/consolekit \ No newline at end of file diff --git a/remote/targets/stage3.2/dbus b/remote/targets/stage3.2/dbus new file mode 120000 index 00000000..dd148715 --- /dev/null +++ b/remote/targets/stage3.2/dbus @@ -0,0 +1 @@ +../../modules/dbus \ No newline at end of file diff --git a/remote/targets/stage3.2/debug b/remote/targets/stage3.2/debug new file mode 120000 index 00000000..c05237d6 --- /dev/null +++ b/remote/targets/stage3.2/debug @@ -0,0 +1 @@ +../../modules/debug \ No newline at end of file diff --git a/remote/targets/stage3.2/kdm b/remote/targets/stage3.2/kdm new file mode 120000 index 00000000..727ed5b5 --- /dev/null +++ b/remote/targets/stage3.2/kdm @@ -0,0 +1 @@ +../../modules/kdm \ No newline at end of file diff --git a/remote/targets/stage3.2/plymouth b/remote/targets/stage3.2/plymouth new file mode 120000 index 00000000..66a16832 --- /dev/null +++ b/remote/targets/stage3.2/plymouth @@ -0,0 +1 @@ +../../modules/plymouth \ No newline at end of file diff --git a/remote/targets/stage3.2/policykit b/remote/targets/stage3.2/policykit new file mode 120000 index 00000000..39b77c7f --- /dev/null +++ b/remote/targets/stage3.2/policykit @@ -0,0 +1 @@ +../../modules/policykit \ No newline at end of file diff --git a/remote/targets/stage3.2/rootfs-stage32 b/remote/targets/stage3.2/rootfs-stage32 new file mode 120000 index 00000000..96dcbb86 --- /dev/null +++ b/remote/targets/stage3.2/rootfs-stage32 @@ -0,0 +1 @@ +../../rootfs/rootfs-stage32 \ No newline at end of file diff --git a/remote/targets/stage3.2/rsyslogd b/remote/targets/stage3.2/rsyslogd new file mode 120000 index 00000000..339d02f8 --- /dev/null +++ b/remote/targets/stage3.2/rsyslogd @@ -0,0 +1 @@ +../../modules/rsyslogd \ No newline at end of file diff --git a/remote/targets/stage3.2/sshd b/remote/targets/stage3.2/sshd new file mode 120000 index 00000000..56b4e4b5 --- /dev/null +++ b/remote/targets/stage3.2/sshd @@ -0,0 +1 @@ +../../modules/sshd \ No newline at end of file diff --git a/remote/targets/stage3.2/systemd b/remote/targets/stage3.2/systemd new file mode 120000 index 00000000..2dc58bd3 --- /dev/null +++ b/remote/targets/stage3.2/systemd @@ -0,0 +1 @@ +../../modules/systemd \ No newline at end of file diff --git a/remote/targets/stage3.2/xorg b/remote/targets/stage3.2/xorg new file mode 120000 index 00000000..a9494860 --- /dev/null +++ b/remote/targets/stage3.2/xorg @@ -0,0 +1 @@ +../../modules/xorg \ No newline at end of file -- cgit v1.2.3-55-g7522