mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-20 03:50:37 +02:00
Compare commits
13 commits
c462ef306e
...
82289107c0
Author | SHA1 | Date | |
---|---|---|---|
|
82289107c0 | ||
|
3561fd001d | ||
|
2fec745d69 | ||
|
06126a3475 | ||
|
02d1b22ccd | ||
|
123bcace38 | ||
|
e6b301eb7a | ||
|
79390f0c49 | ||
|
9e2bea993e | ||
|
39995973b1 | ||
|
80f8a29a5c | ||
|
6af4a6c406 | ||
|
74f6413ebc |
11 changed files with 225 additions and 386 deletions
14
CHANGELOG
14
CHANGELOG
|
@ -12,12 +12,14 @@ Environment Changes:
|
|||
- added grub bli efi module
|
||||
- use BLAKE2b/b2sum instead of sha256sum
|
||||
- shortened MOTD and init message
|
||||
- ask basic environment settings on first login
|
||||
- added interactive launcher script
|
||||
- added network script for network configuration
|
||||
- renamed km to vconsole
|
||||
- renamed tz to clock
|
||||
- renamed archboot-locale script to localize
|
||||
- run Basic Setup scripts on first login
|
||||
- added Basic Setup interactive launcher script
|
||||
- added Basic Setup network script
|
||||
- added Basic Setup pacsetup script
|
||||
- renamed km to Basic Setup vconsole script
|
||||
- renamed tz to Basic Setup clock script
|
||||
- renamed archboot-locale script to Basic Setup localize script
|
||||
- load archboot.com and wiki.archlinux.org on firefox startup
|
||||
localize:
|
||||
- fixed abort dialog
|
||||
update:
|
||||
|
|
|
@ -1,30 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# written by Tobias Powalowski <tpowa@archlinux.org>
|
||||
LANG=C
|
||||
_ANSWER="/tmp/.clock"
|
||||
_RUNNING_ARCH="$(uname -m)"
|
||||
_TITLE="Archboot ${_RUNNING_ARCH} | Arch Linux Setup | Clock Configuration"
|
||||
# _dialog()
|
||||
# an el-cheapo dialog wrapper
|
||||
#
|
||||
# parameters: see dialog(1)
|
||||
# returns: whatever dialog did
|
||||
_dialog() {
|
||||
dialog --backtitle "${_TITLE}" --aspect 15 "$@"
|
||||
return $?
|
||||
}
|
||||
|
||||
_abort() {
|
||||
if _dialog --yesno "Abort Arch Linux Clock Configuration?" 5 45; then
|
||||
[[ -e /tmp/.clock-running ]] && rm /tmp/.clock-running
|
||||
[[ -e /tmp/.clock ]] && rm /tmp/.clock
|
||||
clear
|
||||
exit 1
|
||||
else
|
||||
_CONTINUE=""
|
||||
fi
|
||||
}
|
||||
. /usr/lib/archboot/basic-common.sh
|
||||
_TITLE="Archboot ${_RUNNING_ARCH} | Basic Setup | Clock Configuration"
|
||||
|
||||
_hwclock() {
|
||||
_DATE_PROGRAM=timedatectl
|
||||
|
@ -106,23 +84,11 @@ _timeset() {
|
|||
fi
|
||||
}
|
||||
|
||||
if [[ -e /tmp/.clock-running ]]; then
|
||||
echo "clock already runs on a different console!"
|
||||
echo "Please remove /tmp/.clock-running first to launch clock!"
|
||||
exit 1
|
||||
fi
|
||||
: >/tmp/.clock-running
|
||||
_check
|
||||
_SET_TIME=""
|
||||
if [[ -n "${1}" ]]; then
|
||||
_LABEL="Back"
|
||||
else
|
||||
_LABEL="Exit"
|
||||
fi
|
||||
while [[ -z "${_SET_TIME}" ]]; do
|
||||
_timezone
|
||||
_timeset
|
||||
done
|
||||
[[ -e /tmp/.clock-running ]] && rm /tmp/.clock-running
|
||||
clear
|
||||
exit 0
|
||||
_cleanup
|
||||
# vim: set ts=4 sw=4 et:
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# written by Tobias Powalowski <tpowa@archlinux.org>
|
||||
LANG=C
|
||||
_ANSWER="/tmp/.launcher"
|
||||
_RUNNING_ARCH="$(uname -m)"
|
||||
_TITLE="Archboot ${_RUNNING_ARCH} | Arch Linux Setup | Launcher"
|
||||
# _dialog()
|
||||
# an el-cheapo dialog wrapper
|
||||
#
|
||||
# parameters: see dialog(1)
|
||||
# returns: whatever dialog did
|
||||
_dialog() {
|
||||
dialog --backtitle "${_TITLE}" --aspect 15 "$@"
|
||||
return $?
|
||||
}
|
||||
. /usr/lib/archboot/basic-common.sh
|
||||
_TITLE="Archboot ${_RUNNING_ARCH} | Basic Setup | Launcher"
|
||||
|
||||
_show_login() {
|
||||
[[ -e /tmp/.launcher-running ]] && rm /tmp/.launcher-running
|
||||
|
@ -96,6 +85,7 @@ _exit() {
|
|||
"3" "Poweroff System" 2>${_ANSWER} || return 1
|
||||
_EXIT="$(cat ${_ANSWER})"
|
||||
if [[ "${_EXIT}" == "1" ]]; then
|
||||
[[ -e /tmp/.launcher-running ]] && rm /tmp/.launcher-running
|
||||
_show_login
|
||||
exit 0
|
||||
elif [[ "${_EXIT}" == "2" ]]; then
|
||||
|
@ -138,13 +128,7 @@ _launcher() {
|
|||
esac
|
||||
}
|
||||
|
||||
if [[ -e /tmp/.launcher-running ]]; then
|
||||
echo "launcher already runs on a different console!"
|
||||
echo "Please remove /tmp/.launcher-running first to launch launcher!"
|
||||
exit 1
|
||||
fi
|
||||
: >/tmp/.launcher
|
||||
: >/tmp/.launcher-running
|
||||
_check
|
||||
while true; do
|
||||
_check_desktop
|
||||
_check_manage
|
||||
|
|
|
@ -1,27 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# written by Tobias Powalowski <tpowa@archlinux.org>
|
||||
LANG=C
|
||||
_ANSWER="/tmp/.localize"
|
||||
_RUNNING_ARCH="$(uname -m)"
|
||||
_TITLE="Archboot ${_RUNNING_ARCH} | Arch Linux Setup | Localization"
|
||||
# _dialog()
|
||||
# an el-cheapo dialog wrapper
|
||||
#
|
||||
# parameters: see dialog(1)
|
||||
# returns: whatever dialog did
|
||||
_dialog() {
|
||||
dialog --backtitle "${_TITLE}" --aspect 15 "$@"
|
||||
return $?
|
||||
}
|
||||
|
||||
_abort() {
|
||||
_dialog --yesno "Abort Arch Linux Localization?" 5 35 || return 0
|
||||
[[ -e /tmp/.localize-running ]] && rm /tmp/.localize-running
|
||||
[[ -e /tmp/.localize ]] && rm /tmp/.localize
|
||||
clear
|
||||
exit 1
|
||||
}
|
||||
. /usr/lib/archboot/basic-common.sh
|
||||
_TITLE="Archboot ${_RUNNING_ARCH} | Basic Setup | Localization"
|
||||
|
||||
_localize_menu() {
|
||||
_LOCALE=""
|
||||
|
@ -55,17 +36,10 @@ _localize() {
|
|||
sleep 3
|
||||
}
|
||||
|
||||
if [[ -e /tmp/.localize-running ]]; then
|
||||
echo "localize already runs on a different console!"
|
||||
echo "Please remove /tmp/.localize-running first!"
|
||||
exit 1
|
||||
fi
|
||||
: >/tmp/.localize-running
|
||||
_check
|
||||
while [[ -z ${_LOCALE} ]]; do
|
||||
_localize_menu
|
||||
done
|
||||
_localize
|
||||
[[ -e /tmp/.localize-running ]] && rm /tmp/.localize-running
|
||||
clear
|
||||
exit 0
|
||||
_cleanup
|
||||
# vim: set ts=4 sw=4 et:
|
||||
|
|
|
@ -1,32 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# written by Tobias Powalowski <tpowa@archlinux.org>
|
||||
LANG=C
|
||||
_ANSWER="/tmp/.network"
|
||||
_RUNNING_ARCH="$(uname -m)"
|
||||
_TITLE="Archboot ${_RUNNING_ARCH} | Arch Linux Setup | Network Configuration"
|
||||
_LOG="/dev/tty7"
|
||||
_NO_LOG="/dev/null"
|
||||
# _dialog()
|
||||
# an el-cheapo dialog wrapper
|
||||
#
|
||||
# parameters: see dialog(1)
|
||||
# returns: whatever dialog did
|
||||
_dialog() {
|
||||
dialog --backtitle "${_TITLE}" --aspect 15 "$@"
|
||||
return $?
|
||||
}
|
||||
|
||||
_abort() {
|
||||
if _dialog --yesno "Abort Arch Linux Network Configuration?" 5 45; then
|
||||
[[ -e /tmp/.network-running ]] && rm /tmp/.network-running
|
||||
[[ -e /tmp/.network ]] && rm /tmp/.network
|
||||
clear
|
||||
exit 1
|
||||
else
|
||||
_CONTINUE=""
|
||||
fi
|
||||
}
|
||||
. /usr/lib/archboot/basic-common.sh
|
||||
_TITLE="Archboot ${_RUNNING_ARCH} | Basic Setup | Network Configuration"
|
||||
|
||||
_printk()
|
||||
{
|
||||
|
@ -222,22 +198,9 @@ _network() {
|
|||
return 0
|
||||
}
|
||||
|
||||
if [[ -e /tmp/.network-running ]]; then
|
||||
clear
|
||||
echo "network already runs on a different console!"
|
||||
echo "Please remove /tmp/.network-running first to launch network!"
|
||||
exit 1
|
||||
fi
|
||||
: >/tmp/.network-running
|
||||
if [[ -n "${1}" ]]; then
|
||||
_LABEL="Back"
|
||||
else
|
||||
_LABEL="Exit"
|
||||
fi
|
||||
_check
|
||||
while true; do
|
||||
_network && break
|
||||
done
|
||||
[[ -e /tmp/.network-running ]] && rm /tmp/.network-running
|
||||
clear
|
||||
exit 0
|
||||
_cleanup
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
||||
|
|
134
usr/bin/archboot-pacsetup.sh
Executable file
134
usr/bin/archboot-pacsetup.sh
Executable file
|
@ -0,0 +1,134 @@
|
|||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# created by Tobias Powalowski <tpowa@archlinux.org>
|
||||
. /usr/lib/archboot/basic-common.sh
|
||||
_TITLE="Archboot ${_RUNNING_ARCH} | Basic Setup | Pacman Configuration"
|
||||
|
||||
_select_mirror() {
|
||||
## Download updated mirrorlist, if possible (only on x86_64)
|
||||
if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then
|
||||
_dialog --infobox "Downloading latest mirrorlist..." 3 40
|
||||
${_DLPROG} "https://www.archlinux.org/mirrorlist/?country=all&protocol=http&protocol=https&ip_version=4&ip_version=6&use_mirror_status=on" -O /tmp/pacman_mirrorlist.txt
|
||||
if grep -q '#Server = http:' /tmp/pacman_mirrorlist.txt; then
|
||||
mv "${_MIRRORLIST}" "${_MIRRORLIST}.bak"
|
||||
cp /tmp/pacman_mirrorlist.txt "${_MIRRORLIST}"
|
||||
fi
|
||||
fi
|
||||
# FIXME: this regex doesn't honor commenting
|
||||
_MIRRORS=$(grep -E -o '((http)|(https))://[^/]*' "${_MIRRORLIST}" | sed 's|$| _|g')
|
||||
#shellcheck disable=SC2086
|
||||
_dialog --no-cancel --title " Pacman Package Mirror " --menu "" 13 55 7 \
|
||||
"Custom" "_" ${_MIRRORS} 2>${_ANSWER} || return 1
|
||||
#shellcheck disable=SC2155
|
||||
local _SERVER=$(cat "${_ANSWER}")
|
||||
if [[ "${_SERVER}" == "Custom" ]]; then
|
||||
_dialog --inputbox "Enter the full URL to repositories." 8 65 \
|
||||
"" 2>"${_ANSWER}" || return 1
|
||||
_SYNC_URL=$(cat "${_ANSWER}")
|
||||
else
|
||||
# Form the full URL for our mirror by grepping for the server name in
|
||||
# our mirrorlist and pulling the full URL out. Substitute 'core' in
|
||||
# for the repository name, and ensure that if it was listed twice we
|
||||
# only return one line for the mirror.
|
||||
_SYNC_URL=$(grep -E -o "${_SERVER}.*" "${_MIRRORLIST}" | head -n1)
|
||||
fi
|
||||
echo "Using mirror: ${_SYNC_URL}" >"${_LOG}"
|
||||
#shellcheck disable=SC2027,SC2086
|
||||
echo "Server = "${_SYNC_URL}"" >> /etc/pacman.d/mirrorlist
|
||||
return 0
|
||||
}
|
||||
|
||||
_enable_testing() {
|
||||
if ! grep -q "^\[.*testing\]" /etc/pacman.conf; then
|
||||
_DOTESTING=""
|
||||
_dialog --defaultno --yesno "Do you want to enable [core-testing]\nand [extra-testing] repositories?\n\nOnly enable this if you need latest\navailable packages for testing purposes!" 9 50 && _DOTESTING=1
|
||||
if [[ -n "${_DOTESTING}" ]]; then
|
||||
sed -i -e '/^#\[core-testing\]/ { n ; s/^#// }' /etc/pacman.conf
|
||||
sed -i -e '/^#\[extra-testing\]/ { n ; s/^#// }' /etc/pacman.conf
|
||||
sed -i -e 's:^#\[core-testing\]:\[core-testing\]:g' -e 's:^#\[extra-testing\]:\[extra-testing\]:g' /etc/pacman.conf
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_update_environment() {
|
||||
if [[ -d "/var/cache/pacman/pkg" ]] && [[ -n "$(ls -A "/var/cache/pacman/pkg")" ]]; then
|
||||
echo "Packages are already in pacman cache..." >"${_LOG}"
|
||||
_dialog --infobox "Packages are already in pacman cache.\nSkipping update environment.\nContinuing in 5 seconds..." 5 50
|
||||
sleep 5
|
||||
else
|
||||
_UPDATE_ENVIRONMENT=""
|
||||
_LOCAL_KERNEL=""
|
||||
_ONLINE_KERNEL=""
|
||||
if [[ "$(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g')" -gt "2571000" ]]; then
|
||||
if ! [[ "${_RUNNING_ARCH}" == "riscv64" ]]; then
|
||||
_dialog --infobox "Refreshing package database..." 3 70
|
||||
pacman -Sy &>"${_LOG}"
|
||||
sleep 1
|
||||
_dialog --infobox "Checking on new online kernel version..." 3 70
|
||||
#shellcheck disable=SC2086
|
||||
_LOCAL_KERNEL="$(pacman -Qi ${_KERNELPKG} | grep Version | cut -d ':' -f2 | sed -e 's# ##')"
|
||||
if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then
|
||||
#shellcheck disable=SC2086
|
||||
_ONLINE_KERNEL="$(pacman -Si ${_KERNELPKG}-${_RUNNING_ARCH} | grep Version | cut -d ':' -f2 | sed -e 's# ##')"
|
||||
else
|
||||
if [[ -n "${_DOTESTING}" ]]; then
|
||||
#shellcheck disable=SC2086
|
||||
_ONLINE_KERNEL="$(pacman -Si core-testing/${_KERNELPKG} 2>${_NO_LOG} | grep Version | cut -d ':' -f2 | sed -e 's# ##')"
|
||||
fi
|
||||
if [[ -z "${_ONLINE_KERNEL}" ]]; then
|
||||
#shellcheck disable=SC2086
|
||||
_ONLINE_KERNEL="$(pacman -Si ${_KERNELPKG} | grep Version | cut -d ':' -f2 | sed -e 's# ##')"
|
||||
fi
|
||||
fi
|
||||
echo "${_LOCAL_KERNEL} local kernel version and ${_ONLINE_KERNEL} online kernel version." >"${_LOG}"
|
||||
sleep 2
|
||||
if [[ "${_LOCAL_KERNEL}" == "${_ONLINE_KERNEL}" ]]; then
|
||||
_dialog --infobox "No new kernel online available.\nSkipping update environment." 4 50
|
||||
sleep 3
|
||||
else
|
||||
_dialog --defaultno --yesno "New online kernel version ${_ONLINE_KERNEL} available.\n\nDo you want to update the archboot environment to latest packages with caching packages for installation?\n\nATTENTION:\nThis will reboot the system using kexec!" 11 60 && _UPDATE_ENVIRONMENT=1
|
||||
if [[ -n "${_UPDATE_ENVIRONMENT}" ]]; then
|
||||
clear
|
||||
echo -e "\e[93mGo and get a cup of coffee. Depending on your system setup,\e[m"
|
||||
echo -e "\e[93myou can \e[1mstart\e[m\e[93m with your tasks in about \e[1m5\e[m\e[93m minutes...\e[m"
|
||||
echo -e "\e[1mStarting\e[m assembling of archboot environment \e[1mwith\e[m package cache..."
|
||||
echo -e "\e[1mRunning now: \e[92mupdate -latest-install\e[m"
|
||||
update -latest-install
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_prepare_pacman() {
|
||||
# Set up the necessary directories for pacman use
|
||||
[[ ! -d "${_DESTDIR}/var/cache/pacman/pkg" ]] && mkdir -p "${_DESTDIR}/var/cache/pacman/pkg"
|
||||
[[ ! -d "${_DESTDIR}/var/lib/pacman" ]] && mkdir -p "${_DESTDIR}/var/lib/pacman"
|
||||
_dialog --infobox "Waiting for Arch Linux keyring initialization..." 3 40
|
||||
# pacman-key process itself
|
||||
while pgrep -x pacman-key &>"${_NO_LOG}"; do
|
||||
sleep 1
|
||||
done
|
||||
# gpg finished in background
|
||||
while pgrep -x gpg &>"${_NO_LOG}"; do
|
||||
sleep 1
|
||||
done
|
||||
[[ -e /etc/systemd/system/pacman-init.service ]] && systemctl stop pacman-init.service
|
||||
_dialog --infobox "Update Arch Linux keyring..." 3 40
|
||||
_KEYRING="archlinux-keyring"
|
||||
[[ "${_RUNNING_ARCH}" == "aarch64" ]] && _KEYRING="${_KEYRING} archlinuxarm-keyring"
|
||||
#shellcheck disable=SC2086
|
||||
if ! pacman -Sy ${_PACMAN_CONF} --noconfirm --noprogressbar ${_KEYRING} &>"${_LOG}"; then
|
||||
_dialog --title " ERROR " --infobox "Keyring update failed! Check ${_LOG} for errors." 3 60
|
||||
sleep 5
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
_check
|
||||
while true; do
|
||||
_select_mirror && break
|
||||
done
|
||||
_cleanup
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
|
@ -1,31 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# written by Tobias Powalowski <tpowa@archlinux.org>
|
||||
LANG=C
|
||||
_ANSWER="/tmp/.vconsole"
|
||||
_RUNNING_ARCH="$(uname -m)"
|
||||
_TITLE="Archboot ${_RUNNING_ARCH} | Arch Linux Setup | Vconsole Configuration"
|
||||
. /usr/lib/archboot/basic-common.sh
|
||||
_TITLE="Archboot ${_RUNNING_ARCH} | Basic Setup | Vconsole Configuration"
|
||||
_LIST_MAPS="localectl list-keymaps --no-pager"
|
||||
# _dialog()
|
||||
# an el-cheapo dialog wrapper
|
||||
#
|
||||
# parameters: see dialog(1)
|
||||
# returns: whatever dialog did
|
||||
_dialog() {
|
||||
dialog --backtitle "${_TITLE}" --aspect 15 "$@"
|
||||
return $?
|
||||
}
|
||||
|
||||
_abort() {
|
||||
if _dialog --yesno "Abort Arch Linux Vconsole Configuration?" 5 45; then
|
||||
[[ -e /tmp/.vconsole-running ]] && rm /tmp/.vconsole-running
|
||||
[[ -e /tmp/.vconsole ]] && rm /tmp/.vconsole
|
||||
clear
|
||||
exit 1
|
||||
else
|
||||
_CONTINUE=""
|
||||
fi
|
||||
}
|
||||
|
||||
_vconsole() {
|
||||
_dialog --infobox "Setting vconsole font ${_FONT} and keymap ${_KEYMAP}..." 3 80
|
||||
|
@ -35,6 +13,7 @@ _vconsole() {
|
|||
sleep 3
|
||||
_dialog --infobox "Vconsole configuration completed successfully." 3 50
|
||||
sleep 3
|
||||
return 0
|
||||
}
|
||||
|
||||
_vconsole_font() {
|
||||
|
@ -95,21 +74,11 @@ _vconsole_keymap() {
|
|||
done
|
||||
}
|
||||
|
||||
if [[ -e /tmp/.vconsole-running ]]; then
|
||||
echo "vconsole already runs on a different vconsole!"
|
||||
echo "Please remove /tmp/.vconsole-running first to launch vconsole!"
|
||||
exit 1
|
||||
fi
|
||||
: >/tmp/.vconsole-running
|
||||
if [[ -n "${1}" ]]; then
|
||||
_LABEL="Back"
|
||||
else
|
||||
_LABEL="Exit"
|
||||
fi
|
||||
_vconsole_font
|
||||
_vconsole_keymap
|
||||
[[ -e /tmp/.vconsole-running ]] && rm /tmp/.vconsole-running
|
||||
_vconsole
|
||||
clear
|
||||
exit 0
|
||||
_check
|
||||
while true; do
|
||||
_vconsole_font
|
||||
_vconsole_keymap
|
||||
_vconsole && break
|
||||
done
|
||||
_cleanup
|
||||
# vim: set ts=4 sw=4 et:
|
||||
|
|
50
usr/lib/archboot/basic-common.sh
Normal file
50
usr/lib/archboot/basic-common.sh
Normal file
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# created by Tobias Powalowski <tpowa@archlinux.org>
|
||||
LANG=C
|
||||
_ANSWER="/tmp/.$(basename ${0})"
|
||||
_RUNNING_ARCH="$(uname -m)"
|
||||
_LOG="/dev/tty7"
|
||||
_NO_LOG="/dev/null"
|
||||
_DLPROG="wget -q"
|
||||
_MIRRORLIST="/etc/pacman.d/mirrorlist"
|
||||
_LABEL="Exit"
|
||||
|
||||
# _dialog()
|
||||
# an el-cheapo dialog wrapper
|
||||
#
|
||||
# parameters: see dialog(1)
|
||||
# returns: whatever dialog did
|
||||
_dialog() {
|
||||
dialog --backtitle "${_TITLE}" --aspect 15 "$@"
|
||||
return $?
|
||||
}
|
||||
|
||||
_abort() {
|
||||
if _dialog --yesno "Abort$(echo ${_TITLE} | cut -d '|' -f3) ?" 5 45; then
|
||||
[[ -e "${_ANSWER}-running" ]] && rm "${_ANSWER}-running"
|
||||
[[ -e "${_ANSWER}" ]] && rm ${_ANSWER}
|
||||
clear
|
||||
exit 1
|
||||
else
|
||||
_CONTINUE=""
|
||||
fi
|
||||
}
|
||||
|
||||
_check() {
|
||||
if [[ -e "${_ANSWER}-running" ]]; then
|
||||
clear
|
||||
echo "${0} already runs on a different console!"
|
||||
echo "Please remove ${_ANSWER}-running first to launch ${0}!"
|
||||
exit 1
|
||||
fi
|
||||
: >"${_ANSWER}"
|
||||
: >"${_ANSWER}-running"
|
||||
}
|
||||
|
||||
_cleanup() {
|
||||
[[ -e "${_ANSWER}-running" ]] && rm "${_ANSWER}-running"
|
||||
clear
|
||||
exit 0
|
||||
}
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
|
@ -139,61 +139,6 @@ _set_guid() {
|
|||
fi
|
||||
}
|
||||
|
||||
_configure_vconsole() {
|
||||
if [[ -e /usr/bin/vconsole ]]; then
|
||||
vconsole --setup && _NEXTITEM=1
|
||||
elif [[ -e /usr/bin/archboot-vconsole.sh ]]; then
|
||||
archboot-vconsole.sh --setup && _NEXTITEM=1
|
||||
else
|
||||
_dialog --title " ERROR " --infobox "vconsole script not found, aborting vconsole configuration." 3 60
|
||||
sleep 5
|
||||
fi
|
||||
}
|
||||
|
||||
_configure_network() {
|
||||
if [[ -e /usr/bin/network ]]; then
|
||||
network --setup && _NEXTITEM="2"
|
||||
elif [[ -e /usr/bin/archboot-network.sh ]]; then
|
||||
archboot-network.sh --setup && _NEXTITEM="2"
|
||||
else
|
||||
_dialog --title " ERROR " --infobox "network script not found, aborting network configuration" 3 60
|
||||
sleep 5
|
||||
fi
|
||||
}
|
||||
|
||||
_configure_clock() {
|
||||
if [[ -e /usr/bin/clock ]]; then
|
||||
clock --setup && _NEXTITEM="3"
|
||||
elif [[ -e /usr/bin/archboot-clock.sh ]]; then
|
||||
archboot-clock.sh --setup && _NEXTITEM="3"
|
||||
else
|
||||
_dialog --title " ERROR " --infobox "clock script not found, aborting clock configuration" 3 60
|
||||
fi
|
||||
}
|
||||
|
||||
_select_source() {
|
||||
_NEXTITEM="3"
|
||||
_set_title
|
||||
_S_SRC=""
|
||||
if [[ -e "${_LOCAL_DB}" ]]; then
|
||||
_getsource || return 1
|
||||
else
|
||||
if [[ -z ${_S_NET} ]]; then
|
||||
if ! [[ -e /tmp/.network ]]; then
|
||||
network || return 1
|
||||
_S_NET=1
|
||||
else
|
||||
_S_NET=1
|
||||
fi
|
||||
fi
|
||||
if [[ -z ${_S_SRC} ]]; then
|
||||
[[ "${_RUNNING_ARCH}" == "x86_64" ]] && _enable_testing
|
||||
_getsource || return 1
|
||||
fi
|
||||
fi
|
||||
_NEXTITEM="4"
|
||||
}
|
||||
|
||||
_prepare_storagedrive() {
|
||||
_S_MKFSAUTO=""
|
||||
_S_MKFS=""
|
||||
|
@ -304,10 +249,6 @@ _mainmenu() {
|
|||
#shellcheck disable=SC2086
|
||||
_dialog --no-cancel ${_DEFAULT} --title " MAIN MENU " \
|
||||
--menu "Use the UP and DOWN arrows to navigate menus.\nUse TAB to switch between buttons and ENTER to select." 17 58 14 \
|
||||
"0" "Configure Console" \
|
||||
"1" "Configure Network" \
|
||||
"2" "Configure Clock" \
|
||||
"3" "Select Source" \
|
||||
"4" "Prepare Storage Device" \
|
||||
"5" "Install Packages" \
|
||||
"6" "Configure System" \
|
||||
|
@ -315,25 +256,6 @@ _mainmenu() {
|
|||
"8" "Exit" 2>${_ANSWER}
|
||||
_NEXTITEM="$(cat ${_ANSWER})"
|
||||
case $(cat ${_ANSWER}) in
|
||||
"0")
|
||||
_configure_vconsole ;;
|
||||
"1")
|
||||
if [[ -e "${_LOCAL_DB}" ]]; then
|
||||
_abort_local_mode
|
||||
else
|
||||
_configure_network
|
||||
fi ;;
|
||||
"2")
|
||||
_configure_clock ;;
|
||||
"3")
|
||||
if [[ "${_DESTDIR}" == "/" ]]; then
|
||||
_abort_running_system
|
||||
elif [[ -e "${_LOCAL_DB}" ]]; then
|
||||
_abort_local_mode
|
||||
else
|
||||
_select_source || return 1
|
||||
_update_environment
|
||||
fi ;;
|
||||
"4")
|
||||
if [[ "${_DESTDIR}" == "/" ]]; then
|
||||
_abort_running_system
|
||||
|
|
|
@ -2,142 +2,17 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# created by Tobias Powalowski <tpowa@archlinux.org>
|
||||
_getsource() {
|
||||
_PACMAN_CONF=""
|
||||
if [[ -e "${_LOCAL_DB}" ]]; then
|
||||
_NEXTITEM="4"
|
||||
_local_pacman_conf
|
||||
else
|
||||
_select_mirror || return 1
|
||||
if [[ -z ${_S_SRC} ]]; then
|
||||
_PACMAN_CONF=""
|
||||
if [[ -e "${_LOCAL_DB}" ]]; then
|
||||
_local_pacman_conf
|
||||
fi
|
||||
fi
|
||||
_S_SRC=1
|
||||
}
|
||||
|
||||
_select_mirror() {
|
||||
_NEXTITEM="3"
|
||||
## Download updated mirrorlist, if possible (only on x86_64)
|
||||
if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then
|
||||
_dialog --infobox "Downloading latest mirrorlist..." 3 40
|
||||
${_DLPROG} "https://www.archlinux.org/mirrorlist/?country=all&protocol=http&protocol=https&ip_version=4&ip_version=6&use_mirror_status=on" -O /tmp/pacman_mirrorlist.txt
|
||||
if grep -q '#Server = http:' /tmp/pacman_mirrorlist.txt; then
|
||||
mv "${_MIRRORLIST}" "${_MIRRORLIST}.bak"
|
||||
cp /tmp/pacman_mirrorlist.txt "${_MIRRORLIST}"
|
||||
fi
|
||||
fi
|
||||
# FIXME: this regex doesn't honor commenting
|
||||
_MIRRORS=$(grep -E -o '((http)|(https))://[^/]*' "${_MIRRORLIST}" | sed 's|$| _|g')
|
||||
#shellcheck disable=SC2086
|
||||
_dialog --title " Pacman Package Mirror " --menu "" 13 55 7 \
|
||||
${_MIRRORS} \
|
||||
"Custom" "_" 2>${_ANSWER} || return 1
|
||||
#shellcheck disable=SC2155
|
||||
local _SERVER=$(cat "${_ANSWER}")
|
||||
if [[ "${_SERVER}" == "Custom" ]]; then
|
||||
_dialog --inputbox "Enter the full URL to repositories." 8 65 \
|
||||
"" 2>"${_ANSWER}" || return 1
|
||||
_SYNC_URL=$(cat "${_ANSWER}")
|
||||
else
|
||||
# Form the full URL for our mirror by grepping for the server name in
|
||||
# our mirrorlist and pulling the full URL out. Substitute 'core' in
|
||||
# for the repository name, and ensure that if it was listed twice we
|
||||
# only return one line for the mirror.
|
||||
_SYNC_URL=$(grep -E -o "${_SERVER}.*" "${_MIRRORLIST}" | head -n1)
|
||||
fi
|
||||
_NEXTITEM="4"
|
||||
echo "Using mirror: ${_SYNC_URL}" >"${_LOG}"
|
||||
#shellcheck disable=SC2027,SC2086
|
||||
echo "Server = "${_SYNC_URL}"" >> /etc/pacman.d/mirrorlist
|
||||
}
|
||||
|
||||
_enable_testing() {
|
||||
if ! grep -q "^\[.*testing\]" /etc/pacman.conf; then
|
||||
_DOTESTING=""
|
||||
_dialog --defaultno --yesno "Do you want to enable [core-testing]\nand [extra-testing] repositories?\n\nOnly enable this if you need latest\navailable packages for testing purposes!" 9 50 && _DOTESTING=1
|
||||
if [[ -n "${_DOTESTING}" ]]; then
|
||||
sed -i -e '/^#\[core-testing\]/ { n ; s/^#// }' /etc/pacman.conf
|
||||
sed -i -e '/^#\[extra-testing\]/ { n ; s/^#// }' /etc/pacman.conf
|
||||
sed -i -e 's:^#\[core-testing\]:\[core-testing\]:g' -e 's:^#\[extra-testing\]:\[extra-testing\]:g' /etc/pacman.conf
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_update_environment() {
|
||||
if [[ -d "/var/cache/pacman/pkg" ]] && [[ -n "$(ls -A "/var/cache/pacman/pkg")" ]]; then
|
||||
echo "Packages are already in pacman cache..." >"${_LOG}"
|
||||
_dialog --infobox "Packages are already in pacman cache.\nSkipping update environment.\nContinuing in 5 seconds..." 5 50
|
||||
sleep 5
|
||||
else
|
||||
_UPDATE_ENVIRONMENT=""
|
||||
_LOCAL_KERNEL=""
|
||||
_ONLINE_KERNEL=""
|
||||
if [[ "$(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g')" -gt "2571000" ]]; then
|
||||
if ! [[ "${_RUNNING_ARCH}" == "riscv64" ]]; then
|
||||
_dialog --infobox "Refreshing package database..." 3 70
|
||||
pacman -Sy &>"${_LOG}"
|
||||
sleep 1
|
||||
_dialog --infobox "Checking on new online kernel version..." 3 70
|
||||
#shellcheck disable=SC2086
|
||||
_LOCAL_KERNEL="$(pacman -Qi ${_KERNELPKG} | grep Version | cut -d ':' -f2 | sed -e 's# ##')"
|
||||
if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then
|
||||
#shellcheck disable=SC2086
|
||||
_ONLINE_KERNEL="$(pacman -Si ${_KERNELPKG}-${_RUNNING_ARCH} | grep Version | cut -d ':' -f2 | sed -e 's# ##')"
|
||||
else
|
||||
if [[ -n "${_DOTESTING}" ]]; then
|
||||
#shellcheck disable=SC2086
|
||||
_ONLINE_KERNEL="$(pacman -Si core-testing/${_KERNELPKG} 2>${_NO_LOG} | grep Version | cut -d ':' -f2 | sed -e 's# ##')"
|
||||
fi
|
||||
if [[ -z "${_ONLINE_KERNEL}" ]]; then
|
||||
#shellcheck disable=SC2086
|
||||
_ONLINE_KERNEL="$(pacman -Si ${_KERNELPKG} | grep Version | cut -d ':' -f2 | sed -e 's# ##')"
|
||||
fi
|
||||
fi
|
||||
echo "${_LOCAL_KERNEL} local kernel version and ${_ONLINE_KERNEL} online kernel version." >"${_LOG}"
|
||||
sleep 2
|
||||
if [[ "${_LOCAL_KERNEL}" == "${_ONLINE_KERNEL}" ]]; then
|
||||
_dialog --infobox "No new kernel online available.\nSkipping update environment." 4 50
|
||||
sleep 3
|
||||
else
|
||||
_dialog --defaultno --yesno "New online kernel version ${_ONLINE_KERNEL} available.\n\nDo you want to update the archboot environment to latest packages with caching packages for installation?\n\nATTENTION:\nThis will reboot the system using kexec!" 11 60 && _UPDATE_ENVIRONMENT=1
|
||||
if [[ -n "${_UPDATE_ENVIRONMENT}" ]]; then
|
||||
clear
|
||||
echo -e "\e[93mGo and get a cup of coffee. Depending on your system setup,\e[m"
|
||||
echo -e "\e[93myou can \e[1mstart\e[m\e[93m with your tasks in about \e[1m5\e[m\e[93m minutes...\e[m"
|
||||
echo -e "\e[1mStarting\e[m assembling of archboot environment \e[1mwith\e[m package cache..."
|
||||
echo -e "\e[1mRunning now: \e[92mupdate -latest-install\e[m"
|
||||
update -latest-install
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_prepare_pacman() {
|
||||
_NEXTITEM="5"
|
||||
# Set up the necessary directories for pacman use
|
||||
[[ ! -d "${_DESTDIR}/var/cache/pacman/pkg" ]] && mkdir -p "${_DESTDIR}/var/cache/pacman/pkg"
|
||||
[[ ! -d "${_DESTDIR}/var/lib/pacman" ]] && mkdir -p "${_DESTDIR}/var/lib/pacman"
|
||||
_dialog --infobox "Waiting for Arch Linux keyring initialization..." 3 40
|
||||
# pacman-key process itself
|
||||
while pgrep -x pacman-key &>"${_NO_LOG}"; do
|
||||
sleep 1
|
||||
done
|
||||
# gpg finished in background
|
||||
while pgrep -x gpg &>"${_NO_LOG}"; do
|
||||
sleep 1
|
||||
done
|
||||
[[ -e /etc/systemd/system/pacman-init.service ]] && systemctl stop pacman-init.service
|
||||
_dialog --infobox "Update Arch Linux keyring..." 3 40
|
||||
_KEYRING="archlinux-keyring"
|
||||
[[ "${_RUNNING_ARCH}" == "aarch64" ]] && _KEYRING="${_KEYRING} archlinuxarm-keyring"
|
||||
#shellcheck disable=SC2086
|
||||
if ! pacman -Sy ${_PACMAN_CONF} --noconfirm --noprogressbar ${_KEYRING} &>"${_LOG}"; then
|
||||
_dialog --title " ERROR " --infobox "Keyring update failed! Check ${_LOG} for errors." 3 60
|
||||
sleep 5
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
_run_pacman(){
|
||||
_getsource
|
||||
_chroot_mount
|
||||
_dialog --title " Pacman " --infobox "Installing package(s) to ${_DESTDIR}:\n${_PACKAGES}...\n\nCheck ${_VC} console (ALT-F${_VC_NUM}) for progress..." 8 70
|
||||
echo "Installing Packages..." >/tmp/pacman.log
|
||||
|
|
|
@ -116,7 +116,7 @@ _download_latest() {
|
|||
done
|
||||
# main libs
|
||||
echo -e "\e[1mStep 3/4:\e[m Downloading latest script libs..."
|
||||
LIBS="common.sh container.sh release.sh iso.sh login.sh cpio.sh"
|
||||
LIBS="basic-common.sh common.sh container.sh release.sh iso.sh login.sh cpio.sh"
|
||||
for i in ${LIBS}; do
|
||||
wget -q "${_SOURCE}${_LIB}/${i}?inline=false" -O "${_LIB}/${i}"
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue