#!/bin/bash
#
# Tangential DE 0.4.0
# A customized version of Debian GNU/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/tande; chmod +x ./tande; ./tande
# curl -LO https://tangential.link/tandetest; chmod +x ./tandetest; ./tandetest --test

# check if test mode; get and unpack the correct pre-install package
# is_test_mode=0
if [ "$1" == "--test" ] || [ $(basename "$0") == "tandetest" ]
then
    # is_test_mode=1
    curl -LO https://data.scottbradford.us/tangential/de-test/pre-inst.tar.gz
    sudo tar --no-same-owner --no-same-permissions -C / -xvf ./pre-inst.tar.gz
    sudo sed -i "s|tangential/de/|tangential/de-test/|" /usr/lib/calamares/modules/tande-post-install/main.py
else
    curl -LO https://data.scottbradford.us/tangential/de/pre-inst.tar.gz
    sudo tar --no-same-owner --no-same-permissions -C / -xvf ./pre-inst.tar.gz
fi

# disable sleep
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-enabled -s false

# adjust panels
xfconf-query -c xfce4-panel -a -p /panels -t int -s 1
xfconf-query -c xfce4-panel -p /panels/panel-2 -r -R
xfconf-query -c xfce4-panel -p /panels/panel-1/position -s "p=8;x=0;y=0"
xfce4-panel -r

# run the installer
calamares-install-debian
