Files
linuxkit/alpine/etc/init.d/automount
2015-12-14 18:16:08 +00:00

26 lines
456 B
Plaintext
Executable File

#!/sbin/openrc-run
depend()
{
after dev
before docker
}
start()
{
ebegin "Configuring host block device"
# XXX this may change on other ports
DEV="sda"
DRIVE="/dev/${DEV}"
SWAP="${DRIVE}1"
DATA="${DRIVE}2"
if fdisk -l ${DRIVE} | grep -q "doesn't contain a valid partition table"
then
ERASE_DISKS="${DRIVE}" setup-disk -m data ${DRIVE}
else
mount ${DATA} /var && swapon ${SWAP} || ERASE_DISKS="${DRIVE}" setup-disk -m data ${DRIVE}
fi
}