diff --git a/README.md b/README.md index 2b7d98c..23e9bb0 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This system was created to allow of easy recreation or restoration of a existing # 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 restore.*.bash - these are scripts specific to debian or arch 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. +# 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) \ No newline at end of file diff --git a/bootstrap.wrt.ash b/bootstrap.wrt.ash new file mode 100755 index 0000000..e2a09d4 --- /dev/null +++ b/bootstrap.wrt.ash @@ -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 + diff --git a/installed.bash b/installed.bash new file mode 100644 index 0000000..968905a --- /dev/null +++ b/installed.bash @@ -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 + +} \ No newline at end of file diff --git a/os_probe.bash b/os_probe.bash index 0abafd3..a01266a 100755 --- a/os_probe.bash +++ b/os_probe.bash @@ -18,6 +18,12 @@ if [ -x "$(command -v pacman)" ]; then osp="Arch" fi +# check if opkg is installed + +if [ -x "$(command -v opkg)" ]; then + osp="Openwrt" +fi + # I know its so high tech and amazing right? diff --git a/restore.wrt.bash b/restore.wrt.bash new file mode 100755 index 0000000..20cbf2d --- /dev/null +++ b/restore.wrt.bash @@ -0,0 +1,4 @@ +#!/bin/bash + +# This will be called after the bootstrap. As we need to make sure bash is present + diff --git a/syssetup.bash b/syssetup.bash index e5ef858..a6333c6 100755 --- a/syssetup.bash +++ b/syssetup.bash @@ -57,12 +57,26 @@ if [ "$osp" = "Arch" ]; then pacman -Qqen > $tmpdir/installed_packages cp ./restore.arch.bash $tmpdir/restore.bash 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) echo $arcdir 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 + + fi cp $arcdir/restore.run ./ cprint 2 "Done!"