From 70ea3b10e255defb40a1f32fc62ef32f7d9c9685 Mon Sep 17 00:00:00 2001 From: Martin Pietsch <martin.pietsch@tu-dresden.de> Date: Wed, 13 Nov 2019 14:02:25 +0100 Subject: [PATCH] move content of bootlocal.sh to profile --- files/bootlocal.sh | 58 +--------------------------------------------- files/profile | 35 +++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 58 deletions(-) diff --git a/files/bootlocal.sh b/files/bootlocal.sh index 3bfef3f..6d8ce17 100644 --- a/files/bootlocal.sh +++ b/files/bootlocal.sh @@ -1,59 +1,3 @@ #!/bin/sh -cd /opt -# include functions.sh -. ./functions.sh - -# wait for Network -# wait max 100 seconds until something is in /etc/resolv.conf -while ! test -s /etc/resolv.conf -do - [ "$counter" -ge 100 ] && exit 1 - - let "counter+=1" - echo "waiting " $counter "seconds for network :-)" - - sleep 1 -done - - -# chmod / or tc user can not login, so no tce-load would be possible -chmod 755 / - -# install packages required by diskpreperation.sh -installTcPackages bash parted bc ntfs-3g dosfstools - -# workaround for limited availability of btrfs-progs and reiserfsprogs -architecture=$(uname -m) -if [ "${architecture}" == "x86_64" ] - then installTcPackages btrfs-progs - else installTcPackages reiserfsprogs -fi - -# install and set keyboard layout for debugging -installTcPackages kmaps util-linux -loadkmap </usr/share/kmap/qwertz/de-latin1-nodeadkeys.kmap - -echo "create target directory" -mkdir /target -chmod 0755 /target - -# run install.sh -echo "switch to bash and run installer" -bash ./installer.sh | tee >> /tmp/installer.logfile - -mkdir -p /target/etc/ssh/ -chmod 0755 /target/etc/ssh/ -chown 0:0 /target/etc/ssh/ - -cp /opt/ansible.pub /target/etc/ssh/authorized_keys -chmod 0644 /target/etc/ssh/authorized_keys -chown 0:0 /target/etc/ssh/authorized_keys - -cp /tmp/fstab.target /target/etc/fstab -chmod 0644 /target/etc/fstab -chown 0:0 /target/etc/fstab - -sync - -echo "installer finished, logfile: /tmp/installer.logfile" +echo "export ANSWERFILE_PATH=${ANSWERFILE_PATH}" >/etc/profile.d/answerfile.sh diff --git a/files/profile b/files/profile index 211e1ab..34c7fe0 100644 --- a/files/profile +++ b/files/profile @@ -1,3 +1,36 @@ #!/bin/sh -/bin/sh +. /opt/functions.sh + +chmod 755 / + +netwaitcnt=0 +beginLogEntry "waiting for network" +while [ ! -s /etc/resolv.conf ]; +do + [ "${netwaitcnt}" -ge 100 ] && finishLogEntry "failed" && exit 1 + netwaitcnt=$((${netwaitcnt} + 1)) + echo -n "." + sleep 1 +done +finishLogEntry "done" + +beginLogEntry "install default dependencies" +installTcPackages bash parted bc ntfs-3g dosfstools openssl +architecture=$(uname -m) +case ${architecture} in + x86_64) installTcPackages btrfs-progs ;; + i[0-9]86) installTcPackages reiserfsprogs;; +esac +finishLogEntry "done" + +beginLogEntry "get Answerfile from \"${ANSWERFILE_PATH}\"" +getAnswerfile ${ANSWERFILE_PATH} /tmp/answerfile +if [ $? -eq 0 ]; +then + finishLogEntry "done" + /opt/installer.sh +else + finishLogEntry "failed" +fi + -- GitLab