melawy-archiso-config/Melawy-Linux-NetInstall/airootfs/usr/local/bin/calamares-offline

42 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
Main() {
resp=$(curl -s -o /dev/null -I -w "%{http_code}" http://192.168.1.250/cache/x86_64/)
if [ $resp -eq 200 ]; then
sudo cp /etc/pacman-cache.conf /etc/pacman.conf
else
sudo cp /etc/pacman-std.conf /etc/pacman.conf
fi
local mode=offline
local progname=""
progname="$(basename "$0")"
local log=/home/liveuser/melawy-install.log
cat <<EOF > $log
########## $log by $progname
########## Started (UTC): $(date -u "+%x %X")
########## Install mode: $mode
EOF
# RunInTerminal "tail -f $log" &
sudo cp /etc/calamares/settings_${mode}.conf /etc/calamares/settings.conf
platform="$XDG_SESSION_TYPE"
if [ -z $platform ]; then
platform=$(loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p Type | cut -d"=" -f 2)
fi
if [ -n "$platform" ] && [ "$platform" == "wayland" ]; then
sudo -E dbus-launch calamares -D8 -d -platform $platform >> $log
else
sudo -E dbus-launch calamares -D8 >> $log
fi
}
Main "$@"