From b61b596741a1ae3be0c188a648efd9ad619407bb Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 13 Mar 2014 21:05:45 +0100 Subject: generalize install stick remastering --- ship/src/fix_dircolors | 2 +- ship/src/remaster_arch_filehooker | 106 ------------------------------ ship/src/remaster_arch_shack_installstick | 47 ++++++------- 3 files changed, 20 insertions(+), 135 deletions(-) delete mode 100755 ship/src/remaster_arch_filehooker diff --git a/ship/src/fix_dircolors b/ship/src/fix_dircolors index b2e2ffdb..d427563f 100755 --- a/ship/src/fix_dircolors +++ b/ship/src/fix_dircolors @@ -6,7 +6,7 @@ exists dircolors || die "no dircolors in PATH, bailing out" info "fixing dircolors for $(id -un)" dircolors -p > $HOME/.dircolors -sed -i 's/\(DIR \).*/\101;35/' $HOME/.dircolors +sed -i 's/\(DIR \).*/\101;36/' $HOME/.dircolors ! grep -q 'dircolors' $HOME/.profile && \ info "adding dircolors line to $HOME/.profile" && \ echo 'eval `dircolors -b $HOME/.dircolors`' >> $HOME/.profile diff --git a/ship/src/remaster_arch_filehooker b/ship/src/remaster_arch_filehooker deleted file mode 100755 index 54f0b082..00000000 --- a/ship/src/remaster_arch_filehooker +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/sh -#@include core -#@include iso -#@mainifyme - -## TODO: provide a parameter which defines what to be done in the new iso root -set -efu -isofile=${1:-archlinux-2013.06.01-dual.iso} -outfile=$(basename ${isofile%.iso}.krebs.iso) -info "outfile will be at $outfile" -bdir=${bdir:-$HOME/build/arch} -isodir=$bdir/iso -isomnt=$bdir/isomount -rootdir=$bdir/root -outdir=$bdir/out -auto_url=conf.krebsco.de/filehooker_install -info "bdir is at $bdir" -[ ! -e "$isofile" ] && die "$isofile does not exist." -esudo "$@" -arch_label="$(get_volid "$isofile")" -info "Arch iso label is ${arch_label}" - - -info "cleanup root dir" -rm -rf $bdir -mkdir -p $isomnt $rootdir -info "mounting isofile ($isofile)" -if is_root;then - mount -t iso9660 -o loop,ro $isofile $isomnt -else - die 'we are not root enough to mount the iso.' -fi -defer "info 'unmounting $isomnt';umount $isomnt" - -info "copying from '$isomnt' to '$isodir'" -cp -a "$isomnt" "$isodir" -defer "info 'removing $isodir';rm -rf $isodir" -info "extracting root-image squashfs" -# we will not touch the kernel ... yet - -for arch in x86_64 i686;do - info "unpacking $isomnt/arch/$arch/root-image.fs.sfs" - mkdir -p "$outdir/$arch" - defer "info 'removing $outdir/$arch';rm -rf $outdir/$arch" - mkdir -p "$rootdir/$arch" - defer "info 'removing $rootdir/$arch';rm -rf $rootdir/$arch" - unsquashfs -f -d "$outdir/$arch" "$isodir/arch/$arch/root-image.fs.sfs" - - mount "$outdir/$arch/root-image.fs" "$rootdir/$arch" - defer "info 'unmounting $rootdir/$arch';umount $rootdir/$arch||info 'not mounted'" - - info "Starting of the rootdir verkrepelung" - # do the magic here - arch-chroot $rootdir/$arch <> /root/.zshrc< -EOD -# /krebs/autoinstall -EOL - - : \${1?\$0 } - mkdir /krebs - cat > /krebs/autoinstall </dev/null 2>&1; } -while ! internet;do - echo "no Internet yet, waiting ..." - sleep 3 -done - -echo "Grabbing current version of install-script from $auto_url" -echo -echo "AGENTS ARE GOOOOOOOOOOO!" -curl $auto_url 2>/dev/null | sh -s "\\\$@" -EOL -chmod 755 /krebs/autoinstall -EOF - info "deleting old squashfs" - rm "$isodir/arch/$arch/root-image.fs.sfs" - info "creating squashfs at $isodir/arch/$arch/root-image.fs.sfs" - umount "$rootdir/$arch" - mksquashfs "$outdir/$arch/root-image.fs" "$isodir/arch/$arch/root-image.fs.sfs" -done - -info "creating Iso Image" -rm -f "${outdir}/${outfile}" -xorriso -as mkisofs \ - -iso-level 3 \ - -full-iso9660-filenames \ - -volid "ARCH_201311" \ - -appid "Shackspace Krebs Installer" \ - -publisher "Shackspace/Krebs" \ - -preparer "prepared by krebs" \ - -eltorito-boot isolinux/isolinux.bin \ - -eltorito-catalog isolinux/boot.cat \ - -no-emul-boot -boot-load-size 4 -boot-info-table \ - -isohybrid-mbr ${isomnt}/isolinux/isohdpfx.bin \ - -output "${outdir}/${outfile}" \ - "$isodir" - diff --git a/ship/src/remaster_arch_shack_installstick b/ship/src/remaster_arch_shack_installstick index 364e1958..ea594fb2 100755 --- a/ship/src/remaster_arch_shack_installstick +++ b/ship/src/remaster_arch_shack_installstick @@ -5,23 +5,20 @@ ## TODO: provide a parameter which defines what to be done in the new iso root set -efu -isofile="${1:-archlinux-2013.06.01-dual.iso}" -outfile="$(basename "${isofile%.iso}".krebs.iso)" +isofile=${1:-archlinux-2013.06.01-dual.iso} +outfile=$(basename ${isofile%.iso}.krebs.iso) info "outfile will be at $outfile" -bdir="${bdir:-$HOME/build/arch}" -isodir="$bdir/iso" -isomnt="$bdir/isomount" -rootdir="$bdir/root" -outdir="$bdir/out" -echo "$outdir/$outfile" -auto_url=euer.krebsco.de/arch_autoinstall +bdir=${bdir:-$HOME/build/arch} +isodir=$bdir/iso +isomnt=$bdir/isomount +rootdir=$bdir/root +outdir=$bdir/out +auto_url=${2:conf.krebsco.de/arch_autoinstall} info "bdir is at $bdir" [ ! -e "$isofile" ] && die "$isofile does not exist." +esudo "$@" arch_label="$(get_volid "$isofile")" info "Arch iso label is ${arch_label}" -esudo "$@" - -#punani install genisoimage info "cleanup root dir" @@ -29,18 +26,17 @@ rm -rf $bdir mkdir -p $isomnt $rootdir info "mounting isofile ($isofile)" if is_root;then - mount -t iso9660 -o loop,ro "$isofile" "$isomnt" + mount -t iso9660 -o loop,ro $isofile $isomnt else die 'we are not root enough to mount the iso.' fi -defer "info 'unmounting $isomnt';umount \"$isomnt\"" +defer "info 'unmounting $isomnt';umount $isomnt" info "copying from '$isomnt' to '$isodir'" cp -a "$isomnt" "$isodir" defer "info 'removing $isodir';rm -rf $isodir" - info "extracting root-image squashfs" - +# we will not touch the kernel ... yet for arch in x86_64 i686;do info "unpacking $isomnt/arch/$arch/root-image.fs.sfs" @@ -55,7 +51,7 @@ for arch in x86_64 i686;do info "Starting of the rootdir verkrepelung" # do the magic here - arch-chroot "$rootdir/$arch" <> /root/.zshrc< EOD /krebs/autoinstall EOL + mkdir /krebs cat > /krebs/autoinstall </dev/null 2>&1; } @@ -80,7 +75,7 @@ done echo "Grabbing current version of install-script from $auto_url" echo echo "AGENTS ARE GOOOOOOOOOOO!" -curl $auto_url 2>/dev/null | sh +curl "$auto_url" 2>/dev/null | sh -s "\\\$@" EOL chmod 755 /krebs/autoinstall EOF @@ -88,26 +83,22 @@ EOF rm "$isodir/arch/$arch/root-image.fs.sfs" info "creating squashfs at $isodir/arch/$arch/root-image.fs.sfs" umount "$rootdir/$arch" - mksquashfs "$outdir/$arch/root-image.fs" "$isodir/arch/$arch/root-image.fs.sfs" + mksquashfs "$outdir/$arch/root-image.fs" "$isodir/arch/$arch/root-image.fs.sfs" done info "creating Iso Image" -#genisoimage -l -r -J -V "ARCH_$(date +%Y%m)" \ -# -b isolinux/isolinux.bin -no-emul-boot \ -# -boot-load-size 4 -boot-info-table -c isolinux/boot.cat \ -# -o "$outdir/$outfile" "$isodir" rm -f "${outdir}/${outfile}" xorriso -as mkisofs \ -iso-level 3 \ -full-iso9660-filenames \ - -volid "$arch_label" \ + -volid "ARCH_201311" \ -appid "Shackspace Krebs Installer" \ -publisher "Shackspace/Krebs" \ -preparer "prepared by krebs" \ -eltorito-boot isolinux/isolinux.bin \ -eltorito-catalog isolinux/boot.cat \ -no-emul-boot -boot-load-size 4 -boot-info-table \ - -isohybrid-mbr "${isomnt}/isolinux/isohdpfx.bin" \ + -isohybrid-mbr ${isomnt}/isolinux/isohdpfx.bin \ -output "${outdir}/${outfile}" \ "$isodir" -- cgit v1.2.3 From 34155a314021e0a67d1288f9f873b2e9caf6cd4e Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 14 Mar 2014 13:31:57 +0100 Subject: irc-announce: don't use nc *-c* --- git/gitolite-hooks/irc-announce | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/git/gitolite-hooks/irc-announce b/git/gitolite-hooks/irc-announce index 32ae8f26..2d1603d0 100755 --- a/git/gitolite-hooks/irc-announce +++ b/git/gitolite-hooks/irc-announce @@ -100,5 +100,7 @@ privmsg_cat() { awk '{ print "PRIVMSG "ENVIRON["IRC_CHANNEL"]" :"$0 }'; } echo2 'QUIT :Gone to have lunch' printf  + sleep 1 + exit } \ - | nc -c "$IRC_SERVER" "$IRC_PORT" + | nc "$IRC_SERVER" "$IRC_PORT" -- cgit v1.2.3 From 2250b2e9f2bce4c9e18e13c51104b5d87fbc07cf Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 14 Mar 2014 13:33:37 +0100 Subject: irc-announce: 1 sec isn't enought for MODE --- git/gitolite-hooks/irc-announce | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git/gitolite-hooks/irc-announce b/git/gitolite-hooks/irc-announce index 2d1603d0..46382665 100755 --- a/git/gitolite-hooks/irc-announce +++ b/git/gitolite-hooks/irc-announce @@ -65,8 +65,8 @@ privmsg_cat() { awk '{ print "PRIVMSG "ENVIRON["IRC_CHANNEL"]" :"$0 }'; } echo2 "NICK $IRC_NICK" # wait for MODE message - # CAVEAT 1 second was enough while testing...^_^ - sleep 1 + # CAVEAT 3 second was enough while testing...^_^ + sleep 3 echo2 "JOIN $IRC_CHANNEL" -- cgit v1.2.3 From 3d369402d011e067e7c3bd89460f94bb26048a16 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 14 Mar 2014 13:39:14 +0100 Subject: irc-announce: test =, not == --- git/gitolite-hooks/irc-announce | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/gitolite-hooks/irc-announce b/git/gitolite-hooks/irc-announce index 46382665..691b9d82 100755 --- a/git/gitolite-hooks/irc-announce +++ b/git/gitolite-hooks/irc-announce @@ -81,7 +81,7 @@ privmsg_cat() { awk '{ print "PRIVMSG "ENVIRON["IRC_CHANNEL"]" :"$0 }'; } "$reponame" \ "$username" \ "$commit_count" \ - "$(test $commit_count == 1 || echo s)" \ + "$(test $commit_count = 1 || echo s)" \ "$(hostname)" \ "$ref_name" \ | privmsg_cat \ -- cgit v1.2.3 From 659dc87fa1c9eebbe9a99f1fb911d3ae993386d2 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 14 Mar 2014 13:41:24 +0100 Subject: irc-announce: ohoh, 3s are not enough... --- git/gitolite-hooks/irc-announce | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git/gitolite-hooks/irc-announce b/git/gitolite-hooks/irc-announce index 691b9d82..1d88c4da 100755 --- a/git/gitolite-hooks/irc-announce +++ b/git/gitolite-hooks/irc-announce @@ -65,8 +65,8 @@ privmsg_cat() { awk '{ print "PRIVMSG "ENVIRON["IRC_CHANNEL"]" :"$0 }'; } echo2 "NICK $IRC_NICK" # wait for MODE message - # CAVEAT 3 second was enough while testing...^_^ - sleep 3 + # CAVEAT 5 second was enough while testing...^_^ + sleep 5 echo2 "JOIN $IRC_CHANNEL" -- cgit v1.2.3 From 890e81bea3b7ada20871913053a86fa0672a44e4 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 14 Mar 2014 13:42:55 +0100 Subject: irc-announce: bump --- git/gitolite-hooks/irc-announce | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git/gitolite-hooks/irc-announce b/git/gitolite-hooks/irc-announce index 1d88c4da..1e7ecc2b 100755 --- a/git/gitolite-hooks/irc-announce +++ b/git/gitolite-hooks/irc-announce @@ -65,8 +65,8 @@ privmsg_cat() { awk '{ print "PRIVMSG "ENVIRON["IRC_CHANNEL"]" :"$0 }'; } echo2 "NICK $IRC_NICK" # wait for MODE message - # CAVEAT 5 second was enough while testing...^_^ - sleep 5 + # CAVEAT 10 second was enough while testing...^_^ + sleep 10 echo2 "JOIN $IRC_CHANNEL" -- cgit v1.2.3 From 617c75df73f02cc951e63f87926a42d11cb3079a Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 14 Mar 2014 14:14:40 +0100 Subject: irc-announce: properly wait for MODE message^_^ --- git/gitolite-hooks/irc-announce | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/git/gitolite-hooks/irc-announce b/git/gitolite-hooks/irc-announce index 1e7ecc2b..9c98b330 100755 --- a/git/gitolite-hooks/irc-announce +++ b/git/gitolite-hooks/irc-announce @@ -57,6 +57,19 @@ cat2() { tee /dev/stderr; } # privmsg_cat transforms stdin to a privmsg privmsg_cat() { awk '{ print "PRIVMSG "ENVIRON["IRC_CHANNEL"]" :"$0 }'; } +# ircin is used to feed the output of netcat back to the "irc client" +# so we can implement expect-like behavior with sed^_^ +# XXX mkselfdestructingtmpfifo would be nice instead of this cruft +tmpdir="$(mktemp -d irc-announce_XXXXXXXX)" +cd "$tmpdir" +mkfifo ircin +trap " + rm ircin + cd '$OLDPWD' + rmdir '$tmpdir' + trap - EXIT INT QUIT +" EXIT INT QUIT + # # # @@ -65,8 +78,7 @@ privmsg_cat() { awk '{ print "PRIVMSG "ENVIRON["IRC_CHANNEL"]" :"$0 }'; } echo2 "NICK $IRC_NICK" # wait for MODE message - # CAVEAT 10 second was enough while testing...^_^ - sleep 10 + sed -n '/^:[^ ]* MODE /q' echo2 "JOIN $IRC_CHANNEL" @@ -102,5 +114,5 @@ privmsg_cat() { awk '{ print "PRIVMSG "ENVIRON["IRC_CHANNEL"]" :"$0 }'; } printf  sleep 1 exit -} \ - | nc "$IRC_SERVER" "$IRC_PORT" +} < ircin \ + | nc "$IRC_SERVER" "$IRC_PORT" | tee -a ircin -- cgit v1.2.3 From 915262791f611b30070d5cf6de1ba40989a4ebd6 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 14 Mar 2014 14:26:55 +0100 Subject: irc-announce: wait for PART message before QUIT --- git/gitolite-hooks/irc-announce | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/git/gitolite-hooks/irc-announce b/git/gitolite-hooks/irc-announce index 9c98b330..a135ca67 100755 --- a/git/gitolite-hooks/irc-announce +++ b/git/gitolite-hooks/irc-announce @@ -106,13 +106,9 @@ trap " echo2 "PART $IRC_CHANNEL" - # TESTME does this sleep help to send all messages? - sleep 5 + # wait for PART confirmation + sed -n '/:'"$IRC_NICK"'![^ ]* PART /q' echo2 'QUIT :Gone to have lunch' - - printf  - sleep 1 - exit } < ircin \ | nc "$IRC_SERVER" "$IRC_PORT" | tee -a ircin -- cgit v1.2.3 From d13ad30fdbf0638cf019f9e3888e5c1c6afd11ef Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 14 Mar 2014 23:28:12 +0100 Subject: fix broken arch remaster script --- ship/src/remaster_arch_shack_installstick | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ship/src/remaster_arch_shack_installstick b/ship/src/remaster_arch_shack_installstick index ea594fb2..3ad985af 100755 --- a/ship/src/remaster_arch_shack_installstick +++ b/ship/src/remaster_arch_shack_installstick @@ -13,13 +13,13 @@ isodir=$bdir/iso isomnt=$bdir/isomount rootdir=$bdir/root outdir=$bdir/out -auto_url=${2:conf.krebsco.de/arch_autoinstall} +auto_url=${2:-conf.krebsco.de/arch_autoinstall} info "bdir is at $bdir" [ ! -e "$isofile" ] && die "$isofile does not exist." esudo "$@" arch_label="$(get_volid "$isofile")" info "Arch iso label is ${arch_label}" - +info "auto_url is $auto_url" info "cleanup root dir" rm -rf $bdir @@ -59,7 +59,7 @@ Just Wait until everything finished. - Make sure that RJ45 is connected - you can bail out of the progress at any time with CTRL-C - /krebs/autoinstall + /krebs/autoinstall (args) EOD /krebs/autoinstall EOL @@ -91,7 +91,7 @@ rm -f "${outdir}/${outfile}" xorriso -as mkisofs \ -iso-level 3 \ -full-iso9660-filenames \ - -volid "ARCH_201311" \ + -volid "${arch_label}" \ -appid "Shackspace Krebs Installer" \ -publisher "Shackspace/Krebs" \ -preparer "prepared by krebs" \ -- cgit v1.2.3