Compare commits

...

12 Commits

Author SHA1 Message Date
Jarvis Carroll c2fcde0f26 arch scripts
It took a moment to work out that there is actually no way of
bootstrapping an arch environment without permanently installing things
to the host system! So we just download a live image and unpack it.

Then after that, getting erlang to work was very easy, just install it,
install zx, run. No R26 incompatibility problems, life is good!
2025-06-04 17:07:45 +10:00
Jarvis Carroll a60bcf941b add xbps/kerl install scripts for Void 2025-06-03 09:09:33 +10:00
Jarvis Carroll c200c89b75 Add scripts for Void scripts 2025-06-02 23:36:08 +10:00
Jarvis Carroll b344241b33 open miner with kerl 2025-05-30 13:07:25 +10:00
Jarvis Carroll fb153a0e64 script for headless miner
This one we don't install any gtk/wx craziness, and the whole thing
becomes much faster as a result.
2025-05-30 11:42:02 +10:00
Jarvis Carroll 91d85c8ecc kerl erlang/zx/gajudesk script
This needed a 64-bit debian system to build, so I guess I'll just test
64 bit systems from now on.
2025-05-30 10:23:16 +10:00
Jarvis Carroll 4852dc3244 add --no-install-recommends
--no-install-recommends is a big help, whether we're installing all of
`erlang` or just `erlang-wx`, but `erlang-wx` is still so close in size
that we still just use `erlang`.
2025-05-29 17:00:54 +10:00
Jarvis Carroll e37622f41f Rename gajudesk script 2025-05-27 16:59:18 +10:00
Jarvis Carroll 001d337c84 Launch gajumine too
Not functionally different, zx just needs the .zrf files to find
gajumine.
2025-05-27 16:57:50 +10:00
Jarvis Carroll 9b2970d540 Open gajudesk from erlang script 2025-05-26 16:41:08 +10:00
Jarvis Carroll 3898aa52be remove mounts automatically
Also combined all these little mount and cleanup helpers into one
`cleanup` script with flags.
2025-05-24 00:05:26 +10:00
Jarvis Carroll 28de550295 User setup and erlang installation
A bit fiddly, but this lets us run a realistic erlang install script
from userspace, and then re-enter userspace later without wiping the
installation.
2025-05-23 21:21:16 +10:00
31 changed files with 828 additions and 74 deletions
+9
View File
@@ -2,3 +2,12 @@ debian/clean_environment
debian/test_environment debian/test_environment
debian/debootstrap debian/debootstrap
debian/debootstrap.tar.gz debian/debootstrap.tar.gz
void/clean_environment
void/test_environment
void/xbps-static*.tar.xz
arch/archlinux-bootstrap*.tar.zst
arch/clean_environment
arch/test_environment
arch/pkglist.x86_64.txt
+131
View File
@@ -0,0 +1,131 @@
Motivation
==========
We want users to be able to use a variety of erlang programs, which means they
need to know how to install an erlang runtime that can run our programs. On any
given day this will have a well defined answer, but as erlang changes, and as
our dependencies change, the exact installation process might change too. In
order to reliably recreate the experience of a new user, on a variety of
possible distributions, we create a collection of chroot environments, one for
each distribution we want to document, and then use those chroot environments
to develop and maintain install scripts.
These install scripts will check *every* dependency needed, even on a totally
fresh installation of the corresponding linux distribution, because that is
exactly what the chroot environments will be. This means that the install
scripts will work on any install, whether it has been used for a long time, or
whether it is also a fresh install, if you're mining on a VPS, or custom
hardware, or whatever else.
Usage
=====
At the moment there is only one distribution, Debian, which you can test in the
`chroot_sandboxes/debian` subdirectory. From there you can run a variety of
posix shell scripts to create, enter, and delete chroot environments.
Create Environment
------------------
cd into `debian` and run `sudo ./create_environment` to automatically download
`debootstrap` from [debian.org](https://www.debian.org), and create a debian
system with it. If you already have `debootstrap` installed, then that version
will be used instead. `debootstrap` can be installed with `apt`, if you are
already on an `apt`y system. Running `make install` in `debian/debootstrap` is
not recommended, since your distribution's package manager won't be able to
uninstall it for you.
A minimal debian system will be created under `debian/clean_environment`, and
then copied over to `debian/test_environment`. This way if you run
`sudo ./create_environment` again, instead of downloading the whole
distribution again, it can simply overwrite `test_environment` with a new
copy, allowing rapid iteration of install scripts, run on totally fresh
systems every time.
The script also sets up the mount points and /tmp directory in
`debian/test_environment`, each time that it is copied from
`debian/clean_environment`. This means `debian/clean_environment` is always an
ordinary file hierarchy with no mount points, that can be recursively deleted,
whereas `debian/test_environment` needs to be handled more carefully, see
[Destroy Environment](#destroy-environment) for instructions.
Finally, the script will copy all install scripts in `debian/install_scripts`
into the chroot environment, and perform the chroot itself. The chroot is
instructed to run `install_scripts/user_setup` with this new root directory,
and this script will install sudo, create a user with passwordless `sudo`
rights, and `su` into that user. You can then freely test whatever scripts you
want as that user, and leave the environment.
If you don't want to do anything interactive as that user, but instead want to
run a single script and then exit, pass that script and its arguments to
`sudo ./create_environment` and they will be passed down into the chroot
environment, and run instead of the default `/bin/bash` that is normally run
by `su`. Remember that the command will be run inside the chroot environment,
with `/home/user` as the working directory, so the script will need to be
accessed relative to that. e.g.
`sudo ./create_environment ./install_scripts/your_script`
or
`sudo ./create_environment ~/install_scripts/your_script`.
Opening Windows
---------------
To access an X11 server, clients need two things, access to /tmp/.X11-unix, and
authorisation in X11's "access control" model. The former is automatically
bound by the `create_environment` script, but to get the latter you will need
to change the access control yourself. On a single-user device the simplest
way to do this is to disable X11 access control altogether, using `xhost +`,
but if for some reason you are testing these install scripts on a multi-user
system, you'll want to find some way to protect your X11 server from other
users, while still allowing your chroot host to access it.
Once you have disabled access control, any X11 applications you like can be
installed with `apt` or `zx`, and run, and the windows will open in your
window manager, despite still being attached to the chroot. This means
different programs can be installed, configured, and run, without access to
any of the parent system's configs, allowing us not only to test that we have
all the dependencies needed to run the X11 application, but also to test any
configurations of the application that we might want to do automatically, from
that script. (e.g. adding realms to zx, creating default wallets, whatever.)
Destroy Environment
-------------------
The `create_environment` and `enter_environment` scripts try to clean up the
mounts that they create, and the mounts will all disappear on reboot, but just
in case they are still present, you can run `sudo ./cleanup` to delete the
`test_environment` safely. If you want to delete both environments and
`debootstrap` in one go, then `sudo ./cleanup everything` will safely unmount
`test_environment` and then delete all three directories.
`cleanup` has other options too. For example, if you want to chroot into the
environment as root, you can manually add the mount points back using
`sudo ./cleanup add_mounts`, and then chroot in yourself. There is also
`sudo ./cleanup mounts` to remove the mounts manually without deleting
`test_environment`.
Reuse an Existing Environment
-----------------------------
If you want to enter an environment again, run `sudo ./enter_environment`, and
it will chroot into the environment without deleting and recreating it,
without installing `sudo` again, and without creating a new user.
To run a script, just like with `create_environment`, you can pass arguments,
as long as the paths involved are relative to the new root and home directory.
e.g. `sudo ./enter_environment ~/install_scripts/your_script`.
If you reboot your machine, the mount points of the chroot environment will be
missing, (unless you put them in your system-wide fstab, you sicko,) but
`sudo ./enter_environment` will detect this and add the mount points back
automatically.
If you are iterating an install script, then it's usually more useful to just
run the whole thing again using `create_environment`, but if you want to
compose multiple operations together in a script outside of the chroot, or if
you want to enter an interactive environment again after running some more
expensive script, then this might be useful. For example, you could test
`create_environment` itself on other distributions, by running it inside of a
chroot.
Executable
+102
View File
@@ -0,0 +1,102 @@
#!/bin/sh
if test `id -u` -ne 0
then
echo "$0 must be run as root."
return
fi
set -e
FRESH=clean_environment
ROOT=test_environment
add_mount() {
if mountpoint -q "$ROOT$1"
then
echo "$ROOT$1 already mounted."
else
echo "Mounting $2$1 to $ROOT$1"
mkdir -p "$ROOT$1"
mount -o bind "$2$1" "$ROOT$1"
fi
}
remove_mount() {
if mountpoint -q "$ROOT$1"
then
echo "Unmounting $ROOT$1"
umount -l "$ROOT$1"
fi
}
add_mounts() {
add_mount / "$ROOT"
add_mount /proc
add_mount /sys
add_mount /dev
add_mount /dev/pts
add_mount /tmp/.X11-unix
}
remove_mounts() {
remove_mount /tmp/.X11-unix
remove_mount /dev/pts
remove_mount /dev
remove_mount /sys
remove_mount /proc
remove_mount /
}
remove_environment() {
if test -d "$ROOT"
then
# Call this script that automatically unmounts the mount points too.
remove_mounts
echo "Removing $ROOT"
rm -r "$ROOT"
else
echo "No environment found at $ROOT. Doing nothing."
fi
}
remove_everything() {
if test -d "$ROOT"
then
# Call this script that automatically unmounts the mount points too.
remove_environment
fi
if test -d "$FRESH"
then
echo "Removing $FRESH"
rm -r "$FRESH"
fi
if test -d debootstrap
then
echo "Removing debootstrap"
rm -r debootstrap
fi
if test -f pkglist.x86_64.txt
then
echo "Removing pkglist.x86_64.txt"
rm pkglist.x86_64.txt
fi
if test -f archlinux-bootstrap*.tar.zst
then
echo "Removing archlinux bootstrap tarballs."
rm archlinux-bootstrap*.tar.zst
fi
}
case "$1" in
everything) remove_everything ;;
mounts) remove_mounts ;;
add_mounts) add_mounts ;;
environment) remove_environment ;;
"") remove_environment ;;
esac
+50
View File
@@ -0,0 +1,50 @@
#!/bin/sh
if test `id -u` -ne 0
then
echo "$0 must be run as root."
return
fi
set -e
ROOT=test_environment
FRESH=clean_environment
TARBALL=archlinux-bootstrap-x86_64.tar.zst
REPO="https://geo.mirror.pkgbuild.com"
if test -e "$FRESH"
then
echo "Clean arch environment found at $FRESH. Good."
else
echo "No arch environment found at $FRESH, downloading from $REPO"
curl -O "$REPO/iso/latest/$TARBALL"
tar -xf "$TARBALL"
mv root.x86_64 "$FRESH"
fi
if test -e "$ROOT"
then
echo "Existing installation found at $ROOT, removing."
./cleanup
fi
echo "Copying $FRESH to $ROOT."
cp -r "$FRESH" "$ROOT"
echo "Initializing $ROOT."
./cleanup add_mounts
chmod 1777 "$ROOT/tmp"
echo 'Server = http://ftp.swin.edu.au/archlinux/$repo/os/$arch' > "$ROOT/etc/pacman.d/mirrorlist"
cp /etc/resolv.conf "$ROOT/etc/resolv.conf"
cp -r install_scripts "$ROOT/root"
chroot "$ROOT" /root/install_scripts/user_setup "$@" || echo Script failed.
./cleanup mounts
+22
View File
@@ -0,0 +1,22 @@
#!/bin/sh
if test `id -u` -ne 0
then
echo "$0 must be run as root."
return
fi
ROOT=test_environment
if test -e "$ROOT"
then
echo "Using existing environment in $ROOT."
else
./create_environment
fi
./cleanup add_mounts
chroot "$ROOT" sudo -iu user "$@"
./cleanup mounts
+29
View File
@@ -0,0 +1,29 @@
#!/bin/sh
# Finds pacstrap in $PATH, or download some version of it if not found.
# This script prefers to use local copies that are already downloaded, over
# system-wide installations, in case you want to test on some specific
# outdated version of pacstrap.
LOCALDIR=`pwd`/arch-install-scripts
if test -e "$LOCALDIR/pacstrap"
then
echo "Found $LOCALDIR/pacstrap in current directory"
# Run pacstrap without installing it to the system.
bash "$LOCALDIR/pacstrap" "$@"
elif IT=`command -v pacstrap`
then
echo "Found $IT in PATH"
# Use the version of pacstrap that was already installed.
pacstrap "$@"
else
echo "pacstrap not found. Downloading to $LOCALDIR."
git clone https://gitlab.archlinux.org/archlinux/arch-install-scripts
make -C arch-install-scripts pacstrap
# Run pacstrap without installing it to the system.
bash "$LOCALDIR/pacstrap" "$@"
fi
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
sudo pacman -S wget erlang erlang-wx --noconfirm
wget -q https://zxq9.com/projects/zomp/get_zx && bash get_zx
export PATH=$PATH:$HOME/bin
zx import realm install_scripts/qpq.zrf
zx import realm install_scripts/uwiger.zrf
zx run qpq-gajumine
Binary file not shown.
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
pacman-key --init
pacman-key --populate archlinux
pacman -Sy sudo --noconfirm
# Overwrite locale setting specified before the chroot
export LANG=C
export LC_ALL=C
# Add a passwordless sudoer
useradd -m -s /bin/bash -G wheel user
passwd -d user
echo "user ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/user"
chmod 0440 "/etc/sudoers.d/user"
# Copy the install scripts into their home directory
cp -r ~/install_scripts /home/user
chown -R user:user /home/user/install_scripts
# su to this new user... Or sudo -iu, since we want to pass in arguments too.
cd /home/user
sudo -iu user "$@"
Binary file not shown.
Vendored Executable
+92
View File
@@ -0,0 +1,92 @@
#!/bin/sh
if test `id -u` -ne 0
then
echo "$0 must be run as root."
return
fi
FRESH=clean_environment
ROOT=test_environment
add_mount() {
if mountpoint "$ROOT$1" > /dev/null
then
echo "$ROOT$1 already mounted."
else
echo "Mounting $1 to $ROOT$1"
mkdir -p "$ROOT$1"
mount -o bind "$1" "$ROOT$1"
fi
}
remove_mount() {
if mountpoint "$ROOT$1" > /dev/null
then
echo "Unmounting $ROOT$1"
umount "$ROOT$1"
fi
}
add_mounts() {
add_mount /proc
add_mount /sys
add_mount /dev
add_mount /dev/pts
add_mount /tmp/.X11-unix
}
remove_mounts() {
remove_mount /tmp/.X11-unix
remove_mount /dev/pts
remove_mount /dev
remove_mount /sys
remove_mount /proc
}
remove_environment() {
if test -d "$ROOT"
then
# Call this script that automatically unmounts the mount points too.
remove_mounts
echo "Removing $ROOT"
rm -r "$ROOT"
else
echo "No environment found at $ROOT. Doing nothing."
fi
}
remove_everything() {
if test -d "$ROOT"
then
# Call this script that automatically unmounts the mount points too.
remove_environment
fi
if test -d "$FRESH"
then
echo "Removing $FRESH"
rm -r "$FRESH"
fi
if test -d debootstrap
then
echo "Removing debootstrap"
rm -r debootstrap
fi
if test -f debootstrap.tar.gz
then
echo "Removing debootstrap.tar.gz"
rm debootstrap.tar.gz
fi
}
case "$1" in
everything) remove_everything ;;
mounts) remove_mounts ;;
add_mounts) add_mounts ;;
environment) remove_environment ;;
"") remove_environment ;;
esac
-32
View File
@@ -1,32 +0,0 @@
#!/bin/sh
if test `id -u` -ne 0
then
echo "$0 must be run as root."
return
fi
if test -d test_environment
then
# Call this script that automatically unmounts the mount points too.
./destroy_environment
fi
if test -d clean_environment
then
echo "Removing clean_environment"
rm -r clean_environment
fi
if test -d debootstrap
then
echo "Removing debootstrap"
rm -r debootstrap
fi
if test -f debootstrap.tar.gz
then
echo "Removing debootstrap.tar.gz"
rm debootstrap.tar.gz
fi
+14 -14
View File
@@ -14,29 +14,29 @@ then
else else
echo "No debian environment found at $FRESH, downloading with debootstrap." echo "No debian environment found at $FRESH, downloading with debootstrap."
mkdir -p $FRESH mkdir -p $FRESH
./get_debootstrap --arch i386 sid "$FRESH" http://deb.debian.org/debian/ ./get_debootstrap --arch amd64 sid "$FRESH" http://deb.debian.org/debian/
fi fi
cleanup_mount() {
if mountpoint "$1" > /dev/null
then
echo "Unmounting $1"
umount "$1"
fi
}
if test -e "$ROOT" if test -e "$ROOT"
then then
echo "Existing installation found at $ROOT, removing." echo "Existing installation found at $ROOT, removing."
./destroy_environment ./cleanup
fi fi
echo "Copying $FRESH to $ROOT." echo "Copying $FRESH to $ROOT."
cp -r "$FRESH" "$ROOT" cp -r "$FRESH" "$ROOT"
echo "Initializing $ROOT." echo "Initializing $ROOT."
mkdir -p "$ROOT/proc"
mount proc $ROOT/proc -t proc
mkdir -p "$ROOT/sys"
mount sysfs $ROOT/sys -t sysfs
./cleanup add_mounts
# Don't bother creating a new tmpfs. We don't want to leak files in, and we
# don't want to waste more RAM on a second tmpfs. The whole thing is
# temporary, after all.
chmod 1777 "$ROOT/tmp"
cp -r install_scripts "$ROOT/root"
chroot "$ROOT" /root/install_scripts/user_setup "$@"
./cleanup mounts
-28
View File
@@ -1,28 +0,0 @@
#!/bin/sh
if test `id -u` -ne 0
then
echo "$0 must be run as root."
return
fi
ROOT=test_environment
cleanup_mount() {
if mountpoint "$1" > /dev/null
then
echo "Unmounting $1"
umount "$1"
fi
}
if test -e "$ROOT"
then
cleanup_mount "$ROOT/proc"
cleanup_mount "$ROOT/sys"
echo "Removing $ROOT"
rm -r "$ROOT"
else
echo "No environment found at $ROOT. Doing nothing."
fi
Vendored Executable
+22
View File
@@ -0,0 +1,22 @@
#!/bin/sh
if test `id -u` -ne 0
then
echo "$0 must be run as root."
return
fi
ROOT=test_environment
if test -e "$ROOT"
then
echo "Using existing environment in $ROOT."
else
./create_environment
fi
./cleanup add_mounts
chroot "$ROOT" sudo -iu user "$@"
./cleanup mounts
+17
View File
@@ -0,0 +1,17 @@
#!/bin/sh
if [ $# -eq 0 ]; then
>&2 echo "A public key must be provided."
return
fi
# Since we don't need the 238 packages required to run wx applications, we
# might as well see if a headless miner can run on just a subset of erlang.
sudo apt -y install wget erlang-tools erlang-dev erlang-eunit erlang-inets
wget -q https://zxq9.com/projects/zomp/get_zx && bash get_zx
export PATH=$PATH:$HOME/bin
zx import realm install_scripts/qpq.zrf
zx import realm install_scripts/uwiger.zrf
zx run uwiger-gmhive_client -gmhc pubkey "$1"
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
sudo apt -y install wget erlang --no-install-recommends
wget -q https://zxq9.com/projects/zomp/get_zx && bash get_zx
export PATH=$PATH:$HOME/bin
zx import realm install_scripts/qpq.zrf
zx import realm install_scripts/uwiger.zrf
zx run qpq-gajumine
+22
View File
@@ -0,0 +1,22 @@
#!/bin/sh
sudo apt update
sudo apt upgrade
sudo apt -y install \
gcc curl g++ dpkg-dev build-essential automake autoconf \
libncurses-dev libssl-dev flex xsltproc libwxgtk3.2-dev \
wget vim git
curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
chmod a+x kerl
./kerl build 27.3.4 27.3.4
./kerl install 27.3.4 ~/.erts/27.3.4
echo '. "$HOME"/.erts/27.3.4/activate' >> .bashrc
. ~/.erts/27.3.4/activate
wget -q https://zxq9.com/projects/zomp/get_zx && bash get_zx
export PATH=$PATH:$HOME/bin
zx import realm ~/install_scripts/qpq.zrf
zx import realm ~/install_scripts/uwiger.zrf
zx run qpq-gajumine
+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
# We actually only need
# erlang-base erlang-tools erlang-dev erlang-eunit erlang-inets erlang-wx
# But erlang-wx gives 238 out of the 273 dependencies of a full erlang install.
sudo apt -y install wget erlang --no-install-recommends
wget -q https://zxq9.com/projects/zomp/get_zx && bash get_zx
export PATH=$PATH:$HOME/bin
zx run gajudesk
+20
View File
@@ -0,0 +1,20 @@
#!/bin/sh
sudo apt update
sudo apt upgrade
sudo apt -y install \
gcc curl g++ dpkg-dev build-essential automake autoconf \
libncurses-dev libssl-dev flex xsltproc libwxgtk3.2-dev \
wget vim git
curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
chmod a+x kerl
./kerl build 27.3.4 27.3.4
./kerl install 27.3.4 ~/.erts/27.3.4
echo '. "$HOME"/.erts/27.3.4/activate' >> .bashrc
. ~/.erts/27.3.4/activate
wget -q https://zxq9.com/projects/zomp/get_zx && bash get_zx
export PATH=$PATH:$HOME/bin
zx run gajudesk
BIN
View File
Binary file not shown.
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
# Noninteractive, so that other scripts can install things with apt.
export DEBIAN_FRONTEND=noninteractive
# Overwrite locale setting specified before the chroot
export LANG=C
export LC_ALL=C
# Install sudo, since most user-facing scripts will use sudo
apt install sudo
# Add a passwordless sudoer
useradd -m -s /bin/bash -G sudo user
passwd -d user
echo "user ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/user"
chmod 0440 "/etc/sudoers.d/user"
# Copy the install scripts into their home directory
cp -r ~/install_scripts /home/user
chown -R user:user /home/user/install_scripts
# su to this new user... Or sudo -iu, since we want to pass in arguments too.
cd /home/user
sudo -iu user "$@"
Binary file not shown.
Executable
+86
View File
@@ -0,0 +1,86 @@
#!/bin/sh
if test `id -u` -ne 0
then
echo "$0 must be run as root."
return
fi
FRESH=clean_environment
ROOT=test_environment
add_mount() {
if mountpoint "$ROOT$1" -q
then
echo "$ROOT$1 already mounted."
else
echo "Mounting $1 to $ROOT$1"
mkdir -p "$ROOT$1"
mount -o bind "$1" "$ROOT$1"
fi
}
remove_mount() {
if mountpoint "$ROOT$1" -q
then
echo "Unmounting $ROOT$1"
umount "$ROOT$1"
fi
}
add_mounts() {
add_mount /proc
add_mount /sys
add_mount /dev
add_mount /dev/pts
add_mount /tmp/.X11-unix
}
remove_mounts() {
remove_mount /tmp/.X11-unix
remove_mount /dev/pts
remove_mount /dev
remove_mount /sys
remove_mount /proc
}
remove_environment() {
if test -d "$ROOT"
then
# Call this script that automatically unmounts the mount points too.
remove_mounts
echo "Removing $ROOT"
rm -r "$ROOT"
else
echo "No environment found at $ROOT. Doing nothing."
fi
}
remove_everything() {
if test -d "$ROOT"
then
# Call this script that automatically unmounts the mount points too.
remove_environment
fi
if test -d "$FRESH"
then
echo "Removing $FRESH"
rm -r "$FRESH"
fi
if test -f xbps-static*.tar.xz
then
echo "Removing xbps-static tarballs."
rm xbps-static*.tar.xz
fi
}
case "$1" in
everything) remove_everything ;;
mounts) remove_mounts ;;
add_mounts) add_mounts ;;
environment) remove_environment ;;
"") remove_environment ;;
esac
+63
View File
@@ -0,0 +1,63 @@
#!/bin/sh
if test `id -u` -ne 0
then
echo "$0 must be run as root."
return
fi
ROOT=test_environment
FRESH=clean_environment
TARBALL=xbps-static-static-0.59_5.x86_64-musl.tar.xz
# See https://xmirror.voidlinux.org/ for other mirrors.
REPO=https://ftp.swin.edu.au/voidlinux
if test -e "$FRESH"
then
echo "Void installation found at $FRESH. Good."
else
if test -e "$TARBALL"
then
echo "Tarball found."
else
URL="$REPO/static/$TARBALL"
echo "Fetching tarball from $URL"
curl "$URL" -O
fi
mkdir "$FRESH"
tar xf "$TARBALL" -C "$FRESH"
mkdir -p "$FRESH/etc/xbps.d"
echo "repository=$REPO/current" > "$FRESH/etc/xbps.d/00-repository-main.conf"
XBPS_ARCH=x86_64 "$FRESH/usr/bin/xbps-install.static" -r "$FRESH" -S base-system
fi
if test -e "$ROOT"
then
echo "Existing installation found at $ROOT, removing."
./cleanup
fi
echo "Copying $FRESH to $ROOT."
cp -r "$FRESH" "$ROOT"
echo "Initializing $ROOT."
chmod 1777 "$ROOT"
chmod 1777 "$ROOT/bin"
chmod 1777 "$ROOT/tmp"
chmod 4755 "$ROOT/usr/bin/sudo"
# Add DNS configs
cp /etc/resolv.conf "$ROOT/etc/resolv.conf"
cp -r install_scripts "$ROOT/root"
./cleanup add_mounts
chroot "$ROOT" /root/install_scripts/user_setup "$@"
./cleanup mounts
+22
View File
@@ -0,0 +1,22 @@
#!/bin/sh
if test `id -u` -ne 0
then
echo "$0 must be run as root."
return
fi
ROOT=test_environment
if test -e "$ROOT"
then
echo "Using existing environment in $ROOT."
else
./create_environment
fi
./cleanup add_mounts
chroot "$ROOT" sudo -iu user "$@"
./cleanup mounts
+21
View File
@@ -0,0 +1,21 @@
#!/bin/sh
sudo xbps-install -y curl wget git gcc autoconf make libxslt noto-fonts-ttf \
wxWidgets-gtk3-devel openssl-devel ncurses-devel glu-devel
mkdir ~/bin
ln -s /usr/bin/wx-config-gtk3 ~/bin/wx-config
export PATH=$PATH:$HOME/bin
curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
chmod a+x kerl
./kerl build 27.3.4 27.3.4
./kerl install 27.3.4 ~/.erts/27.3.4
echo '. "$HOME"/.erts/27.3.4/activate' >> .bashrc
. ~/.erts/27.3.4/activate
wget -q https://zxq9.com/projects/zomp/get_zx && bash get_zx
zx import realm ~/install_scripts/qpq.zrf
zx import realm ~/install_scripts/uwiger.zrf
zx run qpq-gajumine
+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh
sudo xbps-install wget erlang-wx noto-fonts-ttf
wget -q https://zxq9.com/projects/zomp/get_zx && bash get_zx
export PATH=$PATH:$HOME/bin
zx run gajudesk
Binary file not shown.
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# Overwrite locale setting specified before the chroot
#export LANG=C
#export LC_ALL=C
# Add a passwordless sudoer
useradd -m -s /bin/bash -G wheel user
passwd -d user
echo "user ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/user"
chmod 0440 "/etc/sudoers.d/user"
# Copy the install scripts into their home directory
cp -r /root/install_scripts /home/user
#chown -R user:user /home/user/install_scripts
# su to this new user... Or sudo -iu, since we want to pass in arguments too.
cd /home/user
sudo -iu user "$@"
Binary file not shown.