#!/bin/bash run_latehook() { if [[ -f /new_root/blend/states/.load_prev_state ]] && compgen -G "/new_root/blend/states/state+([0-9]).tar.gz" >/dev/null; then rm -rf /new_root/blend/overlay/current mkdir -p /new_root/blend/overlay/current/usr c=0 for i in $(compgen -G "/new_root/blend/states/state*.tar.gz"); do n="${i:19:-7}" if [[ "$n" -gt "$c" ]]; then c="$n" fi done tar -xvpzf "/new_root/blend/states/state${c}.tar.gz" -C "/new_root/blend/overlay/current/usr" --numeric-owner &>/dev/null rm -f "/new_root/blend/states/state${c}.tar.gz" "/new_root/blend/states/.load_prev_state" fi mkdir -p /new_root/blend/overlay/current/usr/bin \ /new_root/blend/overlay/current/usr/sbin \ /new_root/blend/overlay/current/usr/share mkdir -p /new_root/usr/bin \ /new_root/usr/sbin \ /new_root/usr/share rm -rf /new_root/blend/overlay/workdir_1 /new_root/blend/overlay/workdir_2 /new_root/blend/overlay/workdir_3 mkdir -p /new_root/blend/overlay/workdir_1 /new_root/blend/overlay/workdir_2 /new_root/blend/overlay/workdir_3 mount -t overlay overlay -o 'lowerdir=/new_root/usr/bin,upperdir=/new_root/blend/overlay/current/usr/bin,workdir=/new_root/blend/overlay/workdir_1' /new_root/usr/bin -o index=off mount -t overlay overlay -o 'lowerdir=/new_root/usr/sbin,upperdir=/new_root/blend/overlay/current/usr/sbin,workdir=/new_root/blend/overlay/workdir_2' /new_root/usr/sbin -o index=off mount -t overlay overlay -o 'lowerdir=/new_root/usr/share,upperdir=/new_root/blend/overlay/current/usr/share,workdir=/new_root/blend/overlay/workdir_3' /new_root/usr/share -o index=off }