From 01d9952717119687f69739e68c6013bb425694d4 Mon Sep 17 00:00:00 2001 From: Solene Rapenne Date: Sun, 4 Sep 2022 02:29:38 +0200 Subject: [PATCH] populate_chroot: set of scripts to make bento --- config.sh.sample | 2 + populate_chroot.sh | 109 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 config.sh.sample create mode 100755 populate_chroot.sh diff --git a/config.sh.sample b/config.sh.sample new file mode 100644 index 0000000..b1a2a3a --- /dev/null +++ b/config.sh.sample @@ -0,0 +1,2 @@ +CHROOT_DIR=/home/chroot +REMOTE_IP=myserver.example diff --git a/populate_chroot.sh b/populate_chroot.sh new file mode 100755 index 0000000..9ed7e19 --- /dev/null +++ b/populate_chroot.sh @@ -0,0 +1,109 @@ +#!/bin/sh + +if test -f config.sh +then + . ./config.sh +else + echo "You are missing config.sh" + exit 2 +fi + +if [ "$(id -u)" -ne 0 ] +then + echo "you need to be root to run this script" + exit 1 +fi + +cd hosts +# load all hosts or the one defined in environment variable NAME +if [ -z "$NAME" ] +then + NAME=* +fi + +for i in $NAME +do + echo "Copying $i" + + # we only want directories + if [ -d "$i" ] + then + + # create the script that will check for updates + cat > "$i/update.sh" < /var/bento/.state +fi +EOF + + # script used to download changes and rebuild + # also used to run it manually the first time to configure the system + cat > "$i/bootstrap.sh" < "$i/.gitignore" <