save point for openwrt support addition

This commit is contained in:
Paul M 2023-10-06 22:21:58 -05:00
parent 13091dd1c2
commit f836a6317e
6 changed files with 60 additions and 1 deletions

View file

@ -4,7 +4,7 @@ This system was created to allow of easy recreation or restoration of a existing
# Scripts # Scripts
check.bash - checks if makeself is installed check.bash - checks if makeself is installed. Can be installed via normal methods or via this script
os_probe.bash - checks if we are on a debian or arch based distro via looking for apt or pacman os_probe.bash - checks if we are on a debian or arch based distro via looking for apt or pacman
restore.*.bash - these are scripts specific to debian or arch restore.*.bash - these are scripts specific to debian or arch
syssetup.bash - The main program syssetup.bash - The main program
@ -14,4 +14,8 @@ test.bash - Some file I was using to test something, you can ignore it
To add flatpak support for making it more usable for desktops. Also support for OpenWRT, because I want to use this on my router. To add flatpak support for making it more usable for desktops. Also support for OpenWRT, because I want to use this on my router.
# Notes Oct 6 2023
Arch support added. This should cover allot of various distros. OpenWRT is being added to as I have code to handle that already, just needs integration.
[![built with Codeium](https://codeium.com/badges/main)](https://codeium.com) [![built with Codeium](https://codeium.com/badges/main)](https://codeium.com)

14
bootstrap.wrt.ash Executable file
View file

@ -0,0 +1,14 @@
#!/bin/ash
if [ -x "$(command -v bash)" ]; then
echo "bash is installed, good"
else
echo "Bash is not here I'll install it"
opkg update
okpkg install bash
fi
# now run the main restore script
./restore.bash

17
installed.bash Normal file
View file

@ -0,0 +1,17 @@
#!/bin/bash
# this code gets all user installed / updated packages, some are dependencies
flist=installed.list
function installed() {
if [[ -f "$flist" ]]
then
echo "File $flist exists!"
exit 0;
fi
ls /overlay/upper/usr/lib/opkg/info/*.list | sed -e 's/.*\///' | sed -e 's/\.list//' > installed.list
}

View file

@ -18,6 +18,12 @@ if [ -x "$(command -v pacman)" ]; then
osp="Arch" osp="Arch"
fi fi
# check if opkg is installed
if [ -x "$(command -v opkg)" ]; then
osp="Openwrt"
fi
# I know its so high tech and amazing right? # I know its so high tech and amazing right?

4
restore.wrt.bash Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
# This will be called after the bootstrap. As we need to make sure bash is present

View file

@ -57,12 +57,26 @@ if [ "$osp" = "Arch" ]; then
pacman -Qqen > $tmpdir/installed_packages pacman -Qqen > $tmpdir/installed_packages
cp ./restore.arch.bash $tmpdir/restore.bash cp ./restore.arch.bash $tmpdir/restore.bash
fi fi
if [ "$osp" = "Openwrt" ]; then
opkg list-installed > $tmpdir/installed_packages
cp ./restore.wrt.bash $tmpdir/restore.bash
cp ./bootstrap.wrt.ash $tmpdir
fi
arcdir=$(mktemp -d) arcdir=$(mktemp -d)
echo $arcdir echo $arcdir
echo $mkslf echo $mkslf
if [ "$osp" = "Openwrt" ]; then
$mkslf --gzip $tmpdir $arcdir/restore.run "SFX archive for restoration" ./bootstrap.wrt.ash
else
$mkslf --gzip $tmpdir $arcdir/restore.run "SFX archive for restoration" ./restore.bash $mkslf --gzip $tmpdir $arcdir/restore.run "SFX archive for restoration" ./restore.bash
fi
cp $arcdir/restore.run ./ cp $arcdir/restore.run ./
cprint 2 "Done!" cprint 2 "Done!"