Created
September 19, 2018 12:50
-
-
Save mjeveritt/5ce16a1311b6dab36bd106de4b030b31 to your computer and use it in GitHub Desktop.
mnt_kern.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eu | |
if [[ "$#" -ne 1 ]]; then | |
echo "Usage: mnt_kern <directory>" | |
exit 1 | |
fi | |
if [[ ! -r "squash/${1}.sqfs" ]]; then | |
echo "No squashfs file found in squash folder" | |
exit 1 | |
fi | |
KERND=$1 | |
LOWER=/var/tmp/overlayfs/lower/${KERND} | |
UPPER=/usr/src/overlay/${KERND} | |
WORKD=/var/tmp/overlayfs/workdir/${KERND} | |
MERGD=/usr/src/${KERND} | |
[[ -d ${LOWER} ]] || mkdir -p ${LOWER} | |
[[ -d ${UPPER} ]] || mkdir -p ${UPPER} | |
[[ -d ${WORKD} ]] || mkdir -p ${WORKD} | |
[[ -d ${MERGD} ]] || mkdir -p ${MERGD} | |
mount -r -o nodev,noexec,noatime squash/${KERND}.sqfs ${LOWER} | |
mount -t overlay -o lowerdir=${LOWER},upperdir=${UPPER},workdir=${WORKD} overlay ${MERGD} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This needs making: