From 65a931da5f6416319ba4621102d4b78cce53e11c Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Tue, 9 Apr 2024 13:28:04 +0400 Subject: [PATCH] dchr-bs v0.0.1pre-alpha-but-usable --- bootstrap.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 bootstrap.sh diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100644 index 0000000..d617122 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +# will be rewritten some day + +help () { + echo "dchr-bs " + echo "-- supported distros:" + echo " archlinux" + #echo " voidlinux" + echo "https://dchr.dc09.ru" +} + +bs_archlinux () { + url="https://mirrors.edge.kernel.org/archlinux/iso/latest/archlinux-bootstrap-$1.tar.gz" + + echo '-- Downloading' + if which wget 2>/dev/null + then + wget -O ./rootfs.tar.gz "$url" || exit 2 + elif which curl 2>/dev/null + then + curl -o ./rootfs.tar.gz "$url" || exit 2 + else + echo -e "-- \e[1;31mError\e[0m -- install either curl or wget" + exit 1 + fi + + echo '-- Extracting' + tar xzf ./rootfs.tar.gz "root.x86_64/*" -C "$2" || exit 3 + echo '-- Removing rootfs archive' + rm ./rootfs.tar.gz + + echo '-- Setting up' + sed -i '/evowise/s/^#//' "$2/etc/pacman.d/mirrorlist" + sed -i '/CheckSpace/s/^/#/' "$2/etc/pacman.conf" + cp /etc/hosts "$2/etc/hosts" + cp /etc/resolv.conf "$2/etc/resolv.conf" + + echo '-- \e[1;32mOK\e[0m -- archlinux bootstrapped' + echo '-- Use dchr-run to enter the chroot and execute the following commands:' + # some day i will rewrite this script and it will do it automatically + echo '# pacman-key --init' + echo '# pacman-key --populate archlinux' + echo '# pacman -Syu' +}