83 lines
1.9 KiB
Plaintext
83 lines
1.9 KiB
Plaintext
|
#! /bin/bash
|
||
|
|
||
|
CONFHIST_DIR=config-history
|
||
|
PKG_DIR=linux-ck
|
||
|
BUILDFILE="$PKG_DIR/PKGBUILD"
|
||
|
PKG_URL=https://aur.archlinux.org/cgit/aur.git/snapshot/linux-ck.tar.gz
|
||
|
ARCH=x86_64
|
||
|
|
||
|
get_latest_config() {
|
||
|
echo "$CONFHIST_DIR/$(ls -Art "$CONFHIST_DIR" | tail -n 1)"
|
||
|
}
|
||
|
|
||
|
help="$(basename "$0") [-o] [-c] [-h]
|
||
|
|
||
|
Downloads and installs new linux-ck kernel. By default will grab the
|
||
|
most recent config file from config-history unless the current config
|
||
|
is different (and exists), in which case it will be assumed more
|
||
|
recent and saved in config history. If old config is used and from an
|
||
|
older kernel, make oldconfig will automatically run.
|
||
|
|
||
|
Options:
|
||
|
-o: use the old package even if new is available
|
||
|
-c: launch make nconfig
|
||
|
-h: show this"
|
||
|
|
||
|
while getopts ":och" OPT; do
|
||
|
case ${OPT} in
|
||
|
o)
|
||
|
OLD_PKG="true"
|
||
|
;;
|
||
|
c)
|
||
|
DO_CONFIG="true"
|
||
|
;;
|
||
|
h)
|
||
|
echo "$help"
|
||
|
exit 0
|
||
|
;;
|
||
|
\?)
|
||
|
echo "$help"
|
||
|
exit 0
|
||
|
;;
|
||
|
esac
|
||
|
done
|
||
|
|
||
|
# pull old config if it exists and is not the most recent
|
||
|
if [ -e "$BUILDFILE" ]; then
|
||
|
echo "checking for old config file"
|
||
|
# kver=$(get_from_buildfile "$BUILDFILE" "_srcname")
|
||
|
source "$BUILDFILE" # get pkgver
|
||
|
oldconf="$PKG_DIR/src/linux-$pkgver/.config"
|
||
|
## this file does not always exist?
|
||
|
if [ -e "$oldconf" ]; then
|
||
|
echo "found old config"
|
||
|
oldsum=$(md5sum "$oldconf" | awk '{print $1}')
|
||
|
newsum=$(md5sum $(get_latest_config) | awk '{print $1}')
|
||
|
if [ "$oldsum" != "$newsum" ]; then
|
||
|
echo "copying old config to $CONFHIST_DIR"
|
||
|
# cp "$oldconf" "$CONFHIST_DIR/.config-$(date +%Y%m%d%H%M)"
|
||
|
else
|
||
|
echo "config file up to date. nothing to back up"
|
||
|
fi
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
if [ -z "$OLD_PKG" ]; then
|
||
|
echo downloading new package
|
||
|
# rm -rf $PKG_DIR
|
||
|
# curl -O "$PKG_URL"
|
||
|
# tar xzf linux-ck.tar.gz
|
||
|
|
||
|
latest_conf=$(get_latest_config)
|
||
|
echo "copying conf: $latest_conf"
|
||
|
# cp "$latest_conf" "$PKG_DIR/config"
|
||
|
# updpkgsums "$BUILDFILE"
|
||
|
fi
|
||
|
|
||
|
# cd "$PKG_DIR"
|
||
|
# if [ -n "$DO_CONFIG" ]; then
|
||
|
# sed -i '/_makenconfig=/ s/$/y/' PKGBUILD
|
||
|
# fi
|
||
|
# makepkg -s -r -f -i
|
||
|
# cd ..
|