Skip to content

Commit

Permalink
Desktops: enable unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpecovnik committed Oct 11, 2024
1 parent ec3a145 commit 72a4684
Show file tree
Hide file tree
Showing 7 changed files with 265 additions and 77 deletions.
272 changes: 221 additions & 51 deletions lib/armbian-configng/config.ng.jobs.json
Original file line number Diff line number Diff line change
Expand Up @@ -574,67 +574,237 @@
"sub": [
{
"id": "Desktops",
"description": "Install Desktop Environments",
"description": "Desktop Environments",
"sub": [
{
"id": "SW02",
"description": "Install XFCE desktop",
"command": [
"install_de \"xfce\""
],
"status": "Preview",
"doc_link": "",
"src_reference": "",
"author": "",
"condition": ""
"id": "DE01",
"description": "XFCE desktop",
"sub": [
{
"id": "DE02",
"description": "XFCE desktop Install",
"command": [
"manage_desktops 'xfce' 'install'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ ! -f /usr/share/xsessions/xfce.desktop ]"
},
{
"id": "DE03",
"description": "Uninstall",
"command": [
"manage_desktops 'xfce' 'uninstall'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/xfce.desktop ]"
},
{
"id": "DE04",
"description": "Enable autologin",
"command": [
"manage_desktops 'xfce' 'auto'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/xfce.desktop ] && [ ! -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
},
{
"id": "DE05",
"description": "Disable autologin",
"command": [
"manage_desktops 'xfce' 'manual'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/xfce.desktop ] && [ -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
}
]
},
{
"id": "SW03",
"description": "Install Gnome desktop",
"command": [
"install_de \"gnome\""
],
"status": "Preview",
"doc_link": "",
"src_reference": "",
"author": "",
"condition": ""
"id": "DE10",
"description": "Gnome desktop",
"sub": [
{
"id": "DE11",
"description": "Gnome desktop Install",
"command": [
"manage_desktops 'gnome' 'install'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ ! -f /usr/share/xsessions/gnome.desktop ]"
},
{
"id": "DE12",
"description": "Uninstall",
"command": [
"manage_desktops 'gnome' 'uninstall'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/gnome.desktop ]"
},
{
"id": "DE13",
"description": "Enable autologin",
"command": [
"manage_desktops 'gnome' 'auto'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ ! -f /usr/share/xsessions/gnome.desktop ] && [ ! -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
},
{
"id": "DE14",
"description": "Disable autologin",
"command": [
"manage_desktops 'gnome' 'manual'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ ! -f /usr/share/xsessions/gnome.desktop ] && [ -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
}
]
},
{
"id": "SW04",
"description": "Install i3-wm desktop",
"command": [
"install_de \"i3-wm\""
],
"status": "Preview",
"doc_link": "",
"src_reference": "",
"author": "",
"condition": ""
"id": "DE20",
"description": "i3-wm desktop",
"sub": [
{
"id": "DE21",
"description": "XFCE desktop Install",
"command": [
"manage_desktops 'i3-wm' 'install'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ ! -f /usr/share/xsessions/gnome.desktop ]"
},
{
"id": "DE22",
"description": "Uninstall",
"command": [
"manage_desktops 'i3-wm' 'uninstall'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/gnome.desktop ]"
},
{
"id": "DE23",
"description": "Enable autologin",
"command": [
"manage_desktops 'i3-wm' 'auto'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ ! -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
},
{
"id": "DE24",
"description": "Disable autologin",
"command": [
"manage_desktops 'i3-wm' 'manual'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
}
]
},
{
"id": "SW05",
"description": "Install Cinnamon desktop",
"command": [
"install_de \"cinnamon\""
],
"status": "Preview",
"doc_link": "",
"src_reference": "",
"author": "",
"condition": ""
"id": "DE30",
"description": "Cinnamon desktop",
"sub": [
{
"id": "DE31",
"description": "XFCE desktop Install",
"command": [
"manage_desktops 'cinnamon' 'install'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ ! -f /usr/share/xsessions/gnome.desktop ]"
},
{
"id": "DE32",
"description": "Uninstall",
"command": [
"manage_desktops 'cinnamon' 'uninstall'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/gnome.desktop ]"
},
{
"id": "DE33",
"description": "Enable autologin",
"command": [
"manage_desktops 'cinnamon' 'auto'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ ! -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
},
{
"id": "DE34",
"description": "Disable autologin",
"command": [
"manage_desktops 'cinnamon' 'manual'"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
}
]
},
{
"id": "SW06",
"description": "Install kde-neon desktop",
"command": [
"install_de \"kde-neon\""
],
"status": "Preview",
"doc_link": "",
"src_reference": "",
"author": "",
"condition": ""
"id": "DE40",
"description": "Kde-neon desktop",
"sub": [
{
"id": "DE41",
"description": "XFCE desktop Install",
"command": [
"install_de \"gnome\""
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ ! -f /usr/share/xsessions/gnome.desktop ]"
},
{
"id": "DE42",
"description": "Uninstall",
"command": [
"install_de \"gnome\""
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /usr/share/xsessions/gnome.desktop ]"
},
{
"id": "DE43",
"description": "Enable autologin",
"command": [
"install_de \"gnome\""
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ ! -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
},
{
"id": "DE44",
"description": "Disable autologin",
"command": [
"install_de \"xfce\""
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "[ -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]"
}
]
}
]
},
Expand Down
60 changes: 34 additions & 26 deletions lib/armbian-configng/config.ng.system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,36 +97,44 @@ module_options+=(
#
# Install desktop
#
function install_de() {
function manage_desktops() {

local desktop=$1
local command=$2

# get user who executed this script
if [ $SUDO_USER ]; then local user=$SUDO_USER; else local user=$(whoami); fi

#debconf-apt-progress --
apt-get update
#debconf-apt-progress --
apt-get -o Dpkg::Options::="--force-confold" -y --install-recommends install armbian-${DISTROID}-desktop-$1 # armbian-bsp-desktop-${BOARD}-${BRANCH}

# clean apt cache
apt-get -y clean

# add user to groups
for additionalgroup in sudo netdev audio video dialout plugdev input bluetooth systemd-journal ssh; do
usermod -aG ${additionalgroup} ${user} 2> /dev/null
done

# Recreating Synaptic search index
update-apt-xapian-index -u

# set up profile sync daemon on desktop systems
which psd > /dev/null 2>&1
if [[ $? -eq 0 && -z $(grep overlay-helper /etc/sudoers) ]]; then
echo "${user} ALL=(ALL) NOPASSWD: /usr/bin/psd-overlay-helper" >> /etc/sudoers
touch /home/${user}/.activate_psd
fi

# update skel
update_skel
case "$command" in
install)
apt_install_wrapper apt-get -o Dpkg::Options::="--force-confold" -y --install-recommends install armbian-${DISTROID}-desktop-${desktop}
# add user to groups
for additionalgroup in sudo netdev audio video dialout plugdev input bluetooth systemd-journal ssh; do
usermod -aG ${additionalgroup} ${user} 2> /dev/null
done
# Recreating Synaptic search index
update-apt-xapian-index -u

# set up profile sync daemon on desktop systems
which psd > /dev/null 2>&1
if [[ $? -eq 0 && -z $(grep overlay-helper /etc/sudoers) ]]; then
echo "${user} ALL=(ALL) NOPASSWD: /usr/bin/psd-overlay-helper" >> /etc/sudoers
touch /home/${user}/.activate_psd
fi
# update skel
update_skel
;;
uninstall)
apt_install_wrapper apt-get -o Dpkg::Options::="--force-confold" -y --install-recommends purge armbian-${DISTROID}-desktop-$1 xfce4-session gnome-session slick-greeter lightdm gdm3 sddm
apt_install_wrapper apt-get -y autoremove
;;
auto)
:
;;
manual)
:
;;
esac

# desktops has different default login managers
case "$1" in
Expand Down
2 changes: 2 additions & 0 deletions tests/SW02.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ENABLED=true
CONDITION="[ -f /usr/share/xsessions/xfce.desktop ]"
2 changes: 2 additions & 0 deletions tests/SW03.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ENABLED=true
CONDITION="[ -f /usr/share/xsessions/gnome.desktop ]"
2 changes: 2 additions & 0 deletions tests/SW04.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ENABLED=true
CONDITION="[ -f /usr/share/xsessions/i3.desktop ]"
2 changes: 2 additions & 0 deletions tests/SW05.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ENABLED=true
CONDITION="[ -f /usr/share/xsessions/cinnamon.desktop ]"
2 changes: 2 additions & 0 deletions tests/SW06.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ENABLED=true
CONDITION="[ -f /usr/share/xsessions/xfce.desktop ]"

0 comments on commit 72a4684

Please sign in to comment.