Skip to content

Instantly share code, notes, and snippets.

@heiwa4126
Last active May 12, 2021 01:26
Show Gist options
  • Save heiwa4126/89aab32982e2982aaf8e9bc020a588ef to your computer and use it in GitHub Desktop.
Save heiwa4126/89aab32982e2982aaf8e9bc020a588ef to your computer and use it in GitHub Desktop.
Ubuntu 18.04LTSで、手動アップデートの際に使ってるスクリプト。~/bin/update.shに置いてる。
#!/bin/bash -e
sudo -i sh -c "\
apt-get update ;\
apt-get -uyd dist-upgrade\
"
echo "Continue? (Enter or Ctrl+C)" ; read Wait
sudo -i sh -c "\
apt-get -uy dist-upgrade ;\
apt-get autoremove --purge -y ;\
apt-get autoclean \
"
NEED_REBOOT=/var/run/reboot-required
if [ -f "$NEED_REBOOT" ] ; then
cat "$NEED_REBOOT"
fi
NEED_REBOOT_PKG=/var/run/reboot-required.pkgs
if [ -f "$NEED_REBOOT_PKG" ] ; then
cat "$NEED_REBOOT_PKG"
fi
@heiwa4126
Copy link
Author

heiwa4126 commented May 12, 2021

  • キャッシュしてからアップデートをインストールする。
  • キャッシュ完了した段階で中断できる。
  • 最後に再起動が必要か表示される。

のが特徴

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment