update packages for arch linux nspawn container
This file contains 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 | |
nspawn-execute() { | |
pid=$(machinectl -a -l status $1 | grep Leader | awk '{print $2}'); | |
echo "Execute on $1: nsenter -t $pid -m -i -n -p ${@:2}"; | |
nsenter -t $pid -m -i -n -p "${@:2}"; | |
} | |
nspawn-execute-all() { | |
for i in $(machinectl list | grep nspawn | awk '{print $1}'); | |
do | |
nspawn-execute $i "${@:1}"; | |
done | |
} | |
yes | nspawn-execute-all pacman -Syu | |
yes | nspawn-execute-all pacman -Scc | |
nspawn-execute-all pacman-optimize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Most of this script is cited from http://iliyathenetworkguy.blogspot.jp/2016/04/systemd-nspawn-containers-command.html.