# like topinstall.sh
# check if the install session is GUI or cli
+
+if [ -z "$INSTANTARCH" ]; then
+ echo "defaulting instantarch location to /root/instantARCH"
+ INSTANTARCH="/root/instantARCH"
+fi
+
guimode() {
if [ -e /opt/noguimode ]; then
return 1
guimode && feh --bg-scale /usr/share/liveutils/$1.jpg &
}
+artixinfo() {
+ if command -v systemctl; then
+ echo "regular arch/manjaro detected"
+ return
+ fi
+
+ echo "You appear to be installing the non-systemd version of instantOS.
+Support for non-systemd setups is experimental
+Any issues should be solvable with manual intervention
+Here's a list of things that do not work from the installer and how to work around them:
+disk editor: set up partitions beforehand or use automatic partitioning
+keyboard locale: set it manually after installation in the settings
+systemd-swap (obviously)" | imenu -M
+
+}
+
# ask for keyboard layout
asklayout() {
- cd /root/instantARCH/data/lang/keyboard
+ cd "$INSTANTARCH"/data/lang/keyboard
while [ -z "$NEWKEY" ]; do
wallstatus worldmap
NEWKEY="$(ls | imenu -l 'Select keyboard layout ')"
# allow directly typing in layout name
if [ "$NEWKEY" = "other" ]; then
- OTHERKEY="$(localectl list-x11-keymap-layouts | imenu -l 'select keyboard layout ')"
-
- if [ -z "$OTHERKEY" ]; then
- unset NEWKEY
- else
- # newline is intentional!!!
- echo "
+ if command -v localectl; then
+ OTHERKEY="$(localectl list-x11-keymap-layouts | imenu -l 'select keyboard layout ')"
+
+ if [ -z "$OTHERKEY" ]; then
+ unset NEWKEY
+ else
+ # newline is intentional!!!
+ echo "
$OTHERKEY" >/root/instantARCH/data/lang/keyboard/other
+ fi
+ else
+ imenu -m "not supported yet without systemd"
+ unset NEWKEY
fi
fi
+
done
# option to cancel the installer
# ask for default locale
asklocale() {
- cd /root/instantARCH/data/lang/locale
+ cd "$INSTANTARCH"/data/lang/locale
while [ -z "$NEWLOCALE" ]; do
NEWLOCALE="$(ls | imenu -l 'Select language> ')"
done
done
fi
+ iroot region "$REGION"
[ -n "$CITY" ] && iroot city "$CITY"
}
# offer to choose mirror country
askmirrors() {
- curl -s 'https://www.archlinux.org/mirrorlist/' | grep -i '<option value' >/tmp/mirrors.html
- grep -v '>All<' /tmp/mirrors.html | sed 's/.*<option value=".*">\(.*\)<\/option>.*/\1/g' |
- sed -e "1iauto detect mirrors" |
- imenu -l "choose mirror location" >/tmp/mirrorselect
- if ! grep -q 'auto detect' </tmp/mirrorselect; then
- cat /tmp/mirrors.html | grep ">$(cat /tmp/mirrorselect)<" | grep -o '".*"' | grep -o '[^"]*' >/tmp/countrycode
- echo "fetching mirrors for $(cat /tmp/mirrorselect)"
- curl -s "https://www.archlinux.org/mirrorlist/?country=$(cat /tmp/countrycode)&protocol=http&protocol=https&ip_version=4" |
- sed 's/^#Server /Server /g' >/tmp/mirrorlist
- cat /etc/pacman.d/mirrorlist >/tmp/oldmirrorlist
-
- cat /tmp/mirrorlist >/etc/pacman.d/mirrorlist
- cat /tmp/oldmirrorlist >>/etc/pacman.d/mirrorlist
+ iroot askmirrors 1
+ MIRRORCODE="$({
+ echo 'auto detect mirrors (not recommended for speed)'
+ curl -s 'https://archlinux.org/mirrorlist/all/' | grep '##' | grep -iEv '(linux|arch|generated|filter)' |
+ grep -o '[^# ]*' | grep '.....'
+ } | imenu -l 'select mirror location')"
+
+ if grep -q 'auto detect' <<<"$MIRRORCODE"; then
+ iroot automirrors 1
else
- echo "ranking mirrors"
- reflector --latest 40 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist
+ iroot countrycode "$MIRRORCODE"
+ if echo '> manually sorting mirrors may take a long time
+use arch ranking score (recommended)
+sort all mirrors by speed' | imenu -l 'choose mirror settings' | grep -q 'speed'; then
+ iroot sortmirrors 1
+ fi
fi
}
# ask for user details
askuser() {
- while [ -z $NEWUSER ]; do
+ while [ -z "$NEWUSER" ]; do
wallstatus user
NEWUSER="$(imenu -i 'set username')"
# validate input as a unix name
if ! grep -Eq '^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$' <<<"$NEWUSER"; then
- imenu -m "invalid username"
+ imenu -e "invalid username, usernames must not contain spaces or special symbols and start with a lowercase letter"
unset NEWUSER
fi
done
while ! [ "$NEWPASS" = "$NEWPASS2" ] || [ -z "$NEWPASS" ]; do
NEWPASS="$(imenu -P 'set password')"
NEWPASS2="$(imenu -P 'confirm password')"
+ if ! [ "$NEWPASS" = "$NEWPASS2" ]; then
+ echo "the confirmation password doesn't match.
+Please enter a new password" | imenu -M
+ fi
done
iroot user "$NEWUSER"
iroot password "$NEWPASS"
}
+
+# ask about which hypervisor is used
+askvm() {
+ if imvirt | grep -iq 'physical'; then
+ echo "system does not appear to be a virtual machine"
+ return
+ fi
+
+ while [ -z "$VIRTCONFIRM" ]; do
+ if ! imenu -c "is this system a virtual machine?"; then
+ if echo "Are you sure it's not?
+giving the wrong answer here might greatly decrease performance. " | imenu -C; then
+ return
+ fi
+ else
+ VIRTCONFIRM="true"
+ fi
+ done
+ iroot isvm 1
+
+ echo "virtualbox
+kvm/qemu
+other" | imenu -l "which hypervisor is being used?" >/tmp/vmtype
+
+ HYPERVISOR="$(cat /tmp/vmtype)"
+ case "$HYPERVISOR" in
+ kvm*)
+ if grep 'vendor' /proc/cpuinfo | grep -iq 'AMD'; then
+ echo "WARNING:
+ kvm/QEMU on AMD is not meant for desktop use and
+ is lacking some graphics features.
+ This installation will work, but some features will have to be disabled and
+ others might not perform well.
+ It is highly recommended to use Virtualbox instead." | imenu -M
+ iroot kvm 1
+ if lshw -c video | grep -iq 'qxl'; then
+ echo "WARNING:
+QXL graphics detected
+These may trigger a severe Xorg memory leak on kvm/QEMU on AMD,
+leading to degraded video and input performance,
+please switch your video card to either virtio or passthrough
+until this is fixed" | imenu -M
+ fi
+ fi
+ ;;
+ virtualbox)
+ iroot virtualbox 1
+ if imenu -c "would you like to install virtualbox guest additions?"; then
+ iroot guestadditions 1
+ fi
+ ;;
+ other)
+ iroot othervm 1
+ echo "selecting other"
+ ;;
+ esac
+
+}