Skip to content

Instantly share code, notes, and snippets.

@sulincix
Last active February 5, 2025 13:35
Show Gist options
  • Save sulincix/79f0243b567ca1cb1181c6bfc781c771 to your computer and use it in GitHub Desktop.
Save sulincix/79f0243b567ca1cb1181c6bfc781c771 to your computer and use it in GitHub Desktop.
debian offline update
#!/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