Files
meta-diya/recipes-diya/diya-overlay/files/confd

49 lines
1.4 KiB
Bash

#!/bin/sh
DESC="Auto deployment configuration from media"
. /etc/profile
PATH=/sbin:/bin:/usr/sbin:/usr/bin
if [ -z "$DISK" ]; then
DISK="mmcblk0"
fi
case "$1" in
start)
echo -n "Start $DESC: "
# mount the overlay which is not auto mount by fstab
# this make /etc editable
mount -t overlay -o lowerdir=/etc,upperdir=/var/etc/upper,workdir=/var/etc/work overlay /etc
# for some reason the LCD backlight is turned off
# need to turn it on manually
if [ -f "/boot/fs_resize" ]; then
/sbin/expandfs.sh
touch /boot/home_partition_should_be_formated
rm /boot/fs_resize
reboot
fi
if [ -f "/boot/home_partition_should_be_formated" ]; then
echo "Trying to format the home partition"
umount /dev/${DISK}p4
yes | mkfs.ext4 /dev/${DISK}p4
mount /dev/${DISK}p4 /home
rm /boot/home_partition_should_be_formated
fi
if [ ! -d "/home/diya" ]; then
mkdir -p /home/diya
chown -R diya:diya /home/diya
fi
if ls /boot/*.nmconnection > /dev/null 2>&1 ;then
mv /boot/*.nmconnection /etc/NetworkManager/system-connections/
chmod 600 /etc/NetworkManager/system-connections/*.nmconnection
fi
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start}" >&2
exit 1
;;
esac
exit 0