add first working meta-layer

This commit is contained in:
DanyLE
2024-03-08 10:41:41 +01:00
parent 7a1ce5b08a
commit bdfbfc9669
64 changed files with 96512 additions and 0 deletions

View File

@ -0,0 +1,3 @@
# d root root 0755 /var/etc/upper none
# d root root 0755 /var/etc/work none
# l root root 0644 /etc/dropbear /var/etc/dropbear

View File

@ -0,0 +1,21 @@
#! /bin/sh
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo "$0 shall be run as root"
exit 1
fi
. /etc/profile
if [ ! -e /boot/config.txt ]; then
# prepare env for recovery boot
cat << EOF > /boot/config.txt
recovery=true
recovery_image=recovery-${MACHINE}.cpio.gz
EOF
else
sed -i 's/^.*recovery.*/recovery=true/g' /boot/config.txt || \
echo "recovery=true" >> /boot/config.txt
fi
echo "Rebooting to recovery mode"
reboot

View File

@ -0,0 +1,44 @@
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DESC="Auto deployment configuration from media"
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/mmcblk1p4
yes | mkfs.ext4 /dev/mmcblk1p4
mount /dev/mmcblk1p4 /home
mkdir -p /home/diya
chown -R diya:diya /home/diya
rm /boot/home_partition_should_be_formated
fi
if [ -e "/boot/wpa_supplicant.conf" ];then
mv /boot/wpa_supplicant.conf /etc/network/
reboot
fi
# display information
# disable wifi power save
# /usr/sbin/iw wlan0 set power_save off
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start}" >&2
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,37 @@
#! /bin/sh
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo "$0 shall be run as root"
exit 1
fi
line=$(
sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk /dev/mmcblk1 | grep /dev/mmcblk1p4
p
q
EOF
)
echo "Partition: $line"
#start_sector=$(echo "$line" | cut -d' ' -f14)
start_sector=$(echo "$line" | cut -d' ' -f15)
echo "Start sector is: $start_sector"
if [ -z "$start_sector" ]; then
echo "Cannot find the start sector"
exit 1
fi
echo "Expanding the partition"
sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk /dev/mmcblk1p4
d # delete partition
4 # number 4
n # new partition
p # primary partition
4 # partition number 4
$start_sector
# default - end of disk
p # print the in-memory partition table
w # write the partition table
q # and we're done
EOF

View File

@ -0,0 +1 @@
resize the partition