kernupgr.sh could be faster if it did not use sed.. but it only extracts 2 files so it has time to spare ---------------------------- #!/bin/bash # ver 1.0 # based on "mint_install" script by Peter Slegg # Paul Wratt (c) 2011-08-06 ### to use on non-MiNT set types after help section ### ### build path names, change them if you feel the need (no spaces) ### # name of folder to place kernel modules (default: archive name + distro) BUILD_DIR="" # use working directory: . or /tmp or ~ (no trailing slash) WORKING_DIR="" ### do help - to use on non-MiNT swap #if's and set types (see below) ### if [ $# -ne 1 -o -z "$1" -o "$1" = "--help" -o ! -f "$1" ] ;then echo "FreeMiNT kernel upgrade" echo " (Auto-detect, MINT.PRG and XAAES.KM only - requires MiNT)" echo echo "usage: $0 _filename_.tar.bz2" echo exit fi ### lets get going ### ARCHIVE="$1" ARC_NAME=`echo "$ARCHIVE" | sed 's/\\.tar\\.bz2//'` CPUTYPE=`grep -s CPU /kern/cpuinfo | sed 's/CPU://;s/^[ \t]*//'` PLATFORM=`grep -s _MCH /kern/cookiejar | sed 's/^.+ //'` CT6x=`grep -s CT60 /kern/cookiejar | sed 's/^.+ //'` V4E=`grep -s _CF_ /kern/cookiejar | sed 's/^.+ //'` HADES=`grep -s hade /kern/cookiejar | sed 's/^.+ //'` ### to use on non-MiNT remove #'s and set types (see below) ### #CPUTYPE="68040" #PLATFORM="0x00050000" echo -n "Platform: " case "$CPUTYPE" in "68000") KERNEL=mint000.prg XAAES=xaaes000.km ;; "68020") KERNEL=mint020.prg XAAES=xaaes000.km ;; "68030") KERNEL=mint030.prg XAAES=xaaes030.km ;; "68040") KERNEL=mint040.prg XAAES=xaaes040.km ;; "68060") KERNEL=mint060.prg XAAES=xaaes060.km ;; *) if [ "$V4E" != "" -o "$CPUTYPE" = "v4e" ]; then KERNEL=mintv4e.prg XAAES=xaaesv4e.km CPUTYPE="v4e" else echo -e "cant auto-detect ($PLATFORM $CPU)\n\tthis script requires MiNT" echo -e "\t (note: for non-MiNT use see script source)" exit 1 fi ;; esac if [ "$PLATFORM" = "0x00000000" ]; then echo -n "ST (MegaST) " elif [ "$PLATFORM" = "0x00010010" ]; then echo -n "STE " elif [ "$PLATFORM" = "0x00010001" ]; then echo -n "ST Book " elif [ "$PLATFORM" = "0x00010010" ]; then echo -n "Mega STE " elif [ "$PLATFORM" = "0x00020000" -a "$CT6x" != "" ] ; then echo -n "CT6x/TT " elif [ "$PLATFORM" = "0x00020000" ] ; then echo -n "TT " elif [ "$PLATFORM" = "0x00024D34" -o "$PLATFORM" = "0x00014D34" ] ; then echo -n "Medusa T40 " elif [ "$PLATFORM" = "0x00030000" -a "$V4E" != "" ] ; then echo -n "FireBee " elif [ "$PLATFORM" = "0x00030000" -a "$CT6x" != "" ] ; then echo -n "CT6x/Falcon " elif [ "$PLATFORM" = "0x00024D34" -o "$PLATFORM" = "0x00014D34" ] ; then echo -n "Medusa T40 " elif [ "$PLATFORM" = "0x00030000" ] ; then echo -n "Falcon " elif [ "$PLATFORM" = "0x00040000" ] ; then echo -n "Milan " KERNEL=mintmil.prg elif [ "$PLATFORM" = "0x00050000" ] ; then echo -n "ARAnyM " KERNEL=mintara.prg elif [ "$V4E" != "" ]; then echo -n "Coldfire " fi echo $CPUTYPE ### do file stuff now ### SRC_DIR=`pwd` if [ -f "$SRC_DIR/$ARCHIVE" -a -f "$ARCHIVE" ]; then SRC_ARC="$SRC_DIR/$ARCHIVE" else SRC_ARC="$ARCHIVE" fi WORKING_PATH=$WORKING_DIR if [ "$WORKING_DIR" = "" -o "$WORKING_DIR" = "." -o "$WORKING_DIR" = "./" ]; then WORKING_PATH=$SRC_DIR WORKING_DIR="." fi echo -n " ..detecting distro: " DISTRO="" DISTROS="1-18-CUR 1-17-0 1-17-CUR 1-16-CUR 1-19-CUR" for D in $DISTROS; do echo -n "." M="./mint/$D/mint.cnf" TEST_DISTRO=`tar -jtf $SRC_ARC ./mint/$D/mint.cnf 2> /dev/null` if [ "$TEST_DISTRO" = "$M" ]; then DISTRO="$D"; break; fi done if [ "$DISTRO" = "" ]; then echo -e "\nerror: unable to find distro, needs to be one of the following:\n\t $DISTROS"; exit 2; fi echo "found: $DISTRO" if [ "$EXTRACT_DIR" = "" ]; then EXTRACT_DIR="_$DISTRO" EXTRACT_DIR="$ARC_NAME$EXTRACT_DIR" fi mkdir -p "$WORKING_PATH/$EXTRACT_DIR" cd "$WORKING_PATH/$EXTRACT_DIR" echo " ..extracting: $KERNEL" tar -jxf $SRC_ARC ./auto/$KERNEL mv ./auto/$KERNEL ./ rmdir auto echo " ..extracting: $XAAES" tar -jxf $SRC_ARC ./mint/$DISTRO/xaaes/$XAAES mv ./mint/$DISTRO/xaaes ./ rmdir -p mint/$DISTRO echo -e " ..done:\n\t$WORKING_DIR/$EXTRACT_DIR" exit 0 ---------------------------- Paul
Attachment:
kernupgr.sh
Description: Bourne shell script