diff --git a/LICENSE b/LICENSE index 472ac23..e99db0f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ MIT License -Copyright (c) +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: diff --git a/README.md b/README.md index 46e231f..0ca70cf 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file +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. \ No newline at end of file diff --git a/check.bash b/check.bash index b6c63eb..4709c7b 100755 --- a/check.bash +++ b/check.bash @@ -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!" } diff --git a/restore.bash b/restore.bash index 271d239..53c003d 100755 --- a/restore.bash +++ b/restore.bash @@ -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!" } diff --git a/test.bash b/test.bash deleted file mode 100644 index b74206f..0000000 --- a/test.bash +++ /dev/null @@ -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" \ No newline at end of file