Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
5f09c1ee20 | |||
e56480cce1 |
1 changed files with 9 additions and 7 deletions
16
menhera.sh
16
menhera.sh
|
@ -5,7 +5,8 @@ set +h
|
||||||
|
|
||||||
# config
|
# config
|
||||||
WORKDIR="/tmp/menhera"
|
WORKDIR="/tmp/menhera"
|
||||||
ROOTFS=""
|
MIRROR="https://iso-ultralite.meson.cc/archlinux"
|
||||||
|
ROOTFS="${MIRROR}/iso/latest/arch/x86_64/airootfs.sfs"
|
||||||
|
|
||||||
declare -A ARCH_MAP=(
|
declare -A ARCH_MAP=(
|
||||||
["x86_64"]="amd64"
|
["x86_64"]="amd64"
|
||||||
|
@ -32,15 +33,15 @@ EOF
|
||||||
menhera::__compat_restart_ssh() {
|
menhera::__compat_restart_ssh() {
|
||||||
if [ -x "$(command -v systemctl)" ]; then
|
if [ -x "$(command -v systemctl)" ]; then
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
if ! systemctl restart ssh; then
|
if ! systemctl restart sshd; then
|
||||||
echo "SSH daemon start failed, try resetting config..."
|
echo "SSH daemon start failed, try resetting config..."
|
||||||
menhera::reset_sshd_config
|
menhera::reset_sshd_config
|
||||||
if ! systemctl restart ssh; then
|
if ! systemctl restart sshd; then
|
||||||
echo "SSH daemon fail to start, dropping you to a shell..."
|
echo "SSH daemon fail to start, dropping you to a shell..."
|
||||||
sh
|
sh
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif [ -x "$(command -v service)" ]; then
|
elif false && [ -x "$(command -v service)" ]; then # there is no such thing in archlinux
|
||||||
if ! service ssh restart; then
|
if ! service ssh restart; then
|
||||||
echo "SSH daemon start failed, try resetting config..."
|
echo "SSH daemon start failed, try resetting config..."
|
||||||
menhera::reset_sshd_config
|
menhera::reset_sshd_config
|
||||||
|
@ -83,15 +84,15 @@ menhera::confirm() {
|
||||||
|
|
||||||
# jobs
|
# jobs
|
||||||
menhera::get_rootfs() {
|
menhera::get_rootfs() {
|
||||||
if [ -n ${ROOTFS} ]; then
|
if [ -z "${ROOTFS}" ]; then
|
||||||
echo "Getting rootfs URL..."
|
echo "Getting rootfs URL..."
|
||||||
|
|
||||||
# forgive me for parsing HTML with these shit
|
# forgive me for parsing HTML with these shit
|
||||||
# and hope it works
|
# and hope it works
|
||||||
ROOTFS_TIME=$(wget -qO- --show-progress "https://images.linuxcontainers.org/images/debian/buster/${ARCH_ID}/default/?C=M;O=D" | grep -oP '(\d{8}_\d{2}:\d{2})' | head -n 1)
|
ROOTFS_TIME=$(wget -qO- --show-progress "https://images.linuxcontainers.org/images/debian/buster/${ARCH_ID}/default/?C=M;O=D" | grep -oP '(\d{8}_\d{2}:\d{2})' | head -n 1)
|
||||||
|
|
||||||
ROOTFS="https://images.linuxcontainers.org/images/debian/buster/${ARCH_ID}/default/${ROOTFS_TIME}/rootfs.squashfs"
|
ROOTFS="https://images.linuxcontainers.org/images/debian/buster/${ARCH_ID}/default/${ROOTFS_TIME}/rootfs.squashfs"
|
||||||
else
|
else
|
||||||
echo "\$ROOTFS is set to '$ROOTFS'"
|
echo "\$ROOTFS is set to '$ROOTFS'"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -136,6 +137,7 @@ menhera::mount_new_rootfs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
menhera::install_software() {
|
menhera::install_software() {
|
||||||
|
return
|
||||||
echo "Installing OpenSSH Server into new rootfs..."
|
echo "Installing OpenSSH Server into new rootfs..."
|
||||||
|
|
||||||
# disable APT cache
|
# disable APT cache
|
||||||
|
|
Loading…
Reference in a new issue