Last active
February 5, 2025 13:35
-
-
Save sulincix/79f0243b567ca1cb1181c6bfc781c771 to your computer and use it in GitHub Desktop.
debian offline update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export DEBIAN_FRONTEND=noninteractive | |
export DEBCONF_NONINTERACTIVE_SEEN=1 | |
export TERM=linux | |
if [ $$ -ne 1 ] ; then | |
set -e | |
apt update | |
apt install kexec-tools -yq | |
apt full-upgrade -yq --download-only | |
sync | |
if [ ! -f /usr/libexec/offline-update ] ; then | |
install -Dm755 $0 /usr/libexec/offline-update | |
fi | |
kexec \ | |
-l /boot/vmlinuz-$(uname -r) \ | |
--initrd=/boot/initrd.img-$(uname -r) \ | |
--append="$(cat /proc/cmdline) init=/usr/libexec/offline-update" | |
kexec -e | |
else | |
mount -o remount,rw / | |
apt full-upgrade -yq | |
sync | |
reboot -f | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment