Commit 4a3774a2 authored by Jonathan Bryant's avatar Jonathan Bryant 💬

Update distro.sh

parent c091ceeb
......@@ -2,13 +2,28 @@
FILES="ssh_authorized_keys ssh_host_key container_token"
check_penguin() {
if [ -z "$(/usr/bin/lxc ls | /bin/grep 'penguin | RUNNING')" ]; then
echo "Penguin is not running."
start_old_penguin() {
/usr/bin/lxc start penguin
if [ -n "$?" ]; then
echo "Something went wrong with trying to recover penguin."
exit 1
fi
}
check_penguin() {
if [ -n "$(/usr/bin/lxc ls | /bin/grep 'penguin | STOPPED')" ]; then
start_old_penguin
elif [ -n "$(/usr/bin/lxc ls | /bin/grep 'penguin | RUNNING')" ]; then
# Do nothing. This is a good thing.
elif [ -n "$(/usr/bin/lxc ls | /bin/grep 'oldpenguin')" ]; then
/usr/bin/lxc stop oldpenguin -f || true
/usr/bin/lxc rename oldpenguin penguin
start_old_penguin
else
echo "Looks like penguin_old is gone. You might want to reinstall linux on chrome."
fi
}
get_file() {
# All ssh mounts have an added term.
if [ -z "$(echo $1 | /bin/grep ssh)" ]; then
......@@ -51,7 +66,7 @@ swap_penguin() {
values_penguin
local USER="$(user_penguin)"
/usr/bin/lxc stop penguin --force
/usr/bin/lxc rename penguin penguin_old
/usr/bin/lxc rename penguin oldpenguin
mod_run
/mnt/stateful/lxd_conf/run_container.sh --container_name="penguin" --user="$USER" --lxd_image="$1" --lxd_remote="https://images.linuxcontainers.org:8443" --container_token="$container_token" --host_public_key="$ssh_host_key" --guest_private_key="$authorized_keys"
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment