#!/bin/bash
#
# Tangential EOS 0.4.0
# A customized version of EndeavourOS (which is itself based on Arch Linux)
#
# Changes themes and branding, includes more apps, various config adjustments.
#
# Copyright (c) 2023-2026, Scott Bradford Creative Enterprises
#
# 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 <https://www.gnu.org/licenses/>.
#

# curl -LO https://tangential.link/taneos; chmod +x ./taneos; ./taneos
# curl -LO https://tangential.link/taneostest; chmod +x ./taneostest; ./taneostest --test

rm ~/user_commands.bash
rm ~/user-commands-before.bash

# undo stupid dark mode, which is stupid
lookandfeeltool -a org.kde.breezetwilight.desktop
sudo lookandfeeltool -a org.kde.breezetwilight.desktop

if [ "$1" == "--test" ] || [ $(basename "$0") == "taneostest" ]
then
    wget -nv https://data.scottbradford.us/tangential/eos-test/user_commands.bash
    wget -nv https://data.scottbradford.us/tangential/eos-test/user-commands-before.bash

    sed -i "s/\/eos\//\/eos-test\//" ./user_commands.bash
    sed -i "s/\/eos\//\/eos-test\//" ./user-commands-before.bash
else
    wget -nv https://data.scottbradford.us/tangential/eos/user_commands.bash
    wget -nv https://data.scottbradford.us/tangential/eos/user-commands-before.bash
fi

mv ./user_commands.bash ~/user_commands.bash
mv ./user-commands-before.bash ~/user-commands-before.bash

chmod +x ~/user_commands.bash
chmod +x ~/user-commands-before.bash

# kill welcome screen (if present)
pkill -HUP yad

# launch online mode installer
eos-install-mode-run-calamares en online
