[arch-general] Reboot - Versioned Kernel Installs

C Anthony Risinger anthony at xtfx.me
Fri Jun 10 04:17:12 EDT 2011

On Thu, Jun 9, 2011 at 8:25 PM, C Anthony Risinger <anthony at xtfx.me> wrote:
> ... though i could very well be missing something obvious, certainly
> wouldn't be the first time ...

... after 1/2 implementing this i suddenly realized a painful truth
that's probably already been voiced ...

the kernel is *long-since upgraded* by the time _any_ hooks run ...
the original image is gone, the package is gone, all hope is gone,
fml.  the hook saves the images just fine because they are in the
process of being created ... but the original kernel image ... not so
much :-(

i don't know how this can work without hooks into pacman, anything
else i think of is too hacky ... even for me.

sorry guys, i tried :-(  i finished the `install` script and realized
it soon after.  my work follows for the benefit of children

C Anthony


# vim:set ft=sh:

install () {


    local src dst obase fdesc fmode fgid fuid fmaj fmin
    local okdir=".oldkernel-$(basename "${GENIMG%.img}")-${KERNELVERSION}"
    mkdir -p "${TMPDIR}/${okdir}"
    bsdtar -xf "${GENIMG}" -C "${TMPDIR}/${okdir}" --exclude
/.oldkernel --strip-components 1
    cp -a /boot/vmlinuz26 "${TMPDIR}/${okdir}"

    #FIXME: we should just keep the old file list around ...
    # hack BASEDIR to build links correctly


    while read -r src dst; do
        IFS=$'\t' read -r fdesc fmode fgid fuid fmaj fmin <<<"$(stat
-c $'%F\t%a\t%g\t%u\t%t\t%T' "${src}")"
        case "${fdesc}" in
            'regular file'|'symbolic link')
                add_file "${src}" "${dst}";;
                add_dir "${dst}";;
                echo "pipe ${dst} ${fmode} ${fgid} ${fuid}" >> "${FILELIST}";;
                echo "sock ${dst} ${fmode} ${fgid} ${fuid}" >> "${FILELIST}";;
            'character special file')
                echo "nod ${dst} ${fmode} ${fgid} ${fuid} c ${fmaj}
${fmin}" >> "${FILELIST}";;
            'block special file')
                echo "nod ${dst} ${fmode} ${fgid} ${fuid} b ${fmaj}
${fmin}" >> "${FILELIST}";;
            echo "UNKNOWN FILE: ${src}";;
    done < <(bsdtar -tf "${GENIMG}" --exclude /.oldkernel |
             sed "s,.*,${TMPDIR}/${okdir}\0 /${okdir}\0,g")

    add_file /boot/vmlinuz26 "/${okdir}/vmlinuz26"



help () {

    Kernel RECOVERY


More information about the arch-general mailing list