diff --git a/opkg-source/SDXPINN-mount-fix/CONTROL/control b/opkg-source/SDXPINN-mount-fix/CONTROL/control index f43a042..418385b 100644 --- a/opkg-source/SDXPINN-mount-fix/CONTROL/control +++ b/opkg-source/SDXPINN-mount-fix/CONTROL/control @@ -1,6 +1,6 @@ -Package: SDXPINN-mount-fix +Package: sdxpinn-mount-fix Version: 1.0 -Architecture: arm64 +Architecture: aarch64_cortex-a53 Maintainer: Cameron Thompson iamromulan@github.com Description: Creates a usable mount space and overlay for SDXPINN modems -Depends: libc \ No newline at end of file +Depends: libc diff --git a/opkg-source/SDXPINN-mount-fix/CONTROL/postinst b/opkg-source/SDXPINN-mount-fix/CONTROL/postinst index 0106eea..01c90db 100644 --- a/opkg-source/SDXPINN-mount-fix/CONTROL/postinst +++ b/opkg-source/SDXPINN-mount-fix/CONTROL/postinst @@ -1,5 +1,23 @@ #!/bin/ash +# Replace distfeeds.conf with non-working sources commented out +# Check if the temporary distfeeds.conf file exists +if [ -f /tmp/distfeeds.conf ]; then + # Backup the existing /etc/opkg/distfeeds.conf if it exists + if [ -f /etc/opkg/distfeeds.conf ]; then + cp /etc/opkg/distfeeds.conf /etc/opkg/distfeeds.conf.bak + echo "Backed up original /etc/opkg/distfeeds.conf to /etc/opkg/distfeeds.conf.bak" + fi + + # Move the new distfeeds.conf from /tmp to /etc/opkg + mv /tmp/distfeeds.conf /etc/opkg/distfeeds.conf + echo "Replaced /etc/opkg/distfeeds.conf with the custom version." +else + echo "Error: /tmp/distfeeds.conf not found. Cannot replace /etc/opkg/distfeeds.conf." + exit 1 +fi + + # Make the init script executable chmod +x /etc/init.d/mount-fix chmod +x /etc/init.d/init-overlay-watchdog diff --git a/opkg-source/SDXPINN-mount-fix/CONTROL/preinst b/opkg-source/SDXPINN-mount-fix/CONTROL/preinst index 0ae7f98..fe6f7d1 100644 --- a/opkg-source/SDXPINN-mount-fix/CONTROL/preinst +++ b/opkg-source/SDXPINN-mount-fix/CONTROL/preinst @@ -6,10 +6,8 @@ if grep -qs '/etc ' /proc/mounts; then umount -lf /etc fi -# Check if root filesystem is mounted as read-only -if grep -qs " / " /proc/mounts | grep "(ro,"; then - echo "Remounting root filesystem as read-write..." - mount -o remount,rw / -fi +# Remount original rootfs as read-write +echo "Mounting / as read-write" +mount -o remount,rw / exit 0 diff --git a/opkg-source/sdxpinn-mount-fix/build-ipk b/opkg-source/sdxpinn-mount-fix/build-ipk new file mode 100644 index 0000000..eb83cf6 --- /dev/null +++ b/opkg-source/sdxpinn-mount-fix/build-ipk @@ -0,0 +1,74 @@ +#!/bin/sh + +# Script for building OpenWRT .ipk packages using tar by iamromulan +# Works with SDXPPINN OpenWRT - iamromulan +# This script accepts an optional path to the directory containing the `CONTROL` and `root` directories. +# Usage: ./build-ipk.sh [path] +# If no path is provided, the script will look in the current directory for `CONTROL` and `root` directories. +# This will spit out an ipk in the current directory + +# Check if the script is run as root. If not, rerun with sudo. +if [ "$(id -u)" -ne 0 ]; then + echo "Script is not running as root. Re-executing with sudo..." + exec sudo "$0" "$@" +fi + +# Set the default build path to the current directory +build_path="." + +# Check if a path is provided as the first argument +if [ "$1" ]; then + build_path="$1" +fi + +# Check if the required directories are present in the specified path +if [ ! -d "${build_path}/CONTROL" ] || [ ! -d "${build_path}/root" ]; then + echo "Error: CONTROL and root directories must be present in the specified path (${build_path})." + exit 1 +fi + +# Extract values from the CONTROL/control file in the specified path +pkgname=$(grep -i '^Package:' "${build_path}/CONTROL/control" | awk '{print $2}') +version=$(grep -i '^Version:' "${build_path}/CONTROL/control" | awk '{print $2}') +architecture=$(grep -i '^Architecture:' "${build_path}/CONTROL/control" | awk '{print $2}') + +# Check if values are extracted correctly +if [ -z "$pkgname" ] || [ -z "$version" ] || [ -z "$architecture" ]; then + echo "Error: Failed to extract Package, Version, or Architecture from ${build_path}/CONTROL/control." + exit 1 +fi + +# Set the final IPK name based on the extracted values +ipkname="${pkgname}_${version}_${architecture}.ipk" + +# Ensure all CONTROL scripts are executable +echo "Setting permissions for CONTROL scripts..." +chmod +x "${build_path}/CONTROL"/* + +# Set ownership for CONTROL and root files +echo "Setting ownership for all package files..." +chown -R root:root "${build_path}/CONTROL"/* +chown -R root:root "${build_path}/root"/* + +# Create control.tar.gz from the CONTROL directory +echo "Creating control.tar.gz..." +tar -czvf control.tar.gz -C "${build_path}/CONTROL" . + +# Create data.tar.gz from the root directory +echo "Creating data.tar.gz..." +tar -czvf data.tar.gz -C "${build_path}/root" . + +# Create debian-binary file (must contain exactly "2.0" without a newline) +echo -n "2.0" > debian-binary +chown -R root:root debian-binary + +# Combine the components into the final .ipk file using tar +echo "Packaging ${ipkname}..." +tar -czvf "$ipkname" debian-binary control.tar.gz data.tar.gz + +# Clean up intermediate files +echo "Cleaning up temporary files..." +rm -f control.tar.gz data.tar.gz debian-binary + +echo "IPK package ${ipkname} created successfully using tar." + diff --git a/opkg-source/SDXPINN-mount-fix/root/etc/opkg/distfeeds.conf b/opkg-source/sdxpinn-mount-fix/root/tmp/distfeeds.conf similarity index 100% rename from opkg-source/SDXPINN-mount-fix/root/etc/opkg/distfeeds.conf rename to opkg-source/sdxpinn-mount-fix/root/tmp/distfeeds.conf diff --git a/opkg-source/sdxpinn-mount-fix/sdxpinn-mount-fix_1.0_aarch64_cortex-a53.ipk b/opkg-source/sdxpinn-mount-fix/sdxpinn-mount-fix_1.0_aarch64_cortex-a53.ipk new file mode 100644 index 0000000..72e0fdd Binary files /dev/null and b/opkg-source/sdxpinn-mount-fix/sdxpinn-mount-fix_1.0_aarch64_cortex-a53.ipk differ