#!/bin/bash # # lk-boot-report-update -- 2008-09-09, last edit 2011-03-13 # # script to move boot-reports from /home/common/dmesg.config/ to # /home/web/bugsplatter/kernel/boxen/ area, remove stale config # and dmesg reports and recreate the linktree display # # Copyright 2008,2011 (C) Grant Coady GPLv2 # # 2011-03-13 # disable call to pak-web because I really need a system flag to # show whether pak-web in use ot not. TODO # move and comment out "remove stale...", add commentary # boot_rep_src="/home/common/dmesg.config/*" boot_rep_dst="/home/web/bugsplatter/kernel/boxen/" web_this_dir="kernel/boxen" echo " lk-boot-report-update: copy boot reports from /home/common to web area " tree $boot_rep_src cp -a $boot_rep_src $boot_rep_dst || exit find /home/common/dmesg.config/ -type f -delete rm_stale_report_files() # - { echo " $PWD:" ls {config,dmesg}-* | sort -gr | awk ' { if (!last) { last = $1; print " " $0; next } this = $1 printf " %-32s", this sub(/[a-zA-Z\.]+$/, "", this) # remove .gz n = split(this, a, /[a-z\.]/) thisver = a[n] # get last version number sub(/[0-9]+$/, "", this) # remove last version number git = sub(/git/, "", this) # perhaps remove "git" ndx = match(last, this) if (ndx == 1) { rm = this (git ? "git" : "") thisver "*" print "# rm: " rm # show stale file system("rm " rm) # remove stale file } else { print "" } last = $1; lastver = thisver # for next filename }' } cd $boot_rep_dst # next bit is busted, needs fixing! TODO #echo " # remove stale config and dmesg reports #" #for dir in $(find . -name "*" -type d | sort); do # [ $dir == "." ] && continue # cd $dir || exit 1 # numfiles=$(ls {config,dmesg}-*.gz 2>/dev/null | wc -l) # [ $numfiles -gt 0 ] && rm_stale_report_files # cd .. > /dev/null #done linktree # no call pak-web - 2011-03-13 #pak-web -d # end