Skip to content

Instantly share code, notes, and snippets.

Embed
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
@nosada

This comment has been minimized.

Copy link
Owner Author

commented May 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.