Public release clean up

This commit is contained in:
Paul 2023-09-20 21:16:47 -05:00
parent 105d5f481c
commit e3359be459
5 changed files with 15 additions and 31 deletions

View file

@ -1,5 +1,5 @@
MIT License
Copyright (c) <year> <copyright holders>
Copyright (c) 2023 Paul Malcher
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

View file

@ -1,3 +1,12 @@
# syssetup
The purpose of this is to copy the setup of a exiting system and package it up in a retorable format. There are several steps this takes for now at least. It also really needs to be run as root or with sudo. It creates a temp dir where /etc gets copied to. Then apt gets probed for a list of all installed packages. This is sufficient for the system level of things, not one's home directory. Its a pretty simple script and should work on any debian based system. It also has a nice little menu just to make it more user friendly.
This system was created to allow of easy recreation or restoration of a existing system. This is not a backup application, nor does it create a image in the sense of a full disk image. It creates a snapshot of the current system configuration and installed packages. Once this information is collected it is packaged into standalone self extracting restore archive. It does this by copying your /etc folder and generating a list of installed programs via apt. These are then packaged into executable you can copy and run on another system. Great for duplicating a say a raspberry pi configuration. Works well for VPS systems as well, especially when you just need to do a clean reinstall.
# Scripts
check.bash - The main program. Generates snapshots and can be used to easily install makeself(required).
restore.bash - The program that is run when you run the created archive. It gives you the option to restore or exit. Also processes the required step to recreate things.
# Plans
To add flatpak support for making it more usable for desktops. Also support for OpenWRT, because I want to use this on my router.

View file

@ -3,7 +3,7 @@
#set -x # debug mode
# This should work on a Debian based system, any of them
# Requires makeslef and apt
# Requires makeself and apt
# Some menu things
@ -36,17 +36,12 @@ function press_enter() {
}
function copy_config() {
cprint 2 "Copying config files..."
cprint 2 "Creating restorable package..."
sleep 1
# create a temp folder
tmpdir=$(mktemp -d)
echo $tmpdir
cp -r /etc/ $tmpdir
#apt list --installed | awk -F/ '{print $1}' > $tmpdir/installed_packages
dpkg --get-selections > $tmpdir/installed_packages
# From https://wiki.debian.org/AptCLI#apt-file
# dpkg --get-selections >/backup/package-selections
# apt install $(cat /backup/package-selections | awk '{print $1}')
arcdir=$(mktemp -d)
echo $arcdir
mkslf=$(which makeself.sh)
@ -54,7 +49,7 @@ function copy_config() {
cp ./restore.bash $tmpdir
$mkslf --gzip $tmpdir $arcdir/restore.run "SFX archive for restoration" ./restore.bash
cp $arcdir/restore.run ./
chown kake26:kake26 restore.run
cprint 2 "Done!"
}

View file

@ -1,7 +1,5 @@
#!/bin/bash
set -x
function cprint () {
color="$1"
shift
@ -25,14 +23,9 @@ function press_enter() {
}
function restore_config() {
cprint 2 "Restoring config files..."
cprint 2 "Restoring system..."
sleep 1
# since we are run from a makeself file we need to check a few things
# get current directory
tmpcwd=$(pwd)
aptpkgfile="installed_packages"
# restore apt first
cp -R etc/apt/ /etc
apt update
@ -41,10 +34,6 @@ function restore_config() {
apt install -y $(cat $aptpkgfile | awk '{print $1}')
# we should be set app wise now the configs
cp -R etc/ /etc
# most files in here with me are from /etc
cprint 2 "Done!"
}

View file

@ -1,9 +0,0 @@
#!/bin/bash
mkslf=$(which makeself)
echo $mkslf
arcdir=$(mktemp -d)
echo $arcdir
tmpdir=$(mktemp -d)
echo $tmpdir
$mkslf --gzip $tmpdir $arcdir/restore.run "SFX archive for backup" echo "Extraction done"