update: build.sh remove install

This commit is contained in:
Break27 committed 2026-10-17 01:19:11 +08:00
1 parent c1236a434c
commit d269d48b8d
1 file changed
+18 -9
+18 -9
View File
@@ -16,6 +16,24 @@ LOGS=$BUILD/logs
log() { printf '[%s] %s\n' "$(date '+%H:%M:%S')" "$*"; } log() { printf '[%s] %s\n' "$(date '+%H:%M:%S')" "$*"; }
die() { printf '[%s] ERROR: %s\n' "$(date '+%H:%M:%S')" "$*"; exit 1; } die() { printf '[%s] ERROR: %s\n' "$(date '+%H:%M:%S')" "$*"; exit 1; }
if [ -n "$REMOVE" ]; then
ver=${KERNEL_VERSION}-${LOCAL_VERSION}.ms-r1
log "removing modules"
pkexec rm -rf /lib/modules/$ver* || die "failed"
log "removing boot files"
pkexec rm -f /boot/vmlinuz-$ver* /boot/initrd-$ver* /boot/initramfs-$ver* /boot/System.map-$ver* /boot/config-$ver* || die "failed"
pkexec find /boot/loader/entries -name "*-${KERNEL_VERSION}-${LOCAL_VERSION}.ms-r1*" -delete || die "failed"
log "done"; exit 0
fi
[ -z "$CLEAN" ] || rm -rf $KERNEL_TREE $KERNEL_CORE $KERNEL_PATCHES $LOGS; mkdir -p "$LOGS"
log "building linux kernel ${KERNEL_VERSION} with sky1-${TAG} patches"
if [ ! -d "$KERNEL_TREE" ]; then
log "cloning linux kernel repository"
git clone --depth=1 --branch=v$KERNEL_VERSION https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git "$KERNEL_TREE" > /dev/null 2>&1 || die "failed"
fi
append() { append() {
local series=$KERNEL_PATCHES/patches/series local series=$KERNEL_PATCHES/patches/series
echo "$(grep -v -e'^<<<<<<<' -e '^>>>>>>>' -e'=======' $series)" > $series echo "$(grep -v -e'^<<<<<<<' -e '^>>>>>>>' -e'=======' $series)" > $series
@@ -29,15 +47,6 @@ rebase() {
git rebase $1/$2 > /dev/null 2>&1 || append || die "could not rebase branch $1:$2" git rebase $1/$2 > /dev/null 2>&1 || append || die "could not rebase branch $1:$2"
} }
[ -z "$CLEAN" ] || rm -rf $KERNEL_TREE $KERNEL_CORE $KERNEL_PATCHES $LOGS
mkdir -p "$LOGS"
log "building linux kernel ${KERNEL_VERSION} with sky1-${TAG} patches"
if [ ! -d "$KERNEL_TREE" ]; then
log "cloning linux kernel repository"
git clone --depth=1 --branch=v$KERNEL_VERSION https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git "$KERNEL_TREE" > /dev/null 2>&1 || die "failed"
fi
if [ ! -d "$KERNEL_PATCHES" ]; then if [ ! -d "$KERNEL_PATCHES" ]; then
log "preparing for patching" log "preparing for patching"
git clone --depth=1 https://github.com/Sky1-Linux/linux-sky1.git > /dev/null 2>&1 || die "failed" git clone --depth=1 https://github.com/Sky1-Linux/linux-sky1.git > /dev/null 2>&1 || die "failed"