Re: Reboot - Versioned Kernel Installs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Thu, Jun 9, 2011 at 8:25 PM, C Anthony Risinger <anthony@xxxxxxx> 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
everywhere.

C Anthony

----------------------------------------------------------------

# vim:set ft=sh:

install () {

    SCRIPT="oldkernel"

    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

    obase="${BASEDIR}"
    BASEDIR="${TMPDIR}"

    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}";;
            'directory')
                add_dir "${dst}";;
            'fifo')
                echo "pipe ${dst} ${fmode} ${fgid} ${fuid}" >> "${FILELIST}";;
            'socket')
                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}";;
        esac
    done < <(bsdtar -tf "${GENIMG}" --exclude /.oldkernel |
             sed "s,.*,${TMPDIR}/${okdir}\0 /${okdir}\0,g")

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

    BASEDIR="${obase}"

}

help () {

cat <<HELPEOF
    Kernel RECOVERY
HELPEOF

}


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux