save point
This commit is contained in:
parent
b63edea4a5
commit
bacf64dc22
6 changed files with 57 additions and 7014 deletions
|
@ -1,3 +1,3 @@
|
||||||
# syssetup
|
# syssetup
|
||||||
|
|
||||||
A tool to copy an existing setup and recreate it for use in say a reinstall
|
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.
|
27
check.bash
27
check.bash
|
@ -1,6 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
#set -x # debug mode
|
||||||
|
|
||||||
# This should work on a Debian based system, any of them
|
# This should work on a Debian based system, any of them
|
||||||
|
# Requires makeslef and apt
|
||||||
|
|
||||||
# Some menu things
|
# Some menu things
|
||||||
|
|
||||||
|
@ -35,7 +38,6 @@ function press_enter() {
|
||||||
function copy_config() {
|
function copy_config() {
|
||||||
cprint 2 "Copying config files..."
|
cprint 2 "Copying config files..."
|
||||||
sleep 1
|
sleep 1
|
||||||
#cp -r /etc/ /tmp/
|
|
||||||
# create a temp folder
|
# create a temp folder
|
||||||
tmpdir=$(mktemp -d)
|
tmpdir=$(mktemp -d)
|
||||||
echo $tmpdir
|
echo $tmpdir
|
||||||
|
@ -44,6 +46,22 @@ function copy_config() {
|
||||||
# From https://wiki.debian.org/AptCLI#apt-file
|
# From https://wiki.debian.org/AptCLI#apt-file
|
||||||
# dpkg --get-selections >/backup/package-selections
|
# dpkg --get-selections >/backup/package-selections
|
||||||
# apt install $(cat /backup/package-selections | awk '{print $1}')
|
# apt install $(cat /backup/package-selections | awk '{print $1}')
|
||||||
|
arcdir=$(mktemp -d)
|
||||||
|
echo $arcdir
|
||||||
|
mkslf=$(which makeself.sh)
|
||||||
|
echo $mkslf
|
||||||
|
$mkslf --gzip $tmpdir $arcdir/restore.run "SFX archive for backup" echo "Extraction done"
|
||||||
|
cprint 2 "Done!"
|
||||||
|
}
|
||||||
|
|
||||||
|
function menu_option_two() {
|
||||||
|
cprint 2 "Installing makeself..."
|
||||||
|
sleep 1
|
||||||
|
wget https://github.com/megastep/makeself/releases/download/release-2.5.0/makeself-2.5.0.run
|
||||||
|
chmod +x makeself-2.5.0.run
|
||||||
|
./makeself-2.5.0.run
|
||||||
|
cd makeself-2.5.0
|
||||||
|
cp *.sh /usr/bin
|
||||||
cprint 2 "Done!"
|
cprint 2 "Done!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,13 +69,14 @@ function cleanup() {
|
||||||
cprint 2 "Cleaning up..."
|
cprint 2 "Cleaning up..."
|
||||||
sleep 1
|
sleep 1
|
||||||
rm -rf $tmpdir
|
rm -rf $tmpdir
|
||||||
|
rm -rf $arcdir
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check for root only important on pure Debian as there is no sudo by default
|
# Check for root only important on pure Debian as there is no sudo by default
|
||||||
if [ "$(id -u)" != "0" ]; then
|
if [ "$(id -u)" != "0" ]; then
|
||||||
# check is the system is debian
|
# check is the system is debian
|
||||||
if [ -f /etc/debian_version ]; then
|
if [ -f /etc/debian_version ]; then
|
||||||
cprint 3 "Notice: This script may need to be run as root on Debian, especially if its a stock install" ; press_enter ;
|
cprint 3 "Notice: This script may need to be run as root on Debian, especially if its a stock install. Also requires makeself to created a distributable self restorable package" ; press_enter ;
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -65,8 +84,8 @@ until [ "$selection" = "0" ]; do
|
||||||
clear
|
clear
|
||||||
echo ""
|
echo ""
|
||||||
cprint 3 " Main Menu"
|
cprint 3 " Main Menu"
|
||||||
mprint 1 "Copy the system config"
|
mprint 1 "Create a self restorable package"
|
||||||
mprint 2 "Restore the system config"
|
mprint 2 "Install makeself(required) to create self restorable package"
|
||||||
mprint 0 "Exit"
|
mprint 0 "Exit"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n " Enter selection: "
|
echo -n " Enter selection: "
|
||||||
|
|
3505
package-selections
3505
package-selections
File diff suppressed because it is too large
Load diff
3504
packages.txt
3504
packages.txt
File diff suppressed because it is too large
Load diff
24
restore.bash
Normal file
24
restore.bash
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function cprint () {
|
||||||
|
color="$1"
|
||||||
|
shift
|
||||||
|
echo "$(tput setaf $color)$*$(tput sgr0)"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function mprint (){
|
||||||
|
echo " $1 - $2"
|
||||||
|
}
|
||||||
|
|
||||||
|
function incorrect_selection() {
|
||||||
|
cprint 1 "Incorrect selection! Try again."
|
||||||
|
}
|
||||||
|
|
||||||
|
function press_enter() {
|
||||||
|
echo ""
|
||||||
|
cprint 3 "Press Enter to continue "
|
||||||
|
read
|
||||||
|
clear
|
||||||
|
}
|
||||||
|
|
9
test.bash
Normal file
9
test.bash
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/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"
|
Loading…
Add table
Add a link
Reference in a new issue