diff options
| author | Jonathan Bauer | 2012-12-20 15:33:34 +0100 |
|---|---|---|
| committer | Jonathan Bauer | 2012-12-20 15:33:34 +0100 |
| commit | f6dad6269ab3228ead055291b846d2a9edb04564 (patch) | |
| tree | 30096a5fbd037fe4f9f0a0ef2b68d04317883c8e /remote | |
| parent | static unit files for dbus, cleanup (diff) | |
| download | tm-scripts-f6dad6269ab3228ead055291b846d2a9edb04564.tar.gz tm-scripts-f6dad6269ab3228ead055291b846d2a9edb04564.tar.xz tm-scripts-f6dad6269ab3228ead055291b846d2a9edb04564.zip | |
mltk basic script :)
Diffstat (limited to 'remote')
20 files changed, 228 insertions, 54 deletions
diff --git a/remote/setup-tools.sh b/remote/setup_tools index 639ec14f..cf96df7b 100755 --- a/remote/setup-tools.sh +++ b/remote/setup_tools @@ -1,24 +1,10 @@ #!/bin/bash -ROOT_DIR=$(dirname $(readlink -f $0)) -SELF=$(readlink -f $0) - -print_usage() { - echo "create tools for minilinux" - echo "Usage: $(basename ${SELF}) TOOL" -} - -if [ "x$1" = "x" ]; then - print_usage - exit 0 -elif [ "x$(whoami)" != "xroot" ]; then - echo "ERROR: You need to have root rights to install packages." - exit 1 -fi +MODULE_DIR=${ROOT_DIR}/remote #Create tools directory if not exists -TOOL_DIR=${ROOT_DIR}/tools -INIT_DIR=${ROOT_DIR}/stage3.2 +TOOL_DIR=${MODULE_DIR}/tools +INIT_DIR=${MODULE_DIR}/stage3.2 setup_git () { @@ -140,14 +126,18 @@ get_basic_libs () { echo "Basic libs copied." } -main () { +generate_stage32 () { - if [ "x$1" = "xall" ]; then - tools=$(ls $ROOT_DIR/tools) + # if no arguments assume all. + if [ "x$1" = "x" -o "x$1" = "xall" ]; then + tools=$(ls ${TOOL_DIR}) set -- $tools - fi + 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 @@ -171,4 +161,28 @@ main () { } -main $@ +clean_sys() { + if [ "x$1" = "x" -o "x$1" = "xall" ]; then + #clean all + [ -d ${INIT_DIR} ] && rm -rf ${INIT_DIR} + for TOOL in $(ls ${TOOL_DIR}); do + clean_tool $TOOL + done + else + while (( "$#" )); do + clean_tool $1 + shift + done + fi +} +clean_tool() { + TOOLDIR=${TOOL_DIR}/$1 + echo "Cleaning ${TOOLDIR}" + [ -e ${TOOLDIR}/.built ] && rm ${TOOLDIR}/.built + [ -e ${TOOLDIR}/.fetched_source ] && rm ${TOOLDIR}/.fetched_source + [ -d ${TOOLDIR}/build ] && rm -rf ${TOOLDIR}/build + [ -d ${TOOLDIR}/src ] && rm -rf ${TOOLDIR}/src + [ -e ${TOOLDIR}/list_binaries_and_files ] && rm ${TOOLDIR}/list_binaries_and_files +} + +#generate_stage32 $@ diff --git a/remote/tools/base/base.build b/remote/tools/base/base.build index fb7b7294..a56982fa 100644 --- a/remote/tools/base/base.build +++ b/remote/tools/base/base.build @@ -52,8 +52,8 @@ post_copy() { echo "PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/openslx/sbin:/openslx/bin\"" \ > ${INIT_DIR}/etc/environment - # copy static bash profile - cp ${TOOL_DIR}/${TOOL}/data/profile ${INIT_DIR}/etc + # copy static files + cp -r ${TOOL_DIR}/${TOOL}/data/* ${INIT_DIR} # 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 diff --git a/remote/tools/base/data/README b/remote/tools/base/data/README deleted file mode 100644 index 48aab378..00000000 --- a/remote/tools/base/data/README +++ /dev/null @@ -1,3 +0,0 @@ -Static files to customized the basic system - -Here comes things like bash config, pam config, etc diff --git a/remote/tools/base/data/profile b/remote/tools/base/data/etc/profile index 12e75661..3784e784 100644 --- a/remote/tools/base/data/profile +++ b/remote/tools/base/data/etc/profile @@ -15,8 +15,8 @@ if [ "$PS1" ]; then if [ "$BASH" ]; then export PS1="[\u@\h \W]\\$ " - alias ll='ls -laFh' - alias ls='ls -F' + 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 diff --git a/remote/tools/base/data/etc/systemd/system/network-fast.service b/remote/tools/base/data/etc/systemd/system/network-fast.service new file mode 100644 index 00000000..6656b189 --- /dev/null +++ b/remote/tools/base/data/etc/systemd/system/network-fast.service @@ -0,0 +1,8 @@ +[Unit] +Description=Setup Network Connection +After=udev.service + +[Service] +ExecPre=/openslx/bin/ip link set dev eth0 up +ExecStart=/openslx/sbin/udhcpc -O domain -O nissrv -O nisdomain -t 8 -s /etc/udhcpc.default.script -i eth0 + diff --git a/remote/tools/base/data/etc/udhcpc.default.script b/remote/tools/base/data/etc/udhcpc.default.script new file mode 100755 index 00000000..09442a5e --- /dev/null +++ b/remote/tools/base/data/etc/udhcpc.default.script @@ -0,0 +1,64 @@ +#!/bin/sh +# Busybox udhcpc dispatcher script. Copyright (C) 2009 by Axel Beckert. +# +# Based on the busybox example scripts and the old udhcp source +# package default.* scripts. + +RESOLV_CONF="/etc/resolv.conf" + +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 + + # read filename from fbgui.conf where ip config should be saved. + ipconf=$(cat /etc/fbgui.conf | grep ip_config | cut -d '=' -f2) + + echo "ip=$ip" > $ipconf + echo "subnet=$subnet" >> $ipconf + echo "broadcast=$broadcast" >> $ipconf + echo "gateway=$router" >> $ipconf + echo "$ip:132.230.4.3:$router:$subnet" > /tmp/ip_config_fbgui + + # 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 + trigger=$(cat /etc/fbgui.conf | grep file_trigger | cut -d '=' -f2) + + echo "gogo" >> $trigger + ;; + + 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/tools/plymouth/data/etc/systemd/system/plymouth-halt.service b/remote/tools/plymouth/data/etc/systemd/system/plymouth-halt.service new file mode 100644 index 00000000..d01ba9b8 --- /dev/null +++ b/remote/tools/plymouth/data/etc/systemd/system/plymouth-halt.service @@ -0,0 +1,11 @@ +[Unit] +Description=Show Plymouth Halt Screen +After=getty@tty1.service prefdm.service plymouth-start.service +Before=halt.service +DefaultDependencies=no +ConditionKernelCommandLine=!plymouth.enable=0 + +[Service] +ExecStart=/sbin/plymouthd --mode=shutdown --attach-to-session +ExecStartPost=-/bin/plymouth show-splash +Type=forking diff --git a/remote/tools/plymouth/data/etc/systemd/system/plymouth-kexec.service b/remote/tools/plymouth/data/etc/systemd/system/plymouth-kexec.service new file mode 100644 index 00000000..1fe6e47f --- /dev/null +++ b/remote/tools/plymouth/data/etc/systemd/system/plymouth-kexec.service @@ -0,0 +1,11 @@ +[Unit] +Description=Show Plymouth Reboot with kexec Screen +After=getty@tty1.service prefdm.service plymouth-start.service +Before=kexec.service +DefaultDependencies=no +ConditionKernelCommandLine=!plymouth.enable=0 + +[Service] +ExecStart=/sbin/plymouthd --mode=shutdown --attach-to-session +ExecStartPost=-/bin/plymouth show-splash +Type=forking diff --git a/remote/tools/plymouth/data/etc/systemd/system/plymouth-poweroff.service b/remote/tools/plymouth/data/etc/systemd/system/plymouth-poweroff.service new file mode 100644 index 00000000..49742f6e --- /dev/null +++ b/remote/tools/plymouth/data/etc/systemd/system/plymouth-poweroff.service @@ -0,0 +1,11 @@ +[Unit] +Description=Show Plymouth Power Off Screen +After=getty@tty1.service prefdm.service plymouth-start.service +Before=poweroff.service +DefaultDependencies=no +ConditionKernelCommandLine=!plymouth.enable=0 + +[Service] +ExecStart=/sbin/plymouthd --mode=shutdown --attach-to-session +ExecStartPost=-/bin/plymouth show-splash +Type=forking diff --git a/remote/tools/plymouth/data/etc/systemd/system/plymouth-quit-wait.service b/remote/tools/plymouth/data/etc/systemd/system/plymouth-quit-wait.service new file mode 100644 index 00000000..56af45a7 --- /dev/null +++ b/remote/tools/plymouth/data/etc/systemd/system/plymouth-quit-wait.service @@ -0,0 +1,8 @@ +[Unit] +Description=Wait for Plymouth Boot Screen to Quit +After=rc-local.service plymouth-start.service systemd-user-sessions.service + +[Service] +ExecStart=-/bin/plymouth --wait +Type=oneshot +TimeoutSec=20 diff --git a/remote/tools/plymouth/data/etc/systemd/system/plymouth-quit.service b/remote/tools/plymouth/data/etc/systemd/system/plymouth-quit.service new file mode 100644 index 00000000..be3c1888 --- /dev/null +++ b/remote/tools/plymouth/data/etc/systemd/system/plymouth-quit.service @@ -0,0 +1,8 @@ +[Unit] +Description=Terminate Plymouth Boot Screen +After=rc-local.service plymouth-start.service systemd-user-sessions.service + +[Service] +ExecStart=-/bin/plymouth quit +Type=oneshot +TimeoutSec=20 diff --git a/remote/tools/plymouth/data/etc/systemd/system/plymouth-read-write.service b/remote/tools/plymouth/data/etc/systemd/system/plymouth-read-write.service new file mode 100644 index 00000000..caa3973b --- /dev/null +++ b/remote/tools/plymouth/data/etc/systemd/system/plymouth-read-write.service @@ -0,0 +1,9 @@ +[Unit] +Description=Tell Plymouth To Write Out Runtime Data +DefaultDependencies=no +After=local-fs.target +Before=sysinit.target + +[Service] +ExecStart=-/bin/plymouth update-root-fs --read-write +Type=oneshot diff --git a/remote/tools/plymouth/data/etc/systemd/system/plymouth-reboot.service b/remote/tools/plymouth/data/etc/systemd/system/plymouth-reboot.service new file mode 100644 index 00000000..dbedd00d --- /dev/null +++ b/remote/tools/plymouth/data/etc/systemd/system/plymouth-reboot.service @@ -0,0 +1,11 @@ +[Unit] +Description=Show Plymouth Reboot Screen +After=getty@tty1.service prefdm.service plymouth-start.service +Before=reboot.service +DefaultDependencies=no +ConditionKernelCommandLine=!plymouth.enable=0 + +[Service] +ExecStart=/sbin/plymouthd --mode=shutdown --attach-to-session +ExecStartPost=-/bin/plymouth show-splash +Type=forking diff --git a/remote/tools/plymouth/data/etc/systemd/system/plymouth-start.service b/remote/tools/plymouth/data/etc/systemd/system/plymouth-start.service new file mode 100644 index 00000000..09243001 --- /dev/null +++ b/remote/tools/plymouth/data/etc/systemd/system/plymouth-start.service @@ -0,0 +1,13 @@ +[Unit] +Description=Show Plymouth Boot Screen +DefaultDependencies=no +Wants=systemd-ask-password-plymouth.path +After=systemd-vconsole-setup.service systemd-udev-settle.service +Before=systemd-ask-password-plymouth.service +ConditionKernelCommandLine=!plymouth.enable=0 +ConditionPathExists=!/run/plymouth/pid + +[Service] +ExecStart=/sbin/plymouthd --mode=boot --pid-file=/run/plymouth/pid --attach-to-session +ExecStartPost=-/bin/udevadm settle --timeout=30 --exit-if-exists=/sys/class/drm/card0/dev;-/bin/udevadm settle --timeout=30 --exit-if-exists=/sys/class/graphics/fb0/dev; -/bin/plymouth show-splash +Type=forking diff --git a/remote/tools/plymouth/data/etc/systemd/system/systemd-ask-password-plymouth.path b/remote/tools/plymouth/data/etc/systemd/system/systemd-ask-password-plymouth.path new file mode 100644 index 00000000..c2ee4206 --- /dev/null +++ b/remote/tools/plymouth/data/etc/systemd/system/systemd-ask-password-plymouth.path @@ -0,0 +1,13 @@ +[Unit] +Description=Forward Password Requests to Plymouth Directory Watch +Documentation=http://www.freedesktop.org/wiki/Software/systemd/PasswordAgents +DefaultDependencies=no +Conflicts=shutdown.target +After=plymouth-start.service +Before=basic.target shutdown.target +ConditionKernelCommandLine=!plymouth.enable=0 +ConditionPathExists=/run/plymouth/pid + +[Path] +DirectoryNotEmpty=/run/systemd/ask-password +MakeDirectory=yes diff --git a/remote/tools/plymouth/data/etc/systemd/system/systemd-ask-password-plymouth.service b/remote/tools/plymouth/data/etc/systemd/system/systemd-ask-password-plymouth.service new file mode 100644 index 00000000..aa9ffc21 --- /dev/null +++ b/remote/tools/plymouth/data/etc/systemd/system/systemd-ask-password-plymouth.service @@ -0,0 +1,12 @@ +[Unit] +Description=Forward Password Requests to Plymouth +Documentation=http://www.freedesktop.org/wiki/Software/systemd/PasswordAgents +DefaultDependencies=no +Conflicts=shutdown.target +After=plymouth-start.service +Before=shutdown.target +ConditionKernelCommandLine=!plymouth.enable=0 +ConditionPathExists=/run/plymouth/pid + +[Service] +ExecStart=/bin/systemd-tty-ask-password-agent --watch --plymouth diff --git a/remote/tools/plymouth/plymouth.build b/remote/tools/plymouth/plymouth.build index 08647498..424bc292 100644 --- a/remote/tools/plymouth/plymouth.build +++ b/remote/tools/plymouth/plymouth.build @@ -32,26 +32,11 @@ build() { touch .built fi - # fix path: everything in lib/systemd to usr/lib/systemd - cd $BUILDDIR - - TARLIST="list_files_to_fix_prefix" - [ -f $TARLIST ] && rm $TARLIST - - # find files and symlinks with wrong prefix - for FILE in $(find . -type f -o -type l|grep ^./lib/systemd) - do - echo $FILE >> $TARLIST - done - # copy found files to usr/* - [ ! -d $BUILDDIR/usr ] && mkdir -p $BUILDDIR/usr - tar -cpv $(cat $TARLIST|sort -u) | tar -xpv -C $BUILDDIR/usr - # delete original location - rm -rf ./lib/systemd - cd - - } post_copy() { - : + # copy static dbus systemd unit files to stage3.2 + SYSTEMDDIR=${INIT_DIR}/etc/systemd/system + [ ! -d ${SYSTEMDDIR} ] && mkdir -p ${SYSTEMDDIR} + cp -r ${TOOL_DIR}/${TOOL}/data/* ${INIT_DIR} } diff --git a/remote/tools/plymouth/plymouth.conf b/remote/tools/plymouth/plymouth.conf index 4ade02d6..6c907826 100644 --- a/remote/tools/plymouth/plymouth.conf +++ b/remote/tools/plymouth/plymouth.conf @@ -7,8 +7,7 @@ DEPS=" libpng-dev libdrm-dev" REQUIRED_BINARIES=" plymouth plymouthd" -REQUIRED_DIRECTORIES=" /usr/lib/systemd/system - /usr/local/bin +REQUIRED_DIRECTORIES=" /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib/plymouth diff --git a/remote/tools/systemd/systemd.build b/remote/tools/systemd/systemd.build index ccdffcc0..981e87b6 100644 --- a/remote/tools/systemd/systemd.build +++ b/remote/tools/systemd/systemd.build @@ -42,7 +42,7 @@ post_copy() { # dont clear systemd log at startup # sed -i.bak "s/ExecStart=-\/sbin\/agetty %I 38400/ExecStart=-\/sbin\/agetty %I 38400 --noclear/g" \ - $INIT_DIR/usr/lib/systemd/system/getty@.service +# $INIT_DIR/usr/lib/systemd/system/getty@.service sed -i.bak "s/TTYVTDisallocate=yes/TTYVTDisallocate=no/g" \ $INIT_DIR/usr/lib/systemd/system/getty@.service } diff --git a/remote/tools/udev/udev.build b/remote/tools/udev/udev.build index f16d747e..70ed0b5a 100644 --- a/remote/tools/udev/udev.build +++ b/remote/tools/udev/udev.build @@ -27,9 +27,9 @@ build() { } post_copy() { - #copy systemd specific files - SYSTEMDDIR=$INIT_DIR/etc/systemd/system - [ ! -d $SYSTEMDDIR ] && mkdir -p $SYSTEMDDIR + #copy systemd specific files + SYSTEMDDIR=$INIT_DIR/etc/systemd/system + [ ! -d $SYSTEMDDIR ] && mkdir -p $SYSTEMDDIR cp -r $TOOL_DIR/$TOOL/data/* $INIT_DIR } |
