Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment