コマンドラインでPackageKitを使用してオフライン更新後に閉じる

コマンドラインでPackageKitを使用してオフライン更新後に閉じる

いつパッケージキットインストールするアップデートを入手した後にGnome GUIを使用してコンピュータをシャットダウンすると、終了する前にアップデートをインストールするようにチェックボックスを設定できます。ルートなしでコマンドラインでこれを行うにはどうすればよいですか?例目的:終了前にカスタムコマンドを自動的に実行します。

ベストアンサー1

# This will force fetching repository data and updates
pkcon get-updates
pkcon update --only-download

dbus-send --system --type=method_call --print-reply \
  --dest=org.freedesktop.PackageKit \
  /org/freedesktop/PackageKit \
  org.freedesktop.PackageKit.Offline.Trigger \
  string:power-off

if pkcon offline-get-prepared; then
  systemctl reboot
else
  systemctl poweroff
fi

コマンドを削除しdbus-sendifブロックをに置き換えると、systemctl rebootシステムが再起動します。

おすすめ記事