mirror of https://github.com/OpenIPC/firmware.git
				
				
				
			Move sdcard scripts to proper place (#684)
Co-authored-by: Viktor <viktorxda@users.noreply.github.com>pull/685/head
							parent
							
								
									ab406b645b
								
							
						
					
					
						commit
						a7d96cc985
					
				|  | @ -10,7 +10,7 @@ BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y | ||||||
| 
 | 
 | ||||||
| # Toolchain | # Toolchain | ||||||
| BR2_PER_PACKAGE_DIRECTORIES=y | BR2_PER_PACKAGE_DIRECTORIES=y | ||||||
| BR2_GCC_VERSION_9_X=y | BR2_GCC_VERSION_10_X=y | ||||||
| BR2_TOOLCHAIN_USES_GLIBC=y | BR2_TOOLCHAIN_USES_GLIBC=y | ||||||
| BR2_TOOLCHAIN_BUILDROOT_GLIBC=y | BR2_TOOLCHAIN_BUILDROOT_GLIBC=y | ||||||
| BR2_TOOLCHAIN_BUILDROOT_LIBC="glibc" | BR2_TOOLCHAIN_BUILDROOT_LIBC="glibc" | ||||||
|  |  | ||||||
|  | @ -4,7 +4,9 @@ | ||||||
| #
 | #
 | ||||||
| ################################################################################
 | ################################################################################
 | ||||||
| 
 | 
 | ||||||
|  | ifeq ($(BR2_LINUX_KERNEL_EXT_SIGMASTAR_INITRAMFS),y) | ||||||
| LINUX_EXTENSIONS += sigmastar-initramfs | LINUX_EXTENSIONS += sigmastar-initramfs | ||||||
|  | endif | ||||||
| 
 | 
 | ||||||
| SIGMASTAR_INITRAMFS_BUSYBOX_VERSION = 1.36.0 | SIGMASTAR_INITRAMFS_BUSYBOX_VERSION = 1.36.0 | ||||||
| SIGMASTAR_INITRAMFS_BUSYBOX_SOURCE = busybox-$(SIGMASTAR_INITRAMFS_BUSYBOX_VERSION).tar.bz2 | SIGMASTAR_INITRAMFS_BUSYBOX_SOURCE = busybox-$(SIGMASTAR_INITRAMFS_BUSYBOX_VERSION).tar.bz2 | ||||||
|  |  | ||||||
|  | @ -13,16 +13,6 @@ grep -q overlay /proc/filesystems || exit | ||||||
| if ! grep -q 'root=.*nfs\|mmcblk\|ram' /proc/cmdline; then | if ! grep -q 'root=.*nfs\|mmcblk\|ram' /proc/cmdline; then | ||||||
|   if grep -q ubifs /proc/cmdline; then |   if grep -q ubifs /proc/cmdline; then | ||||||
|     mount -t ubifs ubi0:rootfs_data /overlay |     mount -t ubifs ubi0:rootfs_data /overlay | ||||||
| # The code block is disabled until a fix is made due to a global problem with the overlay |  | ||||||
| #  elif grep -q loop /proc/devices; then |  | ||||||
| #    mount -t devtmpfs devtmpfs /dev |  | ||||||
| #    mount -t tmpfs tmpfs /overlay |  | ||||||
| #    sleep 1 |  | ||||||
| #    mkdir -p /overlay/sdcard |  | ||||||
| #    mount -r /dev/mmcblk0p1 /overlay/sdcard |  | ||||||
| #    tar -xf /overlay/sdcard/settings.tar -C /overlay && echo OpenIPC: Extract settings from sdcard |  | ||||||
| #    umount /overlay/sdcard |  | ||||||
| #    rmdir /overlay/sdcard |  | ||||||
|   else |   else | ||||||
|     mtdblkdev=$(awk -F ':' '/rootfs_data/ {print $1}' /proc/mtd | sed 's/mtd/mtdblock/') |     mtdblkdev=$(awk -F ':' '/rootfs_data/ {print $1}' /proc/mtd | sed 's/mtd/mtdblock/') | ||||||
|     mtdchrdev=$(grep 'rootfs_data' /proc/mtd | cut -d: -f1) |     mtdchrdev=$(grep 'rootfs_data' /proc/mtd | cut -d: -f1) | ||||||
|  |  | ||||||
|  | @ -1,21 +1,37 @@ | ||||||
| #!/bin/sh | #!/bin/sh | ||||||
|  | rootfs=/squashfs | ||||||
|  | overlay=$rootfs/mnt | ||||||
|  | rootdir=/overlay/root | ||||||
|  | workdir=/overlay/work | ||||||
|  | 
 | ||||||
| mount -t devtmpfs devtmpfs /dev | mount -t devtmpfs devtmpfs /dev | ||||||
| mount -t proc proc /proc | mount -t proc proc /proc | ||||||
| mount -t sysfs sysfs /sys | mount -t sysfs sysfs /sys | ||||||
| 
 | 
 | ||||||
| sleep 1 | sleep 1 | ||||||
| fsck.fat -a /dev/mmcblk0p1 | fsck.fat -a /dev/mmcblk0p1 | ||||||
| mkdir -p /root /sdcard /tmp | mkdir -p $rootfs /overlay /sdcard /tmp | ||||||
| mount -r /dev/mmcblk0p1 /sdcard | mount -r /dev/mmcblk0p1 /sdcard | ||||||
| 
 | 
 | ||||||
| echo OpenIPC: Copy squashfs | echo OpenIPC: Copy squashfs | ||||||
| cp -f /sdcard/rootfs.squashfs.* /tmp || exec sh | cp -f /sdcard/rootfs.squashfs.* /tmp || exec sh | ||||||
| mount /tmp/rootfs.squashfs.* /root || exec sh | mount /tmp/rootfs.squashfs.* $rootfs || exec sh | ||||||
|  | mount -t tmpfs tmpfs /overlay | ||||||
|  | if [ -f /sdcard/settings.tar ]; then | ||||||
|  | 	tar -xf /sdcard/settings.tar -C /overlay | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | echo OpenIPC: Mount overlayfs | ||||||
|  | mkdir -p $rootdir $workdir | ||||||
|  | mount -t overlay overlay -o lowerdir=$rootfs,upperdir=$rootdir,workdir=$workdir $overlay | ||||||
|  | mount -o move /dev $overlay/dev | ||||||
|  | mount -o move /overlay $overlay/overlay | ||||||
|  | ln -sf ../wireless/interfaces $overlay/etc/network/interfaces | ||||||
|  | cp -f /bin/savesettings $overlay/usr/bin | ||||||
| 
 | 
 | ||||||
| umount /sdcard | umount /sdcard | ||||||
| umount /dev |  | ||||||
| umount /proc | umount /proc | ||||||
| umount /sys | umount /sys | ||||||
| 
 | 
 | ||||||
| echo OpenIPC: Switch to new root | echo OpenIPC: Switch to new root | ||||||
| exec switch_root /root /init | exec switch_root $overlay /sbin/init | ||||||
|  |  | ||||||
|  | @ -1138,7 +1138,7 @@ CONFIG_ASH_ALIAS=y | ||||||
| # CONFIG_ASH_MAIL is not set | # CONFIG_ASH_MAIL is not set | ||||||
| CONFIG_ASH_ECHO=y | CONFIG_ASH_ECHO=y | ||||||
| CONFIG_ASH_PRINTF=y | CONFIG_ASH_PRINTF=y | ||||||
| # CONFIG_ASH_TEST is not set | CONFIG_ASH_TEST=y | ||||||
| CONFIG_ASH_SLEEP=y | CONFIG_ASH_SLEEP=y | ||||||
| CONFIG_ASH_HELP=y | CONFIG_ASH_HELP=y | ||||||
| # CONFIG_ASH_GETOPTS is not set | # CONFIG_ASH_GETOPTS is not set | ||||||
|  |  | ||||||
|  | @ -6,6 +6,7 @@ dir /sys 755 0 0 | ||||||
| 
 | 
 | ||||||
| file /init initramfs/init 755 0 0 | file /init initramfs/init 755 0 0 | ||||||
| file /bin/fsck.fat initramfs/fsck.fat 755 0 0 | file /bin/fsck.fat initramfs/fsck.fat 755 0 0 | ||||||
|  | file /bin/savesettings initramfs/savesettings 755 0 0 | ||||||
| 
 | 
 | ||||||
| file /bin/busybox initramfs/busybox 755 0 0 | file /bin/busybox initramfs/busybox 755 0 0 | ||||||
| slink /bin/sh busybox 777 0 0 | slink /bin/sh busybox 777 0 0 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,7 @@ | ||||||
| #!/bin/sh | #!/bin/sh | ||||||
| if grep -q loop /proc/devices; then | if [ -d /mnt/mmcblk0p1 ]; then | ||||||
| 	tar -cf /tmp/settings.tar -C /overlay root | 	tar -cf /tmp/settings.tar -C /overlay root | ||||||
| 	mv -f /tmp/settings.tar /mnt/mmcblk0p1 && echo OpenIPC: Save settings to sdcard | 	mv -f /tmp/settings.tar /mnt/mmcblk0p1 && echo OpenIPC: Save settings to sdcard | ||||||
|  | else | ||||||
|  | 	echo OpenIPC: Cannot save settings to sdcard | ||||||
| fi | fi | ||||||
|  | @ -7,9 +7,9 @@ iface eth0 inet dhcp | ||||||
| 
 | 
 | ||||||
| auto wlan0 | auto wlan0 | ||||||
| iface wlan0 inet dhcp | iface wlan0 inet dhcp | ||||||
|     pre-up /etc/network/netsetup startup |     pre-up /etc/wireless/netsetup startup | ||||||
|     post-up /etc/network/netsetup connect |     post-up /etc/wireless/netsetup connect | ||||||
|     post-down /etc/network/netsetup shutdown |     post-down /etc/wireless/netsetup shutdown | ||||||
| 
 | 
 | ||||||
| manual wg0 | manual wg0 | ||||||
| iface wg0 inet static | iface wg0 inet static | ||||||
|  |  | ||||||
|  | @ -17,12 +17,12 @@ if [ $1 = "connect" ]; then | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| if [ $1 = "startup" ]; then | if [ $1 = "startup" ]; then | ||||||
| 	/etc/network/netadapter $1 | 	/etc/wireless/netadapter $1 | ||||||
| 	ifconfig eth0 192.168.2.10 | 	ifconfig eth0 192.168.2.10 | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| if [ $1 = "shutdown" ]; then | if [ $1 = "shutdown" ]; then | ||||||
| 	killall -q udhcpd | 	killall -q udhcpd | ||||||
| 	killall -q wpa_supplicant | 	killall -q wpa_supplicant | ||||||
| 	/etc/network/netadapter $1 | 	/etc/wireless/netadapter $1 | ||||||
| fi | fi | ||||||
|  |  | ||||||
|  | @ -9,6 +9,19 @@ WIRELESS_CONFIGURATION_SITE = | ||||||
| WIRELESS_CONFIGURATION_LICENSE = MIT | WIRELESS_CONFIGURATION_LICENSE = MIT | ||||||
| WIRELESS_CONFIGURATION_LICENSE_FILES = LICENSE | WIRELESS_CONFIGURATION_LICENSE_FILES = LICENSE | ||||||
| 
 | 
 | ||||||
| BR2_ROOTFS_POST_BUILD_SCRIPT += $(WIRELESS_CONFIGURATION_PKGDIR)/wireless-configuration.sh | WIRELESS_CONFIGURATION_PATH = ../general/package/wireless-configuration/files | ||||||
|  | 
 | ||||||
|  | define WIRELESS_CONFIGURATION_INSTALL_TARGET_CMDS | ||||||
|  | 	$(INSTALL) -m 755 -d $(TARGET_DIR)/etc | ||||||
|  | 	cp -f $(WIRELESS_CONFIGURATION_PATH)/udhcpd.conf $(TARGET_DIR)/etc | ||||||
|  | 
 | ||||||
|  | 	$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/wireless | ||||||
|  | 	cp -f $(WIRELESS_CONFIGURATION_PATH)/interfaces $(TARGET_DIR)/etc/wireless | ||||||
|  | 	cp -f $(WIRELESS_CONFIGURATION_PATH)/netadapter $(TARGET_DIR)/etc/wireless | ||||||
|  | 	cp -f $(WIRELESS_CONFIGURATION_PATH)/netsetup $(TARGET_DIR)/etc/wireless | ||||||
|  | 
 | ||||||
|  | 	$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/sbin | ||||||
|  | 	cp -f $(WIRELESS_CONFIGURATION_PATH)/wireless $(TARGET_DIR)/usr/sbin | ||||||
|  | endef | ||||||
| 
 | 
 | ||||||
| $(eval $(generic-package)) | $(eval $(generic-package)) | ||||||
|  |  | ||||||
|  | @ -1,7 +0,0 @@ | ||||||
| #!/bin/bash |  | ||||||
| FILES=../general/package/wireless-configuration/files |  | ||||||
| cp -f $FILES/udhcpd.conf $TARGET_DIR/etc |  | ||||||
| cp -f $FILES/interfaces $TARGET_DIR/etc/network |  | ||||||
| cp -f $FILES/netadapter $TARGET_DIR/etc/network |  | ||||||
| cp -f $FILES/netsetup $TARGET_DIR/etc/network |  | ||||||
| cp -f $FILES/wireless $TARGET_DIR/usr/sbin |  | ||||||
		Loading…
	
		Reference in New Issue