Skip to content

Instantly share code, notes, and snippets.

@nosada
Last active May 5, 2017 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nosada/8881db36b1cd0cf2b76864b0c59a1e1b to your computer and use it in GitHub Desktop.
Save nosada/8881db36b1cd0cf2b76864b0c59a1e1b to your computer and use it in GitHub Desktop.
update packages for arch linux nspawn container
#!/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
@nosada
Copy link
Author

nosada commented May 5, 2017

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