#!/usr/bin/env sh
# chroot.sh
# This file is a first-stage payload to shrx.
#
# Copyright (C) 2019 Stack41, LLC.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
apk update
apk upgrade
apk add bash
# Trash leftover
rm /etc/resolv.conf
# Clear APK repos. Child projects should set these themselves.
echo "" > /etc/apk/repositories
# Start payload script at first boot
ct="/etc/crontabs/root"
echo "@reboot mkdir -p /mnt/vdb1 && mount /dev/vdb1 /mnt/vdb1 && /usr/bin/env bash -e -x /mnt/vdb1/main.sh 2>/dev/ttyS0 >/dev/ttyS0 && sed -i '/uakGGwa2BLoG3s5SzUY/d' $ct && poweroff" >> $ct
# Remove local logins
cat > /etc/inittab <