diff --git a/docs/Help/HE001.user.md b/docs/Help/HE001.user.md deleted file mode 100644 index d344f505..00000000 --- a/docs/Help/HE001.user.md +++ /dev/null @@ -1,14 +0,0 @@ -# Contribute -**Command:** -~~~ -armbian-config --cmd HE001 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - diff --git a/docs/Help/Help.user.md b/docs/Help/Help.user.md deleted file mode 100644 index e5372917..00000000 --- a/docs/Help/Help.user.md +++ /dev/null @@ -1,19 +0,0 @@ -# About this tool - - -*** - -## Contribute -**Command:** -~~~ -armbian-config --cmd HE001 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - diff --git a/docs/Localisation/LO001.user.md b/docs/Localisation/LO001.user.md deleted file mode 100644 index 41bfbffe..00000000 --- a/docs/Localisation/LO001.user.md +++ /dev/null @@ -1,14 +0,0 @@ -# Change Global timezone -**Command:** -~~~ -armbian-config --cmd LO001 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - diff --git a/docs/Localisation/LO002.user.md b/docs/Localisation/LO002.user.md deleted file mode 100644 index d68219f0..00000000 --- a/docs/Localisation/LO002.user.md +++ /dev/null @@ -1,14 +0,0 @@ -# Change Locales reconfigure the language and character set -**Command:** -~~~ -armbian-config --cmd LO002 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - diff --git a/docs/Localisation/LO003.user.md b/docs/Localisation/LO003.user.md deleted file mode 100644 index b27ae15b..00000000 --- a/docs/Localisation/LO003.user.md +++ /dev/null @@ -1,14 +0,0 @@ -# Change Keyboard layout -**Command:** -~~~ -armbian-config --cmd LO003 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - diff --git a/docs/Localisation/LO005.user.md b/docs/Localisation/LO005.user.md deleted file mode 100644 index 4d95340e..00000000 --- a/docs/Localisation/LO005.user.md +++ /dev/null @@ -1,14 +0,0 @@ -# Change System Hostname -**Command:** -~~~ -armbian-config --cmd LO005 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - diff --git a/docs/Localisation/Localisation.user.md b/docs/Localisation/Localisation.user.md deleted file mode 100644 index def3e1a6..00000000 --- a/docs/Localisation/Localisation.user.md +++ /dev/null @@ -1,61 +0,0 @@ -# Localisation - - -*** - -## Change Global timezone -**Command:** -~~~ -armbian-config --cmd LO001 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -## Change Locales reconfigure the language and character set -**Command:** -~~~ -armbian-config --cmd LO002 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -## Change Keyboard layout -**Command:** -~~~ -armbian-config --cmd LO003 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -## Change System Hostname -**Command:** -~~~ -armbian-config --cmd LO005 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - diff --git a/docs/Network/NE001.user.md b/docs/Network/NE001.user.md deleted file mode 100644 index e8289c11..00000000 --- a/docs/Network/NE001.user.md +++ /dev/null @@ -1,61 +0,0 @@ -# Configure network interfaces - - -*** - -## Add / change interface -**Command:** -~~~ -armbian-config --cmd NE002 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Revert to Armbian defaults -**Command:** -~~~ -armbian-config --cmd NE003 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Show configuration -**Command:** -~~~ -armbian-config --cmd NE004 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Show active status -**Command:** -~~~ -armbian-config --cmd NE005 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/docs/Network/Network.user.md b/docs/Network/Network.user.md deleted file mode 100644 index 2993c0a3..00000000 --- a/docs/Network/Network.user.md +++ /dev/null @@ -1,66 +0,0 @@ -# Fixed and wireless network settings - - -*** - -## Configure network interfaces - - -*** - -### Add / change interface -**Command:** -~~~ -armbian-config --cmd NE002 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Revert to Armbian defaults -**Command:** -~~~ -armbian-config --cmd NE003 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Show configuration -**Command:** -~~~ -armbian-config --cmd NE004 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Show active status -**Command:** -~~~ -armbian-config --cmd NE005 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/docs/Software/Benchy.user.md b/docs/Software/Benchy.user.md deleted file mode 100644 index dd044404..00000000 --- a/docs/Software/Benchy.user.md +++ /dev/null @@ -1,14 +0,0 @@ -# System benchmaking and diagnostics -**Command:** -~~~ -armbian-config --cmd Benchy -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - diff --git a/docs/Software/Containers.user.md b/docs/Software/Containers.user.md deleted file mode 100644 index 7a6de864..00000000 --- a/docs/Software/Containers.user.md +++ /dev/null @@ -1,79 +0,0 @@ -# Containerlization and Virtual Machines - - -*** - -## Install Docker Minimal - - -[![Install Docker Minimal](/images/CON001.webp)](#) - - -This operation will install Docker Minimal. - -**Command:** -~~~ -armbian-config --cmd CON001 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -What is Docker?Accelerate how you build, share, and run applicationsDocker helps developers build, share, run, and verify applications anywhere — without tedious environment configuration or management. - - - - -*** - -## Install Docker Engine -This operation will install Docker Engine. - -**Command:** -~~~ -armbian-config --cmd CON002 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - -## Remove Docker -This operation will purge Docker. - -**Command:** -~~~ -armbian-config --cmd CON003 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - -## Purge all Docker images, containers, and volumes -This operation will delete all Docker images, containers, and volumes. - -**Command:** -~~~ -armbian-config --cmd CON004 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - diff --git a/docs/Software/Desktops.user.md b/docs/Software/Desktops.user.md deleted file mode 100644 index 5aa3dfd1..00000000 --- a/docs/Software/Desktops.user.md +++ /dev/null @@ -1,215 +0,0 @@ -# Desktop Environments - - -*** - -## XFCE desktop - - -*** - -### XFCE desktop Install -Install XFCE: -Xfce is a lightweight desktop environment for UNIX-like operating systems. It aims to be fast and low on system resources, while still being visually appealing and user friendly. - -**Command:** -~~~ -armbian-config --cmd XFCE01 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Uninstall -**Command:** -~~~ -armbian-config --cmd XFCE02 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Enable autologin -**Command:** -~~~ -armbian-config --cmd XFCE03 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Disable autologin -**Command:** -~~~ -armbian-config --cmd XFCE04 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Gnome desktop - - -*** - -### Gnome desktop Install -**Command:** -~~~ -armbian-config --cmd GNOME01 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Uninstall -**Command:** -~~~ -armbian-config --cmd GNOME02 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Enable autologin -**Command:** -~~~ -armbian-config --cmd GNOME03 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Disable autologin -**Command:** -~~~ -armbian-config --cmd GNOME04 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Cinnamon desktop - - -*** - -### Cinnamon desktop Install - - -[![Cinnamon desktop Install](/images/CINNAMON01.png)](#) - - -**Command:** -~~~ -armbian-config --cmd CINNAMON01 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -Cinnamon is a Linux desktop that provides advanced innovative features and a traditional user experience.The desktop layout is similar to Gnome 2 with underlying technology forked from Gnome Shell. Cinnamon makes users feel at home with an easy-to-use and comfortable desktop experience. - - - - -*** - -### Cinnamon desktop uninstall -**Command:** -~~~ -armbian-config --cmd CINNAMON02 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Enable autologin -**Command:** -~~~ -armbian-config --cmd CINNAMON03 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Disable autologin -**Command:** -~~~ -armbian-config --cmd CINNAMON04 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Improve application search speed -**Command:** -~~~ -armbian-config --cmd Xapian -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/docs/Software/DevTools.user.md b/docs/Software/DevTools.user.md deleted file mode 100644 index 43d1d030..00000000 --- a/docs/Software/DevTools.user.md +++ /dev/null @@ -1,33 +0,0 @@ -# Development - - -*** - -## Install tools for cloning and managing repositories (git) -**Command:** -~~~ -armbian-config --cmd DEV001 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -## Remove tools for cloning and managing repositories (git) -**Command:** -~~~ -armbian-config --cmd DEV001 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - diff --git a/docs/Software/Management.user.md b/docs/Software/Management.user.md deleted file mode 100644 index b18fa3d8..00000000 --- a/docs/Software/Management.user.md +++ /dev/null @@ -1,76 +0,0 @@ -# Remote Management tools - - -*** - -## Install Cockpit web-based management tool - - -[![Install Cockpit web-based management tool](/images/MAN001.png)](#) - - -This operation will install Cockpit. -cockpit cockpit-ws cockpit-system cockpit-storaged - -**Command:** -~~~ -armbian-config --cmd MAN001 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -Introducing CockpitCockpit is a web-based graphical interface for servers, intended for everyone, especially those who are:- new to Linux(including Windows admins)- familiar with Linuxand want an easy, graphical way to administer servers- expert adminswho mainly use other tools but want an overview on individual systemsThanks to Cockpit intentionally using system APIs and commands, a whole team of admins can manage a system in the way they prefer, including the command line and utilities right alongside Cockpit. - - - - -*** - -## Purge Cockpit web-based management tool -This operation will purge Cockpit. - -**Command:** -~~~ -armbian-config --cmd MAN002 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - -## Start Cockpit Service -**Command:** -~~~ -armbian-config --cmd MAN003 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - -## Stop Cockpit Service -**Command:** -~~~ -armbian-config --cmd MAN004 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - diff --git a/docs/Software/Media.user.md b/docs/Software/Media.user.md deleted file mode 100644 index 7928c82e..00000000 --- a/docs/Software/Media.user.md +++ /dev/null @@ -1,69 +0,0 @@ -# Media Servers and Editors - - -*** - -## Install Plex Media server -This operation will install Plex Media server. - -**Command:** -~~~ -armbian-config --cmd MED001 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - -## Remove Plex Media server -This operation will purge Plex Media server. - -**Command:** -~~~ -armbian-config --cmd MED002 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - -## Install Emby server -This operation will install Emby server. - -**Command:** -~~~ -armbian-config --cmd MED003 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - -## Remove Emby server -This operation will purge Emby server. - -**Command:** -~~~ -armbian-config --cmd MED004 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - diff --git a/docs/Software/Netconfig.user.md b/docs/Software/Netconfig.user.md deleted file mode 100644 index 6d661a70..00000000 --- a/docs/Software/Netconfig.user.md +++ /dev/null @@ -1,117 +0,0 @@ -# Network tools - - -*** - -## Install realtime console network usage monitor (nload) -**Command:** -~~~ -armbian-config --cmd NET001 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -## Remove realtime console network usage monitor (nload) -**Command:** -~~~ -armbian-config --cmd NET002 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -## Install bandwidth measuring tool (iperf3) -**Command:** -~~~ -armbian-config --cmd NET003 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -## Remove bandwidth measuring tool (iperf3) -**Command:** -~~~ -armbian-config --cmd NET004 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -## Install IP LAN monitor (iptraf-ng) -**Command:** -~~~ -armbian-config --cmd NET005 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -## Remove IP LAN monitor (iptraf-ng) -**Command:** -~~~ -armbian-config --cmd NET006 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -## Install hostname broadcast via mDNS (avahi-daemon) -**Command:** -~~~ -armbian-config --cmd NET007 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -## Remove hostname broadcast via mDNS (avahi-daemon) -**Command:** -~~~ -armbian-config --cmd NET008 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - diff --git a/docs/Software/Software.user.md b/docs/Software/Software.user.md deleted file mode 100644 index 5ddd28de..00000000 --- a/docs/Software/Software.user.md +++ /dev/null @@ -1,608 +0,0 @@ -# Run/Install 3rd party applications - - -*** - -## Desktop Environments - - -*** - -### XFCE desktop - - -*** - -#### XFCE desktop Install -Install XFCE: -Xfce is a lightweight desktop environment for UNIX-like operating systems. It aims to be fast and low on system resources, while still being visually appealing and user friendly. - -**Command:** -~~~ -armbian-config --cmd XFCE01 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -#### Uninstall -**Command:** -~~~ -armbian-config --cmd XFCE02 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -#### Enable autologin -**Command:** -~~~ -armbian-config --cmd XFCE03 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -#### Disable autologin -**Command:** -~~~ -armbian-config --cmd XFCE04 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Gnome desktop - - -*** - -#### Gnome desktop Install -**Command:** -~~~ -armbian-config --cmd GNOME01 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -#### Uninstall -**Command:** -~~~ -armbian-config --cmd GNOME02 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -#### Enable autologin -**Command:** -~~~ -armbian-config --cmd GNOME03 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -#### Disable autologin -**Command:** -~~~ -armbian-config --cmd GNOME04 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Cinnamon desktop - - -*** - -#### Cinnamon desktop Install - - -[![Cinnamon desktop Install](/images/CINNAMON01.png)](#) - - -**Command:** -~~~ -armbian-config --cmd CINNAMON01 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -Cinnamon is a Linux desktop that provides advanced innovative features and a traditional user experience.The desktop layout is similar to Gnome 2 with underlying technology forked from Gnome Shell. Cinnamon makes users feel at home with an easy-to-use and comfortable desktop experience. - - - - -*** - -#### Cinnamon desktop uninstall -**Command:** -~~~ -armbian-config --cmd CINNAMON02 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -#### Enable autologin -**Command:** -~~~ -armbian-config --cmd CINNAMON03 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -#### Disable autologin -**Command:** -~~~ -armbian-config --cmd CINNAMON04 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Improve application search speed -**Command:** -~~~ -armbian-config --cmd Xapian -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Network tools - - -*** - -### Install realtime console network usage monitor (nload) -**Command:** -~~~ -armbian-config --cmd NET001 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -### Remove realtime console network usage monitor (nload) -**Command:** -~~~ -armbian-config --cmd NET002 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -### Install bandwidth measuring tool (iperf3) -**Command:** -~~~ -armbian-config --cmd NET003 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -### Remove bandwidth measuring tool (iperf3) -**Command:** -~~~ -armbian-config --cmd NET004 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -### Install IP LAN monitor (iptraf-ng) -**Command:** -~~~ -armbian-config --cmd NET005 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -### Remove IP LAN monitor (iptraf-ng) -**Command:** -~~~ -armbian-config --cmd NET006 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -### Install hostname broadcast via mDNS (avahi-daemon) -**Command:** -~~~ -armbian-config --cmd NET007 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -### Remove hostname broadcast via mDNS (avahi-daemon) -**Command:** -~~~ -armbian-config --cmd NET008 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -## Development - - -*** - -### Install tools for cloning and managing repositories (git) -**Command:** -~~~ -armbian-config --cmd DEV001 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -### Remove tools for cloning and managing repositories (git) -**Command:** -~~~ -armbian-config --cmd DEV001 -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -## System benchmaking and diagnostics -**Command:** -~~~ -armbian-config --cmd Benchy -~~~ - -**Author:** @armbian - -**Status:** Stable - - - -*** - -## Containerlization and Virtual Machines - - -*** - -### Install Docker Minimal - - -[![Install Docker Minimal](/images/CON001.webp)](#) - - -This operation will install Docker Minimal. - -**Command:** -~~~ -armbian-config --cmd CON001 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -What is Docker?Accelerate how you build, share, and run applicationsDocker helps developers build, share, run, and verify applications anywhere — without tedious environment configuration or management. - - - - -*** - -### Install Docker Engine -This operation will install Docker Engine. - -**Command:** -~~~ -armbian-config --cmd CON002 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - -### Remove Docker -This operation will purge Docker. - -**Command:** -~~~ -armbian-config --cmd CON003 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - -### Purge all Docker images, containers, and volumes -This operation will delete all Docker images, containers, and volumes. - -**Command:** -~~~ -armbian-config --cmd CON004 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - -## Media Servers and Editors - - -*** - -### Install Plex Media server -This operation will install Plex Media server. - -**Command:** -~~~ -armbian-config --cmd MED001 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - -### Remove Plex Media server -This operation will purge Plex Media server. - -**Command:** -~~~ -armbian-config --cmd MED002 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - -### Install Emby server -This operation will install Emby server. - -**Command:** -~~~ -armbian-config --cmd MED003 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - -### Remove Emby server -This operation will purge Emby server. - -**Command:** -~~~ -armbian-config --cmd MED004 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - -## Remote Management tools - - -*** - -### Install Cockpit web-based management tool - - -[![Install Cockpit web-based management tool](/images/MAN001.png)](#) - - -This operation will install Cockpit. -cockpit cockpit-ws cockpit-system cockpit-storaged - -**Command:** -~~~ -armbian-config --cmd MAN001 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -Introducing CockpitCockpit is a web-based graphical interface for servers, intended for everyone, especially those who are:- new to Linux(including Windows admins)- familiar with Linuxand want an easy, graphical way to administer servers- expert adminswho mainly use other tools but want an overview on individual systemsThanks to Cockpit intentionally using system APIs and commands, a whole team of admins can manage a system in the way they prefer, including the command line and utilities right alongside Cockpit. - - - - -*** - -### Purge Cockpit web-based management tool -This operation will purge Cockpit. - -**Command:** -~~~ -armbian-config --cmd MAN002 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - -### Start Cockpit Service -**Command:** -~~~ -armbian-config --cmd MAN003 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - -### Stop Cockpit Service -**Command:** -~~~ -armbian-config --cmd MAN004 -~~~ - -**Author:** @schwar3kat - -**Status:** Stable - - - -*** - diff --git a/docs/System/SY001.user.md b/docs/System/SY001.user.md deleted file mode 100644 index b9cdd52f..00000000 --- a/docs/System/SY001.user.md +++ /dev/null @@ -1,16 +0,0 @@ -# Enable Armbian firmware upgrades -This will enable Armbian kernel upgrades that are currently put on hold. - -**Command:** -~~~ -armbian-config --cmd SY001 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/docs/System/SY002.user.md b/docs/System/SY002.user.md deleted file mode 100644 index 18bdcf90..00000000 --- a/docs/System/SY002.user.md +++ /dev/null @@ -1,16 +0,0 @@ -# Disable Armbian kernel upgrades -Disable Armbian kernel/firmware upgrades - -**Command:** -~~~ -armbian-config --cmd SY002 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/docs/System/SY003.user.md b/docs/System/SY003.user.md deleted file mode 100644 index 0b8b3df2..00000000 --- a/docs/System/SY003.user.md +++ /dev/null @@ -1,19 +0,0 @@ -# Edit the boot environment -This will open /boot/armbianEnv.txt file to edit -CTRL+S to save -CTLR+X to exit -would you like to continue? - -**Command:** -~~~ -armbian-config --cmd SY003 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/docs/System/SY004.user.md b/docs/System/SY004.user.md deleted file mode 100644 index 4536fb30..00000000 --- a/docs/System/SY004.user.md +++ /dev/null @@ -1,14 +0,0 @@ -# Install Linux headers -**Command:** -~~~ -armbian-config --cmd SY004 -~~~ - -**Author:** @Tearran - -**Status:** Preview - - - -*** - diff --git a/docs/System/SY005.user.md b/docs/System/SY005.user.md deleted file mode 100644 index eb7d1221..00000000 --- a/docs/System/SY005.user.md +++ /dev/null @@ -1,14 +0,0 @@ -# Remove Linux headers -**Command:** -~~~ -armbian-config --cmd SY005 -~~~ - -**Author:** @Tearran - -**Status:** Preview - - - -*** - diff --git a/docs/System/SY006.user.md b/docs/System/SY006.user.md deleted file mode 100644 index 2baa5c0b..00000000 --- a/docs/System/SY006.user.md +++ /dev/null @@ -1,14 +0,0 @@ -# Install to internal storage -**Command:** -~~~ -armbian-config --cmd SY006 -~~~ - -**Author:** @igorpecovnik - -**Status:** Preview - - - -*** - diff --git a/docs/System/SY007.user.md b/docs/System/SY007.user.md deleted file mode 100644 index 51fd81b2..00000000 --- a/docs/System/SY007.user.md +++ /dev/null @@ -1,173 +0,0 @@ -# Manage SSH login options - - -*** - -## Disable root login -**Command:** -~~~ -armbian-config --cmd SY101 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Enable root login -**Command:** -~~~ -armbian-config --cmd SY102 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Disable password login -**Command:** -~~~ -armbian-config --cmd SY103 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Enable password login -**Command:** -~~~ -armbian-config --cmd SY104 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Disable Public key authentication login -**Command:** -~~~ -armbian-config --cmd SY105 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Enable Public key authentication login -**Command:** -~~~ -armbian-config --cmd SY106 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Disable OTP authentication -**Command:** -~~~ -armbian-config --cmd SY107 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Enable OTP authentication -**Command:** -~~~ -armbian-config --cmd SY108 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Generate new OTP authentication QR code -**Command:** -~~~ -armbian-config --cmd SY109 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Show OTP authentication QR code -**Command:** -~~~ -armbian-config --cmd SY110 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Disable last login banner -**Command:** -~~~ -armbian-config --cmd SY111 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Enable last login banner -**Command:** -~~~ -armbian-config --cmd SY112 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/docs/System/SY008.user.md b/docs/System/SY008.user.md deleted file mode 100644 index f1a05e6e..00000000 --- a/docs/System/SY008.user.md +++ /dev/null @@ -1,16 +0,0 @@ -# Change shell system wide to BASH -This will switch system wide shell to BASH - -**Command:** -~~~ -armbian-config --cmd SY008 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/docs/System/SY009.user.md b/docs/System/SY009.user.md deleted file mode 100644 index 7bf0f22e..00000000 --- a/docs/System/SY009.user.md +++ /dev/null @@ -1,16 +0,0 @@ -# Change shell system wide to ZSH -This will switch system wide shell to ZSH - -**Command:** -~~~ -armbian-config --cmd SY009 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/docs/System/SY010.user.md b/docs/System/SY010.user.md deleted file mode 100644 index 01836c80..00000000 --- a/docs/System/SY010.user.md +++ /dev/null @@ -1,16 +0,0 @@ -# Switch to rolling release -This will switch OS to rolling releases. - -**Command:** -~~~ -armbian-config --cmd SY010 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/docs/System/SY011.user.md b/docs/System/SY011.user.md deleted file mode 100644 index 7544db73..00000000 --- a/docs/System/SY011.user.md +++ /dev/null @@ -1,16 +0,0 @@ -# Switch to stable release -This will switch OS to stable releases - -**Command:** -~~~ -armbian-config --cmd SY011 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/docs/System/SY012.user.md b/docs/System/SY012.user.md deleted file mode 100644 index 4edda59c..00000000 --- a/docs/System/SY012.user.md +++ /dev/null @@ -1,17 +0,0 @@ -# Enable read only filesystem -This will enable Armbian read-only filesystem. Reboot is mandatory? - - -**Command:** -~~~ -armbian-config --cmd SY012 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/docs/System/SY013.user.md b/docs/System/SY013.user.md deleted file mode 100644 index 1b3010fc..00000000 --- a/docs/System/SY013.user.md +++ /dev/null @@ -1,17 +0,0 @@ -# Disable read only filesystem -This will disable Armbian read-only filesystem. Reboot is mandatory? - - -**Command:** -~~~ -armbian-config --cmd SY013 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/docs/System/SY014.user.md b/docs/System/SY014.user.md deleted file mode 100644 index 41013bc3..00000000 --- a/docs/System/SY014.user.md +++ /dev/null @@ -1,14 +0,0 @@ -# Adjust welcome screen (motd) -**Command:** -~~~ -armbian-config --cmd SY014 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/docs/System/SY015.user.md b/docs/System/SY015.user.md deleted file mode 100644 index 4bfe4f3a..00000000 --- a/docs/System/SY015.user.md +++ /dev/null @@ -1,18 +0,0 @@ -# Install alternative kernels -Switching between kernels might change functionality of your device. - -It might fail to boot! - -**Command:** -~~~ -armbian-config --cmd SY015 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/docs/System/SY016.user.md b/docs/System/SY016.user.md deleted file mode 100644 index 0f2a050d..00000000 --- a/docs/System/SY016.user.md +++ /dev/null @@ -1,41 +0,0 @@ -# Distribution upgrades - - -*** - -## Upgrade to latest stable / LTS -Release upgrade is irriversible operation which upgrades all packages. - -Resoulted upgrade might break your build beyond repair! - -**Command:** -~~~ -armbian-config --cmd SY101 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Upgrade to rolling unstable -Release upgrade is irriversible operation which upgrades all packages. - -Resoulted upgrade might break your build beyond repair! - -**Command:** -~~~ -armbian-config --cmd SY102 -~~~ - -**Author:** @igorpecovnik - -**Status:** Active - - - -*** - diff --git a/docs/System/SY017.user.md b/docs/System/SY017.user.md deleted file mode 100644 index b62fd52c..00000000 --- a/docs/System/SY017.user.md +++ /dev/null @@ -1,14 +0,0 @@ -# Manage device tree overlays -**Command:** -~~~ -armbian-config --cmd SY017 -~~~ - -**Author:** @viraniac @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/docs/System/System.user.md b/docs/System/System.user.md deleted file mode 100644 index 079763ed..00000000 --- a/docs/System/System.user.md +++ /dev/null @@ -1,456 +0,0 @@ -# System wide and admin settings - - -*** - -## Enable Armbian firmware upgrades -This will enable Armbian kernel upgrades that are currently put on hold. - -**Command:** -~~~ -armbian-config --cmd SY001 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Disable Armbian kernel upgrades -Disable Armbian kernel/firmware upgrades - -**Command:** -~~~ -armbian-config --cmd SY002 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Edit the boot environment -This will open /boot/armbianEnv.txt file to edit -CTRL+S to save -CTLR+X to exit -would you like to continue? - -**Command:** -~~~ -armbian-config --cmd SY003 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Install Linux headers -**Command:** -~~~ -armbian-config --cmd SY004 -~~~ - -**Author:** @Tearran - -**Status:** Preview - - - -*** - -## Remove Linux headers -**Command:** -~~~ -armbian-config --cmd SY005 -~~~ - -**Author:** @Tearran - -**Status:** Preview - - - -*** - -## Install to internal storage -**Command:** -~~~ -armbian-config --cmd SY006 -~~~ - -**Author:** @igorpecovnik - -**Status:** Preview - - - -*** - -## Manage SSH login options - - -*** - -### Disable root login -**Command:** -~~~ -armbian-config --cmd SY101 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Enable root login -**Command:** -~~~ -armbian-config --cmd SY102 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Disable password login -**Command:** -~~~ -armbian-config --cmd SY103 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Enable password login -**Command:** -~~~ -armbian-config --cmd SY104 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Disable Public key authentication login -**Command:** -~~~ -armbian-config --cmd SY105 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Enable Public key authentication login -**Command:** -~~~ -armbian-config --cmd SY106 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Disable OTP authentication -**Command:** -~~~ -armbian-config --cmd SY107 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Enable OTP authentication -**Command:** -~~~ -armbian-config --cmd SY108 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Generate new OTP authentication QR code -**Command:** -~~~ -armbian-config --cmd SY109 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Show OTP authentication QR code -**Command:** -~~~ -armbian-config --cmd SY110 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Disable last login banner -**Command:** -~~~ -armbian-config --cmd SY111 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Enable last login banner -**Command:** -~~~ -armbian-config --cmd SY112 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Change shell system wide to BASH -This will switch system wide shell to BASH - -**Command:** -~~~ -armbian-config --cmd SY008 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Change shell system wide to ZSH -This will switch system wide shell to ZSH - -**Command:** -~~~ -armbian-config --cmd SY009 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Switch to rolling release -This will switch OS to rolling releases. - -**Command:** -~~~ -armbian-config --cmd SY010 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Switch to stable release -This will switch OS to stable releases - -**Command:** -~~~ -armbian-config --cmd SY011 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Enable read only filesystem -This will enable Armbian read-only filesystem. Reboot is mandatory? - - -**Command:** -~~~ -armbian-config --cmd SY012 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Disable read only filesystem -This will disable Armbian read-only filesystem. Reboot is mandatory? - - -**Command:** -~~~ -armbian-config --cmd SY013 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Adjust welcome screen (motd) -**Command:** -~~~ -armbian-config --cmd SY014 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Install alternative kernels -Switching between kernels might change functionality of your device. - -It might fail to boot! - -**Command:** -~~~ -armbian-config --cmd SY015 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -## Distribution upgrades - - -*** - -### Upgrade to latest stable / LTS -Release upgrade is irriversible operation which upgrades all packages. - -Resoulted upgrade might break your build beyond repair! - -**Command:** -~~~ -armbian-config --cmd SY101 -~~~ - -**Author:** @igorpecovnik - -**Status:** Stable - - - -*** - -### Upgrade to rolling unstable -Release upgrade is irriversible operation which upgrades all packages. - -Resoulted upgrade might break your build beyond repair! - -**Command:** -~~~ -armbian-config --cmd SY102 -~~~ - -**Author:** @igorpecovnik - -**Status:** Active - - - -*** - -## Manage device tree overlays -**Command:** -~~~ -armbian-config --cmd SY017 -~~~ - -**Author:** @viraniac @igorpecovnik - -**Status:** Stable - - - -*** - diff --git a/lib/armbian-config/config.docs.sh b/lib/armbian-config/config.docs.sh deleted file mode 100644 index 4385a522..00000000 --- a/lib/armbian-config/config.docs.sh +++ /dev/null @@ -1,568 +0,0 @@ -#!/bin/bash - -# This file is part of Armbian configuration utility. - -module_options+=( - ["generate_readme,author"]="@Tearran" - ["generate_readme,ref_link"]="" - ["generate_readme,feature"]="generate_readme" - ["generate_readme,desc"]="Generate Document files." - ["generate_readme,example"]="generate_readme" - ["generate_readme,status"]="review" -) -# -# Function to generate the README.md file -# -function generate_readme() { - - # Get the current date - local current_date=$(date) - # setup doc folders - #mkdir -p "$script_dir/../share/doc/armbian-config" - - echo -e "Sorting data\nUpdating documentation" # current_date ; - - cat << EOF > "$script_dir/../DOCUMENTATION.md" - -# Armbian Configuration Utility - - - -Utility for configuring your board, adjusting services, and installing applications. It comes with Armbian by default. - -To start the Armbian configuration utility, use the following command: -~~~ -sudo armbian-config -~~~ - -$(see_full_list) - -## Install -Armbian installation -~~~ -sudo apt install armbian-config -~~~ - -3rd party Debian based distributions -~~~ -{ - sudo wget https://apt.armbian.com/armbian.key -O key - sudo gpg --dearmor < key | sudo tee /usr/share/keyrings/armbian.gpg > /dev/null - sudo chmod go+r /usr/share/keyrings/armbian.gpg - sudo echo "deb [arch=\$(dpkg --print-architecture) signed-by=/usr/share/keyrings/armbian.gpg] http://apt.armbian.com \$(lsb_release -cs) main \$(lsb_release -cs)-utils \$(lsb_release -cs)-desktop" | sudo tee /etc/apt/sources.list.d/armbian.list - sudo apt update - sudo apt install armbian-config -} -~~~ - -*** - -## CLI options -Command line options. - -Use: -~~~ -armbian-config --help -~~~ - -Outputs: -~~~ -$(see_cmd_list) -~~~ - -## Legacy options -Backward Compatible options. - -Use: -~~~ -armbian-config main=Help -~~~ - -Outputs: -~~~ -$(see_cli_legacy) -~~~ - -*** - -## Development - -Development is divided into three sections: - -Click for more info: - -
-Jobs / JSON Object - -A list of the jobs defined in the Jobs file. -~~~ -$(see_jq_menu_list) -~~~ -
- - -
-Jobs API / Helper Functions - -These helper functions facilitate various operations related to job management, such as creation, updating, deletion, and listing of jobs, acting as a practical API for developers. - -$(see_function_table_md) - - -
- - -
-Runtime / Board Statuses - -(WIP) - -This section outlines the runtime environment to check configurations and statuses for dynamically managing jobs based on JSON data. - -(WIP) - -
- - -## Testing and contributing - -
-Get Development - -Install the dependencies: -~~~ -sudo apt install git jq whiptail -~~~ - -Get Development and contribute: -~~~ -{ -git clone https://github.com/armbian/configng -cd configng -./armbian-config --help -} -~~~ - -Install and test Development deb: -~~~ -{ - sudo apt install whiptail - latest_release=\$(curl -s https://api.github.com/repos/armbian/configng/releases/latest) - deb_url=\$(echo "\$latest_release" | jq -r '.assets[] | select(.name | endswith(".deb")) | .browser_download_url') - curl -LO "\$deb_url" - deb_file=\$(echo "\$deb_url" | awk -F"/" '{print \$NF}') - sudo dpkg -i "\$deb_file" - sudo dpkg --configure -a - sudo apt --fix-broken install -} -~~~ - -
- -EOF - -} - -module_options+=( - ["serve_doc,author"]="@Tearran" - ["serve_doc,ref_link"]="" - ["serve_doc,feature"]="serve_doc" - ["serve_doc,desc"]="Serve the edit and debug server." - ["serve_doc,example"]="serve_doc" - ["serve_doc,status"]="active" - ["serve_doc,doc_link"]="" -) -# -# Function to serve the edit and debug server -# -function serve_doc() { - if [[ "$(id -u)" == "0" ]]; then - echo "Red alert! not for sudo user" - exit 1 - fi - if [[ -z $CODESPACES ]]; then - # Start the Python server in the background - python3 -m http.server > /tmp/config.log 2>&1 & - local server_pid=$! - local input=(" - Starting server... - Server PID: $server_pid - - Press [Enter] to exit" - ) - - $DIALOG --title "Message Box" --msgbox "$input" 0 0 - - # Stop the server - kill "$server_pid" - else - echo "Info:GitHub Codespace" - exit 0 - fi -} - -module_options+=( - ["see_use,author"]="@Tearran" - ["see_use,ref_link"]="" - ["see_use,feature"]="see_use" - ["see_use,desc"]="Show the usage of the functions." - ["see_use,example"]="see_use" - ["see_use,status"]="review" - ["see_use,doc_link"]="" -) -# -# Function to parse the key-pairs (WIP) -# -function see_use() { - mod_message="Usage: \n\n" - # Iterate over the options - for key in "${!module_options[@]}"; do - # Split the key into function_name and type - IFS=',' read -r function_name type <<< "$key" - # If the type is 'long', append the option to the help message - if [[ "$type" == "feature" ]]; then - mod_message+="${module_options["$function_name,feature"]} - ${module_options["$function_name,desc"]}\n" - mod_message+=" ${module_options["$function_name,example"]}\n\n" - fi - done - - echo -e "$mod_message" -} - -module_options+=( - ["generate_json_options,author"]="@Tearran" - ["generate_json_options,ref_link"]="" - ["generate_json_options,feature"]="generate_json" - ["generate_json_options,desc"]="Generate JSON-like object file." - ["generate_json_options,example"]="generate_json" - ["generate_json_options,status"]="review" - ["generate_json_options,doc_link"]="" -) -# -# Function to generate a JSON-like object file -# -function generate_json_options() { - echo -e "{\n\"configng-helpers\" : [" - features=() - for key in "${!module_options[@]}"; do - if [[ $key == *",feature" ]]; then - features+=("${module_options[$key]}") - fi - done - - for index in "${!features[@]}"; do - feature=${features[$index]} - desc_key="${feature},desc" - example_key="${feature},example" - author_key="${feature},author" - ref_key="${feature},ref_link" - status_key="${feature},status" - doc_key="${feature},doc_link" - author="${module_options[$author_key]}" - ref_link="${module_options[$ref_key]}" - status="${module_options[$status_key]}" - doc_link="${module_options[$doc_key]}" - desc="${module_options[$desc_key]}" - example="${module_options[$example_key]}" - echo " {" - echo " \"id\": \"$feature\"," - echo " \"Author\": \"$author\"," - echo " \"src_reference\": \"$ref_link\"," - echo " \"description\": \"$desc\"," - echo " \"command\": [ \"$example\" ]", - echo " \"status\": \"$status\"," - echo " \"doc_link\": \"$doc_link\"" - if [ $index -ne $((${#features[@]} - 1)) ]; then - echo " }," - else - echo " }" - fi - done - echo "]" - echo "}" -} - -module_options+=( - ["generate_svg,author"]="@Tearran" - ["generate_svg,ref_link"]="" - ["generate_svg,feature"]="generate_svg" - ["generate_svg,desc"]="Generate 'Armbian CPU logo' SVG for document file." - ["generate_svg,example"]="generate_svg" - ["generate_svg,status"]="review" - ["generate_svg,doc_link"]="" -) -# -# This function is used to generate a armbian CPU logo -# -function generate_svg() { - - cat << EOF - - - - - - -EOF - -} - -module_options+=( - ["generate_jobs_from_json,author"]="@Tearran" - ["generate_jobs_from_json,ref_link"]="" - ["generate_jobs_from_json,feature"]="generate_jobs_from_json" - ["generate_jobs_from_json,desc"]="Generate jobs from JSON file." - ["generate_jobs_from_json,example"]="generate_jobs_from_json" - ["generate_jobs_from_json,status"]="review" - ["generate_jobs_from_json,doc_link"]="" -) -# -# This function is used to generate jobs links Table from JSON file. -# -function see_jobs_from_json_md() { - - echo -e "\n" - - # Use jq to parse the JSON - menu_items=$(jq -r '.menu | length' "$json_file") - - for ((i = 0; i < $menu_items; i++)); do - cat=$(jq -r ".menu[$i].id" "$json_file") - description=$(jq -r ".menu[$i].description" "$json_file") - #echo -e "## $cat\n" - #echo -e "$description\n" - echo -e "| "$cat" | ID | Description | Documents | Status |" - echo -e "|:------ | :-- | :---------- | --------: | ------:|" - - sub_items=$(jq -r ".menu[$i].sub | length" "$json_file") - - for ((j = 0; j < $sub_items; j++)); do - id=$(jq -r ".menu[$i].sub[$j].id" "$json_file") - id_link=$(jq -r ".menu[$i].sub[$j].id" "$json_file" | tr '[:upper:]' '[:lower:]') - description=$(jq -r ".menu[$i].sub[$j].description" "$json_file") - command=$(jq -r ".menu[$i].sub[$j].command" "$json_file") - status=$(jq -r ".menu[$i].sub[$j].status" "$json_file") - doc_link=$(jq -r ".menu[$i].sub[$j].doc_link" "$json_file") - - # Check if src_reference and doc_link are null - [ -z "$doc_link" ] && doc_link="#$id_link" || doc_link="[Document]($doc_link)" - - echo -e "| | $id | $description | $doc_link | $status |" - - done - echo -e "\n" - done - -} - - - -function see_full_list() { - # Use jq to parse the JSON into markdown - menu_items=$(echo "$json_data" | jq -r '.menu | length') - - for ((i = 0; i < menu_items; i++)); do - cat=$(jq -r ".menu[$i].id" "$json_file") - description=$(jq -r ".menu[$i].description" "$json_file") - - echo -e "- ## **$cat** \n" - - sub_items=$(jq -r ".menu[$i].sub | length" "$json_file") - - for ((j = 0; j < sub_items; j++)); do - id=$(jq -r ".menu[$i].sub[$j].id" "$json_file") - sub_description=$(jq -r ".menu[$i].sub[$j].description" "$json_file") - - echo -e " - ### $sub_description" - - # Handle nested sub-items - nested_sub_items=$(jq -r ".menu[$i].sub[$j].sub | length" "$json_file") - - # Check if nested sub-items are present - if [ "$nested_sub_items" -gt 0 ]; then - for ((k = 0; k < nested_sub_items; k++)); do - nested_id=$(jq -r ".menu[$i].sub[$j].sub[$k].id" "$json_file") - nested_description=$(jq -r ".menu[$i].sub[$j].sub[$k].description" "$json_file") - - echo -e " - ### $nested_description" - done - fi - - echo -e "\n" - done - echo -e "\n" - done -} - -module_options+=( - ["see_function_table_md,author"]="@Tearran" - ["see_function_table_md,ref_link"]="" - ["see_function_table_md,feature"]="see_function_table_md" - ["see_function_table_md,desc"]="Generate this markdown table of all module_options" - ["see_function_table_md,example"]="see_function_table_md" - ["see_function_table_md,status"]="review" - ["see_function_table_md,doc_link"]="" -) -# -# This function is used to generate a markdown table from the module_options array -# -function see_function_table_md() { - mod_message="| Description | Example | Credit |\n" - mod_message+="|:----------- | ------- |:------:|\n" - # Iterate over the options - for key in "${!module_options[@]}"; do - # Split the key into function_name and type - IFS=',' read -r function_name type <<< "$key" - # If the type is 'feature', append the option to the help message - if [[ "$type" == "feature" ]]; then - status=${module_options["$function_name,status"]} - ref_link=${module_options["$function_name,ref_link"]} - doc_link=${module_options["$function_name,doc_link"]} - ref_link_md=$([[ -n "$ref_link" ]] && echo "[Source]($ref_link)" || echo "X") - doc_link_md=$([[ -n "$doc_link" ]] && echo "[Document]($doc_link)" || echo "X") - status_md=$([[ -z "$ref_link" ]] && echo "source link Needed" || ([[ (-n "$ref_link" && -n "$doc_link") ]] && echo "Review" || echo "$status")) - mod_message+="| ${module_options["$function_name,desc"]} | ${module_options["$function_name,example"]} | ${module_options["$function_name,author"]} \n" - fi - done - - echo -e "$mod_message" -} - -module_options+=( - ["see_jq_menu_list,author"]="@Tearran" - ["see_jq_menu_list,ref_link"]="" - ["see_jq_menu_list,feature"]="see_jq_menu_list" - ["see_jq_menu_list,desc"]="Generate a markdown list json objects using jq." - ["see_jq_menu_list,example"]="see_jq_menu_list" - ["see_jq_menu_list,status"]="review" - ["see_jq_menu_list,doc_link"]="" -) -# -# This function is used to generate a markdown list from the json object using jq. -# -function see_jq_menu_list() { - jq -r ' - .menu[] | - .sub[] | - "### " + .id + "\n\n" + - (.description // "No description available") + "\n\nJobs:\n\n~~~\n" + - ((.command // ["No commands available"]) | join("\n")) + - "\n~~~\n" -' $json_file -} - -module_options+=( - ["see_cmd_list,author"]="@Tearran" - ["see_cmd_list,ref_link"]="" - ["see_cmd_list,feature"]="see_cmd_list" - ["see_cmd_list,desc"]="Generate a Help message for cli commands." - ["see_cmd_list,example"]="see_cmd_list [catagory]" - ["see_cmd_list,status"]="review" - ["see_cmd_list,doc_link"]="" -) -# -# See command options -# -see_cmd_list() { - local help_menu="$1" - - if [[ -n "$help_menu" && "$help_menu" != "cmd" ]]; then - echo "$json_data" | jq -r --arg menu "$help_menu" ' - def recurse_menu(menu; level): - menu | .id as $id | .description as $desc | - if has("sub") then - if level == 0 then - "\n \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) - elif level == 1 then - " \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) - else - " \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) - end - else - if level == 0 then - " --cmd \($id) - \($desc)" - elif level == 1 then - " --cmd \($id) - \($desc)" - else - "\t--cmd \($id) - \($desc)" - end - end; - - # Find the correct menu if $menu is passed, otherwise show all - if $menu == "" then - .menu | map(recurse_menu(. ; 0)) | join("\n") - else - .menu | map(select(.id == $menu) | recurse_menu(. ; 0)) | join("\n") - end - ' - elif [[ -z "$1" || "$1" == "cmd" ]]; then - echo "$json_data" | jq -r --arg menu "$help_menu" ' - def recurse_menu(menu; level): - menu | .id as $id | .description as $desc | - if has("sub") then - if level == 0 then - "\n \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) - elif level == 1 then - " \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) - else - " \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) - end - else - if level == 0 then - " --cmd \($id) - \($desc)" - elif level == 1 then - " --cmd \($id) - \($desc)" - else - "\t--cmd \($id) - \($desc)" - end - end; - .menu | map(recurse_menu(. ; 0)) | join("\n") - ' - - else - echo "nope" - fi -} - - -module_options+=( - ["see_cli_legacy,author"]="@Tearran" - ["see_cli_legacy,ref_link"]="" - ["see_cli_legacy,feature"]="see_cli_legacy" - ["see_cli_legacy,desc"]="Generate a Help message legacy cli commands." - ["see_cli_legacy,example"]="see_cli_legacy" - ["see_cli_legacy,status"]="review" - ["see_cli_legacy,doc_link"]="" -) -function see_cli_legacy() { - local script_name=$(basename "$0") - cat << EOF -Legacy Options (Backward Compatible) -Please use 'armbian-config --help' for more information. - -Usage: $script_name main=[arguments] selection=[options] - -EOF - -cat << EOF - $script_name main=System selection=Headers - Install headers: - $script_name main=System selection=Headers_remove - Remove headers: -EOF - - # TODO Migrate following features - - # $script_name main=System selection=Firmware - Update, upgrade and reboot: - # $script_name main=System selection=Nightly - Switch to nightly builds: - # $script_name main=System selection=Stable - Switch to stable builds: - # $script_name main=System selection=Default - Install default desktop: - # $script_name main=System selection=ZSH - Change to ZSH: - # $script_name main=System selection=BASH - Change to BASH: - # $script_name main=System selection=Stable - Change to stable repository [branch=dev]: - # $script_name main=System selection=Nightly - Change to nightly repository [branch=dev]: - # $script_name main=Software selection=Source_install - Install kernel source: - # $script_name main=Software selection=Source_remove - Remove kernel source: - # $script_name main=Software selection=Avahi - Install Avahi mDNS/DNS-SD daemon: - -} - - diff --git a/lib/armbian-config/config.functions.sh b/lib/armbian-config/config.functions.sh deleted file mode 100644 index 20004bb6..00000000 --- a/lib/armbian-config/config.functions.sh +++ /dev/null @@ -1,633 +0,0 @@ - -module_options+=( - ["check_desktop,author"]="@armbian" - ["check_desktop,ref_link"]="" - ["check_desktop,feature"]="check_desktop" - ["check_desktop,desc"]="Migrated procedures from Armbian config." - ["check_desktop,example"]="check_desktop" - ["check_desktop,status"]="Active" - ["check_desktop,doc_link"]="" -) -# -# read desktop parameters -# -function check_desktop() { - - DISPLAY_MANAGER="" - DESKTOP_INSTALLED="" - check_if_installed nodm && DESKTOP_INSTALLED="nodm" - check_if_installed lightdm && DESKTOP_INSTALLED="lightdm" - check_if_installed lightdm && DESKTOP_INSTALLED="gnome" - [[ -n $(service lightdm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="lightdm" - [[ -n $(service nodm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="nodm" - [[ -n $(service gdm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="gdm" - -} - - -# Start of config ng interface - -module_options+=( - ["set_colors,author"]="@Tearran" - ["set_colors,ref_link"]="" - ["set_colors,feature"]="set_colors" - ["set_colors,desc"]="Change the background color of the terminal or dialog box" - ["set_colors,example"]="set_colors 0-7" - ["set_colors,doc_link"]="" - ["set_colors,status"]="Active" -) -# -# Function to set the tui colors -# -function set_colors() { - local color_code=$1 - - if [ "$DIALOG" = "whiptail" ]; then - set_newt_colors "$color_code" - #echo "color code: $color_code" | show_infobox ; - elif [ "$DIALOG" = "dialog" ]; then - set_term_colors "$color_code" - else - echo "Invalid dialog type" - return 1 - fi -} - -# -# Function to set the colors for newt -# -function set_newt_colors() { - local color_code=$1 - case $color_code in - 0) color="black" ;; - 1) color="red" ;; - 2) color="green" ;; - 3) color="yellow" ;; - 4) color="blue" ;; - 5) color="magenta" ;; - 6) color="cyan" ;; - 7) color="white" ;; - 8) color="black" ;; - 9) color="red" ;; - *) return ;; - esac - export NEWT_COLORS="root=,$color" -} - -# -# Function to set the colors for terminal -# -function set_term_colors() { - local color_code=$1 - case $color_code in - 0) color="\e[40m" ;; # black - 1) color="\e[41m" ;; # red - 2) color="\e[42m" ;; # green - 3) color="\e[43m" ;; # yellow - 4) color="\e[44m" ;; # blue - 5) color="\e[45m" ;; # magenta - 6) color="\e[46m" ;; # cyan - 7) color="\e[47m" ;; # white - *) - echo "Invalid color code" - return 1 - ;; - esac - echo -e "$color" -} - -# -# Function to reset the colors -# -function reset_colors() { - echo -e "\e[0m" -} - -module_options+=( - ["parse_menu_items,author"]="@viraniac" - ["parse_menu_items,ref_link"]="" - ["parse_menu_items,feature"]="parse_menu_items" - ["parse_menu_items,desc"]="Parse json to get list of desired menu or submenu items" - ["parse_menu_items,example"]="parse_menu_items 'menu_options_array'" - ["parse_menu_items,doc_link"]="" - ["parse_menu_items,status"]="Active" -) -# -# Function to parse the menu items -# -parse_menu_items() { - local -n options=$1 - while IFS= read -r id; do - IFS= read -r description - IFS= read -r condition - # If the condition field is not empty and not null, run the function specified in the condition - if [[ -n $condition && $condition != "null" ]]; then - # If the function returns a truthy value, add the menu item to the menu - if eval $condition; then - options+=("$id" " - $description") - fi - else - # If the condition field is empty or null, add the menu item to the menu - options+=("$id" " - $description ") - fi - done < <(echo "$json_data" | jq -r '.menu[] | '${parent_id:+".. | objects | select(.id==\"$parent_id\") | .sub[]? |"}' select(.status != "Disabled") | "\(.id)\n\(.description)\n\(.condition)"' || exit 1) -} - -module_options+=( - ["generate_top_menu,author"]="@Tearran" - ["generate_top_menu,ref_link"]="" - ["generate_top_menu,feature"]="generate_top_menu" - ["generate_top_menu,desc"]="Build the main menu from a object" - ["generate_top_menu,example"]="generate_top_menu 'json_data'" - ["generate_top_menu,status"]="Active" -) -# -# Function to generate the main menu from a JSON object -# -generate_top_menu() { - local json_data="$1" - local status="$ARMBIAN $KERNELID ($DISTRO $DISTROID)" - local backtitle="$BACKTITLE" - - - while true; do - local menu_options=() - - parse_menu_items menu_options - - local OPTION=$($DIALOG --backtitle "$backtitle" --title "$TITLE" --menu "$status" 0 80 9 "${menu_options[@]}" \ - --ok-button Select --cancel-button Exit 3>&1 1>&2 2>&3) - local exitstatus=$? - - if [ $exitstatus = 0 ]; then - [ -z "$OPTION" ] && break - [[ -n "$debug" ]] && echo "$OPTION" - generate_menu "$OPTION" - fi - done -} - -module_options+=( - ["generate_menu,author"]="@Tearran" - ["generate_menu,ref_link"]="" - ["generate_menu,feature"]="generate_menu" - ["generate_menu,desc"]="Generate a submenu from a parent_id" - ["generate_menu,example"]="generate_menu 'parent_id'" - ["generate_menu,status"]="Active" -) -# -# Function to generate the submenu -# -function generate_menu() { - local parent_id="$1" - local top_parent_id="$2" - local backtitle="$BACKTITLE" - local status="" - - while true; do - # Get the submenu options for the current parent_id - local submenu_options=() - parse_menu_items submenu_options - - local OPTION=$($DIALOG --backtitle "$BACKTITLE" --title "$top_parent_id $parent_id" --menu "$status" 0 80 9 "${submenu_options[@]}" \ - --ok-button Select --cancel-button Back 3>&1 1>&2 2>&3) - - local exitstatus=$? - - if [ $exitstatus = 0 ]; then - [ -z "$OPTION" ] && break - - # Check if the selected option has a submenu - local submenu_count=$(jq -r --arg id "$OPTION" '.menu[] | .. | objects | select(.id==$id) | .sub? | length' "$json_file") - submenu_count=${submenu_count:-0} # If submenu_count is null or empty, set it to 0 - if [ "$submenu_count" -gt 0 ]; then - # If it does, generate a new menu for the submenu - [[ -n "$debug" ]] && echo "$OPTION" - generate_menu "$OPTION" "$parent_id" - else - # If it doesn't, execute the command - [[ -n "$debug" ]] && echo "$OPTION" - execute_command "$OPTION" - fi - fi - done -} - -module_options+=( - ["execute_command,author"]="@Tearran" - ["execute_command,ref_link"]="" - ["execute_command,feature"]="execute_command" - ["execute_command,desc"]="Needed by generate_menu" - ["execute_command,example"]="execute_command 'id'" - ["execute_command,doc_link"]="" - ["execute_command,status"]="Active" -) -# -# Function to execute the command -# -function execute_command() { - local id=$1 - - # Extract commands - local commands=$(jq -r --arg id "$id" ' - .menu[] | - .. | - objects | - select(.id == $id) | - .command[]?' "$json_file") - - # Check if a about exists - local about=$(jq -r --arg id "$id" ' - .menu[] | - .. | - objects | - select(.id == $id) | - .about?' "$json_file") - - # If a about exists, display it and wait for user confirmation - if [[ "$about" != "null" && $INPUTMODE != "cmd" ]]; then - get_user_continue "$about\nWould you like to continue?" process_input - fi - - # Execute each command - for command in "${commands[@]}"; do - [[ -n "$debug" ]] && echo "$command" - eval "$command" - done -} - -module_options+=( - ["show_message,author"]="@Tearran" - ["show_message,ref_link"]="" - ["show_message,feature"]="show_message" - ["show_message,desc"]="Display a message box" - ["show_message,example"]="show_message <<< 'hello world' " - ["show_message,doc_link"]="" - ["show_message,status"]="Active" -) -# -# Function to display a message box -# -function show_message() { - # Read the input from the pipe - input=$(cat) - - # Display the "OK" message box with the input data - if [[ $DIALOG != "bash" ]]; then - $DIALOG --title "$TITLE" --msgbox "$input" 0 0 - else - echo -e "$input" - read -p -r "Press [Enter] to continue..." - fi -} - -module_options+=( - ["show_infobox,author"]="@Tearran" - ["show_infobox,ref_link"]="" - ["show_infobox,feature"]="show_infobox" - ["show_infobox,desc"]="pipeline strings to an infobox " - ["show_infobox,example"]="show_infobox <<< 'hello world' ; " - ["show_infobox,doc_link"]="" - ["show_infobox,status"]="Active" -) -# -# Function to display an infobox with a message -# -function show_infobox() { - export TERM=ansi - local input - local BACKTITLE="$BACKTITLE" - local -a buffer # Declare buffer as an array - if [ -p /dev/stdin ]; then - while IFS= read -r line; do - buffer+=("$line") # Add the line to the buffer - # If the buffer has more than 10 lines, remove the oldest line - if ((${#buffer[@]} > 18)); then - buffer=("${buffer[@]:1}") - fi - # Display the lines in the buffer in the infobox - - TERM=ansi $DIALOG --title "$TITLE" --infobox "$(printf "%s\n" "${buffer[@]}")" 16 90 - sleep 0.5 - done - else - - input="$1" - TERM=ansi $DIALOG --title "$TITLE" --infobox "$input" 6 80 - fi - echo -ne '\033[3J' # clear the screen -} - -module_options+=( - ["show_menu,author"]="@Tearran" - ["show_menu,ref_link"]="" - ["show_menu,feature"]="show_menu" - ["show_menu,desc"]="Display a menu from pipe" - ["show_menu,example"]="show_menu <<< armbianmonitor -h ; " - ["show_menu,doc_link"]="" - ["show_menu,status"]="Active" -) -# -# -# -show_menu() { - - # Get the input and convert it into an array of options - inpu_raw=$(cat) - # Remove the lines before -h - input=$(echo "$inpu_raw" | sed 's/-\([a-zA-Z]\)/\1/' | grep '^ [a-zA-Z] ' | grep -v '\[') - options=() - while read -r line; do - package=$(echo "$line" | awk '{print $1}') - description=$(echo "$line" | awk '{$1=""; print $0}' | sed 's/^ *//') - options+=("$package" "$description") - done <<< "$input" - - # Display the menu and get the user's choice - [[ $DIALOG != "bash" ]] && choice=$($DIALOG --title "$TITLE" --menu "Choose an option:" 0 0 9 "${options[@]}" 3>&1 1>&2 2>&3) - - # Check if the user made a choice - if [ $? -eq 0 ]; then - echo "$choice" - else - exit 0 - fi - -} - -module_options+=( - ["get_user_continue,author"]="@Tearran" - ["get_user_continue,ref_link"]="" - ["get_user_continue,feature"]="get_user_continue" - ["get_user_continue,desc"]="Display a Yes/No dialog box and process continue/exit" - ["get_user_continue,example"]="get_user_continue 'Do you wish to continue?' process_input" - ["get_user_continue,doc_link"]="" - ["get_user_continue,status"]="Active" -) -# -# Function to display a Yes/No dialog box -# -function get_user_continue() { - local message="$1" - local next_action="$2" - - if $($DIALOG --yesno "$message" 15 80 3>&1 1>&2 2>&3); then - $next_action - else - $next_action "No" - fi -} - -menu_options+=( - ["get_user_continue,author"]="@Tearran" - ["get_user_continue,ref_link"]="" - ["get_user_continue,feature"]="process_input" - ["get_user_continue,desc"]="used to process the user's choice paired with get_user_continue" - ["get_user_continue,example"]="get_user_continue 'Do you wish to continue?' process_input" - ["get_user_continue,status"]="Active" - ["get_user_continue,doc_link"]="" -) -# -# Function to process the user's choice paired with get_user_continue -# -function process_input() { - local input="$1" - if [ "$input" = "No" ]; then - # user canceled - echo "User canceled. exiting" - exit 0 - fi -} - -module_options+=( - ["get_user_continue_secure,author"]="@Tearran" - ["get_user_continue_secure,ref_link"]="" - ["get_user_continue_secure,feature"]="get_user_continue_secure" - ["get_user_continue_secure,desc"]="Secure version of get_user_continue" - ["get_user_continue_secure,example"]="get_user_continue_secure 'Do you wish to continue?' process_input" - ["get_user_continue_secure,doc_link"]="" - ["get_user_continue_secure,status"]="Active" -) -# -# Secure version of get_user_continue -# -function get_user_continue_secure() { - local message="$1" - local next_action="$2" - - # Define a list of allowed functions - local allowed_functions=("process_input" "other_function") - # Check if the next_action is in the list of allowed functions - found=0 - for func in "${allowed_functions[@]}"; do - if [[ "$func" == "$next_action" ]]; then - found=1 - break - fi - done - - if [[ "$found" -eq 1 ]]; then - if $($DIALOG --yesno "$message" 10 80 3>&1 1>&2 2>&3); then - $next_action - else - $next_action "No" - fi - else - echo "Error: Invalid function" - - exit 1 - fi -} - -module_options+=( - ["see_current_apt,author"]="@Tearran" - ["see_current_apt,ref_link"]="" - ["see_current_apt,feature"]="see_current_apt" - ["see_current_apt,desc"]="Check when apt list was last updated and suggest updating or update" - ["see_current_apt,example"]="see_current_apt or see_current_apt update" - ["see_current_apt,doc_link"]="" - ["see_current_apt,status"]="Active" -) -# -# Function to check when the package list was last updated -# -see_current_apt() { - # Number of seconds in a day - local update_apt="$1" - local day=86400 - local ten_minutes=600 - # Get the current date as a Unix timestamp - local now=$(date +%s) - - # Get the timestamp of the most recently updated file in /var/lib/apt/lists/ - local update=$(stat -c %Y /var/lib/apt/lists/* 2>/dev/null | sort -n | tail -1) - - # Check if the update timestamp was found - if [[ -z "$update" ]]; then - echo "No package lists found." - return 1 # No package lists exist - fi - - # Calculate the number of seconds since the last update - local elapsed=$((now - update)) - - # Check if any apt-related processes are running - if ps -C apt-get,apt,dpkg > /dev/null; then - echo "A package manager is currently running." - export running_pkg="true" - return 1 # The processes are running - else - export running_pkg="false" - fi - - # Check if the package list is up-to-date - if ((elapsed < ten_minutes)); then - [[ "$update_apt" != "update" ]] && echo "The package lists are up-to-date." - return 0 # The package lists are up-to-date - else - [[ "$update_apt" != "update" ]] && echo "Update the package lists." # Suggest updating - [[ "$update_apt" == "update" ]] && apt_install_wrapper apt-get update - return 0 # The package lists are not up-to-date - fi -} - - -module_options+=( - ["sanitize_input,author"]="@Tearran" - ["sanitize_input,ref_link"]="" - ["sanitize_input,feature"]="sanitize_input" - ["sanitize_input,desc"]="sanitize input cli" - ["sanitize_input,example"]="sanitize_input" - ["sanitize_input,status"]="Review" -) -# -# sanitize input cli -# -sanitize_input() { - local sanitized_input=() - for arg in "$@"; do - if [[ $arg =~ ^[a-zA-Z0-9_=]+$ ]]; then - sanitized_input+=("$arg") - else - echo "Invalid argument: $arg" - exit 1 - fi - done - echo "${sanitized_input[@]}" -} - - -module_options+=( - ["is_package_manager_running,author"]="@armbian" - ["is_package_manager_running,ref_link"]="" - ["is_package_manager_running,feature"]="is_package_manager_running" - ["is_package_manager_running,desc"]="Migrated procedures from Armbian config." - ["is_package_manager_running,example"]="is_package_manager_running" - ["is_package_manager_running,status"]="Active" -) -# -# check if package manager is doing something -# -function is_package_manager_running() { - - if ps -C apt-get,apt,dpkg > /dev/null; then - [[ -z $scripted ]] && echo -e "\nPackage manager is running in the background.\n\nCan't install dependencies. Try again later." | show_infobox - return 0 - else - return 1 - fi - -} - - -module_options+=( - ["set_runtime_variables,author"]="@igorpecovnik" - ["set_runtime_variables,ref_link"]="" - ["set_runtime_variables,feature"]="set_runtime_variables" - ["set_runtime_variables,desc"]="Run time variables Migrated procedures from Armbian config." - ["set_runtime_variables,example"]="set_runtime_variables" - ["set_runtime_variables,status"]="Active" -) -# -# gather info about the board and start with loading menu variables -# -function set_runtime_variables() { - - missing_dependencies=() - - # Check if whiptail is available and set DIALOG - if [[ -z "$DIALOG" ]]; then - missing_dependencies+=("whiptail") - fi - - # Check if jq is available - if ! [[ -x "$(command -v jq)" ]]; then - missing_dependencies+=("jq") - fi - - # If any dependencies are missing, print a combined message and exit - if [[ ${#missing_dependencies[@]} -ne 0 ]]; then - if is_package_manager_running; then - sudo apt install ${missing_dependencies[*]} - fi - fi - - # Determine which network renderer is in use for NetPlan - if systemctl is-active NetworkManager 1> /dev/null; then - NETWORK_RENDERER=NetworkManager - else - NETWORK_RENDERER=networkd - fi - - DIALOG_CANCEL=1 - DIALOG_ESC=255 - - # we have our own lsb_release which does not use Python. Others shell install it here - if [[ ! -f /usr/bin/lsb_release ]]; then - if is_package_manager_running; then - sleep 3 - fi - debconf-apt-progress -- apt-get update - debconf-apt-progress -- apt -y -qq --allow-downgrades --no-install-recommends install lsb-release - fi - - [[ -f /etc/armbian-release ]] && source /etc/armbian-release && ARMBIAN="Armbian $VERSION $IMAGE_TYPE" - DISTRO=$(lsb_release -is) - DISTROID=$(lsb_release -sc) - KERNELID=$(uname -r) - [[ -z "${ARMBIAN// /}" ]] && ARMBIAN="$DISTRO $DISTROID" - DEFAULT_ADAPTER=$(ip -4 route ls | grep default | tail -1 | grep -Po '(?<=dev )(\S+)') - LOCALIPADD=$(ip -4 addr show dev $DEFAULT_ADAPTER | awk '/inet/ {print $2}' | cut -d'/' -f1) - BACKTITLE="Contribute: https://github.com/armbian/configng" - TITLE="Armbian configuration utility" - [[ -z "${DEFAULT_ADAPTER// /}" ]] && DEFAULT_ADAPTER="lo" - - # detect desktop - check_desktop - -} - - -module_options+=( - ["check_if_installed,author"]="@armbian" - ["check_if_installed,ref_link"]="" - ["check_if_installed,feature"]="check_if_installed" - ["check_if_installed,desc"]="Migrated procedures from Armbian config." - ["check_if_installed,example"]="check_if_installed nano" - ["check_if_installed,status"]="Active" -) -# -# check dpkg status of $1 -- currently only 'not installed at all' case caught -# -function check_if_installed() { - - local DPKG_Status="$(dpkg -s "$1" 2> /dev/null | awk -F": " '/^Status/ {print $2}')" - if [[ "X${DPKG_Status}" = "X" || "${DPKG_Status}" = *deinstall* || "${DPKG_Status}" = *not-installed* ]]; then - return 1 - else - return 0 - fi - -} - - diff --git a/lib/armbian-config/config.jobs.json b/lib/armbian-config/config.jobs.json deleted file mode 100644 index 9406bcbd..00000000 --- a/lib/armbian-config/config.jobs.json +++ /dev/null @@ -1,915 +0,0 @@ -{ - "menu": [ - { - "id": "System", - "description": "System wide and admin settings", - "sub": [ - { - "id": "SY001", - "description": "Enable Armbian firmware upgrades", - "about": "This will enable Armbian kernel upgrades that are currently put on hold.", - "command": [ - "armbian_fw_manipulate unhold" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[[ -n \"$(apt-mark showhold)\" ]]" - }, - { - "id": "SY002", - "description": "Disable Armbian kernel upgrades", - "about": "Disable Armbian kernel/firmware upgrades", - "command": [ - "armbian_fw_manipulate hold" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[[ -z \"$(apt-mark showhold)\" ]]" - }, - { - "id": "SY003", - "description": "Edit the boot environment", - "about": "This will open /boot/armbianEnv.txt file to edit\nCTRL+S to save\nCTLR+X to exit\nwould you like to continue?", - "command": [ - "nano /boot/armbianEnv.txt" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[[ -f /boot/armbianEnv.txt ]]" - }, - { - "id": "SY004", - "description": "Install Linux headers", - "command": [ - "Headers_install" - ], - "status": "Preview", - "author": "@Tearran", - "condition": "! are_headers_installed" - }, - { - "id": "SY005", - "description": "Remove Linux headers", - "command": [ - "Headers_remove" - ], - "status": "Preview", - "author": "@Tearran", - "condition": "are_headers_installed" - }, - { - "id": "SY006", - "description": "Install to internal storage", - "command": [ - "armbian-install" - ], - "status": "Preview", - "author": "@igorpecovnik", - "condition": "[[ -f /sbin/armbian-install ]]" - }, - { - "id": "SY007", - "description": "Manage SSH login options", - "sub": [ - { - "id": "SY101", - "description": "Disable root login", - "command": [ - "sed -i \"s|^#\\?PermitRootLogin.*|PermitRootLogin no|\" /etc/ssh/sshd_config", - "systemctl restart sshd.service 2>/dev/null | systemctl restart ssh.service 2>/dev/null" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config" - }, - { - "id": "SY102", - "description": "Enable root login", - "command": [ - "sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/\" /etc/ssh/sshd_config", - "systemctl restart sshd.service 2>/dev/null | systemctl restart ssh.service 2>/dev/null" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "grep -q '^PermitRootLogin no' /etc/ssh/sshd_config" - }, - { - "id": "SY103", - "description": "Disable password login", - "command": [ - "sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication no/\" /etc/ssh/sshd_config", - "systemctl restart sshd.service 2>/dev/null | systemctl restart ssh.service 2>/dev/null" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "grep -q 'PasswordAuthentication yes' /etc/ssh/sshd_config" - }, - { - "id": "SY104", - "description": "Enable password login", - "command": [ - "sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/\" /etc/ssh/sshd_config", - "systemctl restart sshd.service 2>/dev/null | systemctl restart ssh.service 2>/dev/null" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "grep -q 'PasswordAuthentication no' /etc/ssh/sshd_config" - }, - { - "id": "SY105", - "description": "Disable Public key authentication login", - "command": [ - "sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/\" /etc/ssh/sshd_config", - "systemctl restart sshd.service 2>/dev/null | systemctl restart ssh.service 2>/dev/null" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "grep -q 'PubkeyAuthentication yes' /etc/ssh/sshd_config" - }, - { - "id": "SY106", - "description": "Enable Public key authentication login", - "command": [ - "sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication yes/\" /etc/ssh/sshd_config", - "systemctl restart sshd.service 2>/dev/null | systemctl restart ssh.service 2>/dev/null" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "grep -q 'PubkeyAuthentication no' /etc/ssh/sshd_config" - }, - { - "id": "SY107", - "description": "Disable OTP authentication", - "command": [ - "clear", - "! check_if_installed libpam-google-authenticator && ! check_if_installed qrencode || debconf-apt-progress -- apt-get -y purge libpam-google-authenticator qrencode", - "sed -i \"s/^#\\?ChallengeResponseAuthentication.*/ChallengeResponseAuthentication no/\" /etc/ssh/sshd_config || sed -i \"0,/KbdInteractiveAuthentication/s//ChallengeResponseAuthentication yes/\" /etc/ssh/sshd_config", - "sed -i '/^auth required pam_google_authenticator.so nullok/ d' /etc/pam.d/sshd", - "systemctl restart sshd.service 2>/dev/null | systemctl restart ssh.service 2>/dev/null" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "grep -q 'ChallengeResponseAuthentication yes' /etc/ssh/sshd_config" - }, - { - "id": "SY108", - "description": "Enable OTP authentication", - "command": [ - "check_if_installed libpam-google-authenticator || debconf-apt-progress -- apt-get -y install libpam-google-authenticator", - "check_if_installed qrencode || debconf-apt-progress -- apt-get -y install qrencode", - "sed -i \"s/^#\\?ChallengeResponseAuthentication.*/ChallengeResponseAuthentication yes/\" /etc/ssh/sshd_config", - "sed -i $'/KbdInteractiveAuthentication/{iChallengeResponseAuthentication yes\\n:a;n;ba}' /etc/ssh/sshd_config || sed -n -i '/password updating/{p;:a;N;/@include common-password/!ba;s/.*\\n/auth required pam_google_authenticator.so nullok\\nauth required pam_permit.so\\n/};p' /etc/pam.d/sshd", - "[ ! -f /root/.google_authenticator ] && qr_code generate", - "systemctl restart sshd.service 2>/dev/null | systemctl restart ssh.service 2>/dev/null" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "! check_if_installed libpam-google-authenticator || ! check_if_installed qrencode || grep -q '^ChallengeResponseAuthentication no' /etc/ssh/sshd_config || ! grep -q 'ChallengeResponseAuthentication' /etc/ssh/sshd_config" - }, - { - "id": "SY109", - "description": "Generate new OTP authentication QR code", - "command": [ - "qr_code generate" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "grep -q '^ChallengeResponseAuthentication yes' /etc/ssh/sshd_config" - }, - { - "id": "SY110", - "description": "Show OTP authentication QR code", - "command": [ - "qr_code" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "grep -q '^ChallengeResponseAuthentication yes' /etc/ssh/sshd_config && [ -f /root/.google_authenticator ]" - }, - { - "id": "SY111", - "description": "Disable last login banner", - "command": [ - "sed -i \"s/^#\\?PrintLastLog.*/PrintLastLog no/\" /etc/ssh/sshd_config", - "systemctl restart ssh.service " - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "grep -q '^PrintLastLog yes' /etc/ssh/sshd_config" - }, - { - "id": "SY112", - "description": "Enable last login banner", - "command": [ - "sed -i \"s/^#\\?PrintLastLog.*/PrintLastLog yes/\" /etc/ssh/sshd_config", - "systemctl restart ssh.service " - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "grep -q '^PrintLastLog no' /etc/ssh/sshd_config" - } - ] - }, - { - "id": "SY008", - "description": "Change shell system wide to BASH", - "about": "This will switch system wide shell to BASH", - "command": [ - "export BASHLOCATION=$(grep /bash$ /etc/shells | tail -1)", - "sed -i \"s|^SHELL=.*|SHELL=${BASHLOCATION}|\" /etc/default/useradd", - "sed -i \"s|^DSHELL=.*|DSHELL=${BASHLOCATION}|\" /etc/adduser.conf", - "apt_install_wrapper apt-get -y purge armbian-zsh zsh-common zsh tmux", - "update_skel", - "awk -F'[/:]' '{if ($3 >= 1000 && $3 != 65534 || $3 == 0) print $1}' /etc/passwd | xargs -L1 chsh -s $(grep /bash$ /etc/shells | tail -1)" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[[ $(cat /etc/passwd | grep \"^root:\" | rev | cut -d\":\" -f1 | cut -d\"/\" -f1| rev) == \"zsh\" ]]" - }, - { - "id": "SY009", - "description": "Change shell system wide to ZSH", - "about": "This will switch system wide shell to ZSH", - "command": [ - "export ZSHLOCATION=$(grep /zsh$ /etc/shells | tail -1)", - "sed -i \"s|^SHELL=.*|SHELL=${ZSHLOCATION}|\" /etc/default/useradd", - "sed -i \"s|^DSHELL=.*|DSHELL=${ZSHLOCATION}|\" /etc/adduser.conf", - "apt_install_wrapper apt-get -y install armbian-zsh zsh-common zsh tmux", - "update_skel", - "awk -F'[/:]' '{if ($3 >= 1000 && $3 != 65534 || $3 == 0) print $1}' /etc/passwd | xargs -L1 chsh -s $(grep /zsh$ /etc/shells | tail -1)" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[[ $(cat /etc/passwd | grep \"^root:\" | rev | cut -d\":\" -f1 | cut -d\"/\" -f1| rev) == \"bash\" ]]" - }, - { - "id": "SY010", - "description": "Switch to rolling release", - "about": "This will switch OS to rolling releases.", - "command": [ - "set_rolling" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "grep -q 'apt.armbian.com' /etc/apt/sources.list.d/armbian.list && [[ -z \"$(apt-mark showhold)\" ]]" - }, - { - "id": "SY011", - "description": "Switch to stable release", - "about": "This will switch OS to stable releases", - "command": [ - "set_stable" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "grep -q 'beta.armbian.com' /etc/apt/sources.list.d/armbian.list && [[ -z \"$(apt-mark showhold)\" ]]" - }, - { - "id": "SY012", - "description": "Enable read only filesystem", - "about": "This will enable Armbian read-only filesystem. Reboot is mandatory?\n", - "command": [ - "manage_overlayfs enable" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "modinfo overlay > /dev/null 2>&1 && [[ -z $(findmnt -k /media/root-ro | tail -1) ]] && [[ \"${DISTRO}\"=Ubuntu ]]" - }, - { - "id": "SY013", - "description": "Disable read only filesystem", - "about": "This will disable Armbian read-only filesystem. Reboot is mandatory?\n", - "command": [ - "manage_overlayfs disable" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "command -v overlayroot-chroot > /dev/null 2>&1 && findmnt -k /media/root-ro | tail -1 | grep -w /media/root-ro > /dev/null 2>&1" - }, - { - "id": "SY014", - "description": "Adjust welcome screen (motd)", - "command": [ - "adjust_motd" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[ -f /etc/default/armbian-motd ]" - }, - { - "id": "SY015", - "description": "Install alternative kernels", - "about": "Switching between kernels might change functionality of your device. \n\nIt might fail to boot!", - "command": [ - "switch_kernels" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "" - }, - { - "id": "SY016", - "description": "Distribution upgrades", - "condition": "[ -f /etc/armbian-distribution-status ] && release_upgrade rolling verify || release_upgrade stable verify", - "sub": [ - { - "id": "SY101", - "description": "Upgrade to latest stable / LTS", - "about": "Release upgrade is irriversible operation which upgrades all packages. \n\nResoulted upgrade might break your build beyond repair!", - "command": [ - "release_upgrade stable" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[ -f /etc/armbian-distribution-status ] && release_upgrade stable verify" - }, - { - "id": "SY102", - "description": "Upgrade to rolling unstable", - "about": "Release upgrade is irriversible operation which upgrades all packages. \n\nResoulted upgrade might break your build beyond repair!", - "command": [ - "release_upgrade rolling" - ], - "status": "Active", - "author": "@igorpecovnik", - "condition": "[ -f /etc/armbian-distribution-status ] && release_upgrade rolling verify" - } - ] - }, - { - "id": "SY017", - "description": "Manage device tree overlays", - "command": [ - "manage_dtoverlays" - ], - "status": "Stable", - "author": "@viraniac @igorpecovnik", - "condition": "[ -n $OVERLAY_DIR ] && [ -n $BOOT_SOC ]" - } - ] - }, - { - "id": "Network", - "description": "Fixed and wireless network settings", - "sub": [ - { - "id": "NE001", - "description": "Configure network interfaces", - "sub": [ - { - "id": "NE002", - "description": "Add / change interface", - "command": [ - "network_config armbian" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "" - }, - { - "id": "NE003", - "description": "Revert to Armbian defaults", - "command": [ - "default_network_config" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "" - }, - { - "id": "NE004", - "description": "Show configuration", - "command": [ - "show_message <<< \"$(netplan get all)\"" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[[ -f /etc/netplan/armbian.yaml ]]" - }, - { - "id": "NE005", - "description": "Show active status", - "command": [ - "show_message <<< \"$(netplan status --all)\"" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[ -f /etc/netplan/armbian.yaml ] && [ netplan status 2>/dev/null ]" - } - ] - } - ] - }, - { - "id": "Localisation", - "description": "Localisation", - "sub": [ - { - "id": "LO001", - "description": "Change Global timezone", - "command": [ - "dpkg-reconfigure tzdata" - ], - "status": "Stable", - "author": "@armbian" - }, - { - "id": "LO002", - "description": "Change Locales reconfigure the language and character set", - "command": [ - "dpkg-reconfigure locales", - "source /etc/default/locale ; sed -i \"s/^LANGUAGE=.*/LANGUAGE=$LANG/\" /etc/default/locale", - "export LANGUAGE=$LANG" - ], - "status": "Stable", - "author": "@armbian" - }, - { - "id": "LO003", - "description": "Change Keyboard layout", - "command": [ - "dpkg-reconfigure keyboard-configuration ; setupcon ", - "update-initramfs -u" - ], - "status": "Stable", - "author": "@armbian" - }, - { - "id": "LO005", - "description": "Change System Hostname", - "command": [ - "change_system_hostname" - ], - "status": "Stable", - "author": "@armbian" - } - ] - }, - { - "id": "Software", - "description": "Run/Install 3rd party applications", - "sub": [ - { - "id": "Desktops", - "description": "Desktop Environments", - "sub": [ - { - "id": "XFCE", - "description": "XFCE desktop", - "sub": [ - { - "id": "XFCE01", - "about": "Install XFCE:\nXfce is a lightweight desktop environment for UNIX-like operating systems. It aims to be fast and low on system resources, while still being visually appealing and user friendly.", - "description": "XFCE desktop Install", - "command": [ - "manage_desktops 'xfce' 'install'" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[ ! -f /usr/share/xsessions/xfce.desktop ]" - }, - { - "id": "XFCE02", - "description": "Uninstall", - "command": [ - "manage_desktops 'xfce' 'uninstall'" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[ -f /usr/share/xsessions/xfce.desktop ]" - }, - { - "id": "XFCE03", - "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": "XFCE04", - "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": "Gnome", - "description": "Gnome desktop", - "sub": [ - { - "id": "GNOME01", - "description": "Gnome desktop Install", - "command": [ - "manage_desktops 'gnome' 'install'" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[ ! -f /usr/share/xsessions/gnome.desktop ]" - }, - { - "id": "GNOME02", - "description": "Uninstall", - "command": [ - "manage_desktops 'gnome' 'uninstall'" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[ -f /usr/share/xsessions/gnome.desktop ]" - }, - { - "id": "GNOME03", - "description": "Enable autologin", - "command": [ - "manage_desktops 'gnome' 'auto'" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[ -f /usr/share/xsessions/gnome.desktop ] && ! cat /etc/gdm3/custom.conf 2>/dev/null | grep AutomaticLoginEnable | grep true >/dev/null" - }, - { - "id": "GNOME04", - "description": "Disable autologin", - "command": [ - "manage_desktops 'gnome' 'manual'" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[ -f /usr/share/xsessions/gnome.desktop ] && cat /etc/gdm3/custom.conf 2>/dev/null | grep AutomaticLoginEnable | grep true >/dev/null" - } - ] - }, - { - "id": "Cinnamon", - "description": "Cinnamon desktop", - "sub": [ - { - "id": "CINNAMON01", - "description": "Cinnamon desktop Install", - "command": [ - "manage_desktops 'cinnamon' 'install'" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[ ! -f /usr/share/xsessions/cinnamon.desktop ] && [ ! -f /usr/share/xsessions/cinnamon2d.desktop ]" - }, - { - "id": "CINNAMON02", - "description": "Cinnamon desktop uninstall", - "command": [ - "manage_desktops 'cinnamon' 'uninstall'" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[ -f /usr/share/xsessions/cinnamon.desktop ] || [ -f /usr/share/xsessions/cinnamon2d.desktop ]" - }, - { - "id": "CINNAMON03", - "description": "Enable autologin", - "command": [ - "manage_desktops 'cinnamon' 'auto'" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[ -f /usr/share/xsessions/cinnamon.desktop ] && [ ! -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]" - }, - { - "id": "CINNAMON04", - "description": "Disable autologin", - "command": [ - "manage_desktops 'cinnamon' 'manual'" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "[ -f /usr/share/xsessions/cinnamon.desktop ] && [ -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ]" - } - ] - }, - { - "id": "Xapian", - "description": "Improve application search speed", - "command": [ - "update-apt-xapian-index -u; sleep 3" - ], - "status": "Stable", - "author": "@igorpecovnik", - "condition": "systemctl is-active --quiet service display-manager" - } - ] - }, - { - "id": "Netconfig", - "description": "Network tools", - "sub": [ - { - "id": "NET001", - "description": "Install realtime console network usage monitor (nload)", - "command": [ - "get_user_continue \"This operation will install nload.\n\nDo you wish to continue?\" process_input", - "debconf-apt-progress -- apt-get -y install nload" - ], - "status": "Stable", - "author": "@armbian", - "condition": "! check_if_installed nload" - }, - { - "id": "NET002", - "description": "Remove realtime console network usage monitor (nload)", - "command": [ - "get_user_continue \"This operation will purge nload.\n\nDo you wish to continue?\" process_input", - "debconf-apt-progress -- apt-get -y purge nload" - ], - "status": "Stable", - "author": "@armbian", - "condition": "check_if_installed nload" - }, - { - "id": "NET003", - "description": "Install bandwidth measuring tool (iperf3)", - "command": [ - "get_user_continue \"This operation will install iperf3.\n\nDo you wish to continue?\" process_input", - "debconf-apt-progress -- apt-get -y install iperf3" - ], - "status": "Stable", - "author": "@armbian", - "condition": "! check_if_installed iperf3" - }, - { - "id": "NET004", - "description": "Remove bandwidth measuring tool (iperf3)", - "command": [ - "get_user_continue \"This operation will purge iperf3.\n\nDo you wish to continue?\" process_input", - "debconf-apt-progress -- apt-get -y purge iperf3" - ], - "status": "Stable", - "author": "@armbian", - "condition": "check_if_installed iperf3" - }, - { - "id": "NET005", - "description": "Install IP LAN monitor (iptraf-ng)", - "command": [ - "get_user_continue \"This operation will install iptraf-ng.\n\nDo you wish to continue?\" process_input", - "debconf-apt-progress -- apt-get -y install iptraf-ng" - ], - "status": "Stable", - "author": "@armbian", - "condition": "! check_if_installed iptraf-ng" - }, - { - "id": "NET006", - "description": "Remove IP LAN monitor (iptraf-ng)", - "command": [ - "get_user_continue \"This operation will purge nload.\n\nDo you wish to continue?\" process_input", - "debconf-apt-progress -- apt-get -y purge iptraf-ng" - ], - "status": "Stable", - "author": "@armbian", - "condition": "check_if_installed iptraf-ng" - }, - { - "id": "NET007", - "description": "Install hostname broadcast via mDNS (avahi-daemon)", - "command": [ - "get_user_continue \"This operation will install avahi-daemon and add configuration files.\nDo you wish to continue?\" process_input", - "check_if_installed avahi-daemon", - "debconf-apt-progress -- apt-get -y install avahi-daemon libnss-mdns", - "cp /usr/share/doc/avahi-daemon/examples/sftp-ssh.service /etc/avahi/services/", - "cp /usr/share/doc/avahi-daemon/examples/ssh.service /etc/avahi/services/", - "service avahi-daemon restart" - ], - "status": "Stable", - "author": "@armbian", - "condition": "! check_if_installed avahi-daemon" - }, - { - "id": "NET008", - "description": "Remove hostname broadcast via mDNS (avahi-daemon)", - "command": [ - "get_user_continue \"This operation will purge avahi-daemon \nDo you wish to continue?\" process_input", - "check_if_installed avahi-daemon", - "systemctl stop avahi-daemon avahi-daemon.socket", - "debconf-apt-progress -- apt-get -y purge avahi-daemon" - ], - "status": "Stable", - "author": "@armbian", - "condition": "check_if_installed avahi-daemon" - } - ] - }, - { - "id": "DevTools", - "description": "Development", - "sub": [ - { - "id": "DEV001", - "description": "Install tools for cloning and managing repositories (git)", - "command": [ - "get_user_continue \"This operation will install git.\n\nDo you wish to continue?\" process_input", - "debconf-apt-progress -- apt-get -y install git" - ], - "status": "Stable", - "author": "@armbian", - "condition": "! check_if_installed git" - }, - { - "id": "DEV001", - "description": "Remove tools for cloning and managing repositories (git)", - "command": [ - "get_user_continue \"This operation will remove git.\n\nDo you wish to continue?\" process_input", - "debconf-apt-progress -- apt-get -y purge git" - ], - "status": "Stable", - "author": "@armbian", - "condition": "check_if_installed git" - } - ] - }, - { - "id": "Benchy", - "description": "System benchmaking and diagnostics", - "command": [ - "see_monitoring" - ], - "status": "Stable", - "author": "@armbian", - "condition": "[ -f /usr/bin/armbianmonitor ]" - }, - { - "id": "Containers", - "description": "Containerlization and Virtual Machines", - "sub": [ - { - "id": "CON001", - "description": "Install Docker Minimal", - "about": "This operation will install Docker Minimal.", - "command": [ - "install_docker" - ], - "status": "Stable", - "author": "@schwar3kat", - "condition": "! check_if_installed docker-ce" - }, - { - "id": "CON002", - "description": "Install Docker Engine", - "about": "This operation will install Docker Engine.", - "command": [ - "install_docker engine" - ], - "status": "Stable", - "author": "@schwar3kat", - "condition": "! check_if_installed docker-compose-plugin" - }, - { - "id": "CON003", - "description": "Remove Docker", - "about": "This operation will purge Docker.", - "command": [ - "apt_install_wrapper apt -y purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras" - ], - "status": "Stable", - "author": "@schwar3kat", - "condition": "check_if_installed docker-ce" - }, - { - "id": "CON004", - "description": "Purge all Docker images, containers, and volumes", - "about": "This operation will delete all Docker images, containers, and volumes.", - "command": [ - "rm -rf /var/lib/docker", - "rm -rf /var/lib/containerd" - ], - "status": "Stable", - "author": "@schwar3kat", - "condition": "! check_if_installed docker-ce && [ -d /var/lib/docker ]" - } - ] - }, - { - "id": "Media", - "description": "Media Servers and Editors", - "sub": [ - { - "id": "MED001", - "description": "Install Plex Media server", - "about": "This operation will install Plex Media server.", - "command": [ - "install_plexmediaserver" - ], - "status": "Stable", - "author": "@schwar3kat", - "condition": "! check_if_installed plexmediaserver" - }, - { - "id": "MED002", - "description": "Remove Plex Media server", - "about": "This operation will purge Plex Media server.", - "command": [ - "apt_install_wrapper apt-get -y purge plexmediaserver", - "sed -i '/plexmediaserver.gpg/s/^/#/g' /etc/apt/sources.list.d/plexmediaserver.list" - ], - "status": "Stable", - "author": "@schwar3kat", - "condition": "check_if_installed plexmediaserver" - }, - { - "id": "MED003", - "description": "Install Emby server", - "about": "This operation will install Emby server.", - "command": [ - "install_embyserver" - ], - "status": "Stable", - "author": "@schwar3kat", - "condition": "! check_if_installed emby-server" - }, - { - "id": "MED004", - "description": "Remove Emby server", - "about": "This operation will purge Emby server.", - "command": [ - "apt_install_wrapper apt -y purge emby-server" - ], - "status": "Stable", - "author": "@schwar3kat", - "condition": "check_if_installed emby-server" - } - ] - }, - { - "id": "Management", - "description": "Remote Management tools", - "sub": [ - { - "id": "MAN001", - "description": "Install Cockpit web-based management tool", - "about": "This operation will install Cockpit.\ncockpit cockpit-ws cockpit-system cockpit-storaged", - "command": [ - "see_current_apt update", - "apt_install_wrapper apt -y install cockpit cockpit-ws cockpit-system cockpit-storaged " - ], - "status": "Stable", - "author": "@schwar3kat", - "condition": "! check_if_installed cockpit" - }, - { - "id": "MAN002", - "description": "Purge Cockpit web-based management tool", - "about": "This operation will purge Cockpit.", - "command": [ - "apt_install_wrapper apt -y purge cockpit" - ], - "status": "Stable", - "author": "@schwar3kat", - "condition": "check_if_installed cockpit" - }, - { - "id": "MAN003", - "description": "Start Cockpit Service", - "command": [ - "sudo systemctl enable --now cockpit.socket | show_infobox " - ], - "status": "Stable", - "author": "@schwar3kat", - "condition": "check_if_installed cockpit && ! systemctl is-enabled cockpit.socket > /dev/null 2>&1" - }, - { - "id": "MAN004", - "description": "Stop Cockpit Service", - "command": [ - "systemctl stop cockpit cockpit.socket", - "systemctl disable cockpit.socket | show_infobox " - ], - "status": "Stable", - "author": "@schwar3kat", - "condition": "check_if_installed cockpit && systemctl is-enabled cockpit.socket > /dev/null 2>&1" - } - ] - } - ] - }, - { - "id": "Help", - "description": "About this tool", - "sub": [ - { - "id": "HE001", - "description": "Contribute", - "command": [ - "show_message <<< $(about_armbian_configng)" - ], - "status": "Stable", - "author": "@armbian" - } - ] - } - ] -} diff --git a/lib/armbian-config/config.network.sh b/lib/armbian-config/config.network.sh deleted file mode 100644 index f95f2033..00000000 --- a/lib/armbian-config/config.network.sh +++ /dev/null @@ -1,584 +0,0 @@ - -module_options+=( - ["default_network_config,author"]="@igorpecovnik" - ["default_network_config,ref_link"]="" - ["default_network_config,feature"]="default_network_config" - ["default_network_config,desc"]="Revert network config back to Armbian defaults" - ["default_network_config,example"]="default_network_config" - ["default_network_config,status"]="review" -) -# -# Function to revert network configuration to Armbian defaults -# -function default_network_config() { - - local yamlfile=10-dhcp-all-interfaces - - # store current configs to temporal folder - store_netplan_config - - get_user_continue "This action might disconnect you from network.\n\nAre you sure network was configured correctly?" process_input - if [[ $? == 0 ]]; then - # remove all configs - rm -f /etc/netplan/*.yaml - # disable hostapd - systemctl stop hostapd 2> /dev/null - systemctl disable hostapd 2> /dev/null - # reset netplan config - netplan set --origin-hint ${yamlfile} renderer=${NETWORK_RENDERER} - netplan set --origin-hint ${yamlfile} ethernets.all-eth-interfaces.dhcp4=true - netplan set --origin-hint ${yamlfile} ethernets.all-eth-interfaces.dhcp6=true - netplan set --origin-hint ${yamlfile} ethernets.all-eth-interfaces.match.name=e* - - # exceptions - if [[ "${NETWORK_RENDERER}" == "NetworkManager" ]]; then - # uninstall packages - apt_install_wrapper apt-get -y purge hostapd - netplan apply - nmcli con down br0 - else - # uninstall packages - apt_install_wrapper apt-get -y purge hostapd networkd-dispatcher - # drop and delete bridge interface in case its there - if [[ -n $(ip link show type bridge) ]]; then - ip link set br0 down - brctl delbr br0 - networkctl reconfigure br0 - fi - # remove networkd-dispatcher hook - rm -f /etc/networkd-dispatcher/carrier.d/armbian-ap - netplan apply - fi - else - restore_netplan_config - fi -} - - -module_options+=( - ["qr_code,author"]="@igorpecovnik" - ["qr_code,ref_link"]="" - ["qr_code,feature"]="qr_code" - ["qr_code,desc"]="Show or generate QR code for Google OTP" - ["qr_code,example"]="qr_code generate" - ["qr_code,status"]="Active" -) -# -# check dpkg status of $1 -- currently only 'not installed at all' case caught -# -function qr_code() { - - clear - if [[ "$1" == "generate" ]]; then - google-authenticator -t -d -f -r 3 -R 30 -W -q - cp /root/.google_authenticator /etc/skel - update_skel - fi - export TOP_SECRET=$(head -1 /root/.google_authenticator) - qrencode -m 2 -d 9 -8 -t ANSI256 "otpauth://totp/test?secret=$TOP_SECRET" - echo -e ' -Scan QR code with your OTP application on mobile phone -' - read -n 1 -s -r -p "Press any key to continue" - -} - - - -module_options+=( - ["network_config,author"]="@igorpecovnik" - ["network_config,ref_link"]="" - ["network_config,feature"]="network_config" - ["network_config,desc"]="Netplan wrapper" - ["network_config,example"]="network_config" - ["network_config,doc_link"]="" - ["network_config,status"]="review" -) -# -# Function to select network adapter -# -function network_config() { - - # defaul yaml file - local yamlfile=${1:-armbian} - - # store current configs to temporal folder - store_netplan_config - - LIST=() - HIDE_IP_PATTERN="^dummy0|^lo|^docker|^virbr|^br" - for f in /sys/class/net/*; do - interface=$(basename $f) - if [[ $interface =~ $HIDE_IP_PATTERN ]]; then - continue - else - [[ $interface == w* ]] && devicetype="wifi" || devicetype="wired" - QUERY=$(ip -br addr show dev $interface | awk '{ print $1, " " , ($3==""?"unassigned":$3)"['$devicetype']" }') - [[ -n $QUERY ]] && LIST+=($QUERY) - fi - done - LIST_LENGTH=$((${#LIST[@]} / 2)) - adapter=$($DIALOG --title "Select interface" --menu "" $((${LIST_LENGTH} + 8)) 60 $((${LIST_LENGTH})) "${LIST[@]}" 3>&1 1>&2 2>&3) - if [[ -n $adapter && $? == 0 ]]; then - # - # Wireless networking - # - if [[ "$adapter" == w* ]]; then - - LIST=() - if systemctl is-active --quiet service hostapd; then - LIST+=("stop" "Disable access point") - else - LIST=("sta" "Connect to access point") - LIST+=("ap" "Become an access point") - fi - LIST_LENGTH=$((${#LIST[@]} / 2)) - wifimode=$($DIALOG --title "Select wifi mode" --menu "" $((${LIST_LENGTH} + 8)) 60 $((${LIST_LENGTH})) "${LIST[@]}" 3>&1 1>&2 2>&3) - case $wifimode in - stop) - # disable hostapd and cleanup config - default_wireless_network_config "${yamlfile}" "${adapter}" - ;; - - sta) - ip link set ${adapter} up - default_wireless_network_config "${yamlfile}" "${adapter}" - LIST=() - LIST=($(iw dev ${adapter} scan 2> /dev/null | grep 'SSID\|^BSS' | cut -d" " -f2 | sed "s/(.*//g" | xargs -n2 -d'\n' | awk '{print $2,$1}')) - sleep 1 - LIST_LENGTH=$((${#LIST[@]} / 2)) - if [[ ${#LIST[@]} == 0 ]]; then - restore_netplan_config - else - SELECTED_SSID=$($DIALOG --title "Select SSID" --menu "rf" $((${LIST_LENGTH} + 6)) 50 $((${LIST_LENGTH})) "${LIST[@]}" 3>&1 1>&2 2>&3) - if [[ -n $SELECTED_SSID ]]; then - SELECTED_PASSWORD=$($DIALOG --title "Enter new password for $SELECTED_SSID" --passwordbox "" 7 50 3>&1 1>&2 2>&3) - if [[ -n $SELECTED_PASSWORD ]]; then - # connect to AP - netplan set --origin-hint ${yamlfile} renderer=${NETWORK_RENDERER} - netplan set --origin-hint ${yamlfile} wifis.$adapter.access-points."${SELECTED_SSID//./\\.}".password=${SELECTED_PASSWORD} - netplan set --origin-hint ${yamlfile} wifis.$adapter.dhcp4=true - netplan set --origin-hint ${yamlfile} wifis.$adapter.dhcp6=true - show_message <<< "$(netplan get all)" - $DIALOG --title " Changing network settings " --yes-button "Yes" --no-button "Cancel" --yesno \ - "This action might disconnect you from network.\n\nAre you sure network was configured correctly?" 9 50 - if [[ $? = 0 ]]; then - netplan apply - else - restore_netplan_config - fi - fi - fi - fi - ;; - - ap) - ip link set ${adapter} up - default_wireless_network_config "${yamlfile}" "${adapter}" - ! check_if_installed hostapd && apt_install_wrapper apt-get -y --no-install-recommends install hostapd networkd-dispatcher - SELECTED_SSID=$($DIALOG --title "Enter SSID for AP" --inputbox "" 7 50 3>&1 1>&2 2>&3) - if [[ -n "${SELECTED_SSID}" && $? == 0 ]]; then - SELECTED_PASSWORD=$($DIALOG --title "Enter new password for $SELECTED_SSID" --passwordbox "" 7 50 3>&1 1>&2 2>&3) - if [[ -n "${SELECTED_PASSWORD}" && $? == 0 ]]; then - # start bridged AP - netplan set --origin-hint ${yamlfile} renderer=${NETWORK_RENDERER} - netplan set --origin-hint ${yamlfile} ethernets.$adapter.dhcp4=no - netplan set --origin-hint ${yamlfile} ethernets.$adapter.dhcp6=no - netplan set --origin-hint ${yamlfile} bridges.br0.interfaces='['$adapter']' - cat <<- EOF > "/etc/hostapd/hostapd.conf" - interface=$adapter - driver=nl80211 - ssid=$SELECTED_SSID - hw_mode=g - channel=7 - wmm_enabled=0 - macaddr_acl=0 - auth_algs=1 - ignore_broadcast_ssid=0 - wpa=2 - wpa_passphrase=$SELECTED_PASSWORD - wpa_key_mgmt=WPA-PSK - wpa_pairwise=TKIP - rsn_pairwise=CCMP - EOF - netplan apply - # Start hostapd services - systemctl unmask hostapd 2>/dev/null - systemctl enable hostapd 2>/dev/null - systemctl start hostapd 2>/dev/null - # Sometimes it fails to add to the bridge - brctl addif br0 $adapter 2>/dev/null - # Add hooks to hack wrong if type - if [[ "${NETWORK_RENDERER}" == "NetworkManager" ]]; then - mkdir -p /etc/NetworkManager/dispatcher.d - cat <<- EOF > "/etc/NetworkManager/dispatcher.d/armbian-ap" - #!/bin/bash - # Added by armbian-config - interface=\$1 - status=\$2 - case "\$status" in - up) - if [[ "\$interface" == "br0" ]]; then - service hostapd restart - brctl addif br0 $adapter - fi - ;; - down) - if [[ "\$interface" == "br0" ]]; then - brctl delif br0 $adapter - fi - ;; - esac - EOF - chmod +x /etc/NetworkManager/dispatcher.d/armbian-ap - else - # workarounding bug in netplan for failing to add wireless adaptor to bridge - # this might not be needed on all versions - mkdir -p /etc/networkd-dispatcher/carrier.d/ - cat <<- EOF > "/etc/networkd-dispatcher/carrier.d/armbian-ap" - #!/bin/sh - brctl addif br0 $adapter - netplan apply - exit 0 - EOF - chmod +x /etc/networkd-dispatcher/carrier.d/armbian-ap - fi - fi - fi - ;; - - *) - echo -n "unknown" - exit - ;; - esac - - else - - # - # Wired networking - # - - # remove default configuration - rm -f /etc/netplan/10-dhcp-all-interfaces.yaml - - LIST=("dhcp" "Auto IP assigning") - LIST+=("static" "Set IP manually") - [[ -f /etc/netplan/armbian.yaml ]] && LIST+=("spoof" "Spoof MAC address") - LIST_LENGTH=$((${#LIST[@]} / 2)) - wiredmode=$($DIALOG --title "Select IP mode" --menu "" $((${LIST_LENGTH} + 8)) 60 $((${LIST_LENGTH})) "${LIST[@]}" 3>&1 1>&2 2>&3) - if [[ "${wiredmode}" == "spoof" && $? == 0 ]]; then - local mac_address=$(ip a s ${adapter} | grep link/ether | awk '{print $2}') - mac_address=$($DIALOG --title "Enter MAC for $adapter" --inputbox "\nValid format: $mac_address" 9 40 "$mac_address" 3>&1 1>&2 2>&3) - if [[ -n $mac_address && $? == 0 ]]; then - netplan set --origin-hint ${yamlfile} ethernets.$adapter.macaddress=''$mac_address'' - netplan apply - fi - elif [[ "${wiredmode}" == "dhcp" && $? == 0 ]]; then - [[ -f /etc/netplan/${yamlfile}.yaml ]] && sed -i -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/bridges/{s/^\( *\).*/ \1/;x;d;}' /etc/netplan/${yamlfile}.yaml - netplan set --origin-hint ${yamlfile} renderer=${NETWORK_RENDERER} - netplan set --origin-hint ${yamlfile} ethernets.$adapter.dhcp4=no - netplan set --origin-hint ${yamlfile} ethernets.$adapter.dhcp6=no - netplan set --origin-hint ${yamlfile} bridges.br0.interfaces='['$adapter']' - netplan set --origin-hint ${yamlfile} bridges.br0.dhcp4=yes - netplan set --origin-hint ${yamlfile} bridges.br0.dhcp6=yes - show_message <<< "$(netplan get all)" - $DIALOG --title " Changing network settings " --yes-button "Yes" --no-button "Cancel" --yesno \ - "This action might disconnect you from network.\n\nAre you sure network was configured correctly?" 9 50 - if [[ $? = 0 ]]; then - # apply NetPlan - netplan apply - [[ "${NETWORK_RENDERER}" == "NetworkManager" ]] && systemctl restart NetworkManager; - else - restore_netplan_config - fi - elif [[ "${wiredmode}" == "static" ]]; then - local ips=() - for f in /sys/class/net/*; do - local intf=$(basename $f) - # skip unwanted - if [[ $intf =~ ^dummy0|^lo|^docker|^virbr ]]; then - continue - else - local tmp=$(ip -4 addr show dev $intf | grep -v "$intf:avahi" | awk '/inet/ {print $2}' | uniq) - [[ -n $tmp ]] && ips+=("$tmp") - fi - done - #address=${ips[@]} - address=${ips[0]} # use only 1st one - [[ -z "${address}" ]] && address="1.2.3.4/5" - # clean values from config - [[ -f /etc/netplan/${yamlfile}.yaml ]] && sed -i -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/bridges/{s/^\( *\).*/ \1/;x;d;}' /etc/netplan/${yamlfile}.yaml - address=$($DIALOG --title "Enter IP for $adapter" --inputbox "\nValid format: $address" 9 40 "$address" 3>&1 1>&2 2>&3) - if [[ -n $address && $? == 0 ]]; then - defaultroute=$(ip route show default | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]" | head -1 | xargs) - defaultroute=$($DIALOG --title "Enter IP for default route" --inputbox "\nValid format: $defaultroute" 9 40 "$defaultroute" 3>&1 1>&2 2>&3) - if [[ -n $defaultroute && $? == 0 ]]; then - nameservers="9.9.9.9,1.1.1.1" - nameservers=$($DIALOG --title "Enter DNS server" --inputbox "\nValid format: $nameservers" 9 40 "$nameservers" 3>&1 1>&2 2>&3) - else - restore_netplan_config - fi - if [[ -n $nameservers && $? == 0 ]]; then - netplan set --origin-hint ${yamlfile} renderer=${NETWORK_RENDERER} - netplan set --origin-hint ${yamlfile} ethernets.$adapter.dhcp4=no - netplan set --origin-hint ${yamlfile} ethernets.$adapter.dhcp6=no - netplan set --origin-hint ${yamlfile} bridges.br0.interfaces='['$adapter']' - netplan set --origin-hint ${yamlfile} bridges.br0.addresses='['$address']' - netplan set --origin-hint ${yamlfile} bridges.br0.routes='[{"to":"0.0.0.0/0", "via": "'$defaultroute'","metric":200}]' - netplan set --origin-hint ${yamlfile} bridges.br0.nameservers.addresses='['$nameservers']' - else - restore_netplan_config - fi - if [[ $? == 0 ]]; then - show_message <<< "$(netplan get all)" - $DIALOG --title " Changing network settings " --yes-button "Yes" --no-button "Cancel" --yesno \ - "This action might disconnect you from network.\n\nAre you sure network was configured correctly?" 9 50 - if [[ $? = 0 ]]; then - # apply NetPlan - netplan apply - [[ "${NETWORK_RENDERER}" == "NetworkManager" ]] && systemctl restart NetworkManager; - else - restore_netplan_config - fi - fi - else - restore_netplan_config - fi - else - restore_netplan_config - fi - fi - else - restore_netplan_config - fi -} - - -module_options+=( - ["toggle_ipv6,author"]="@Tearran" - ["toggle_ipv6,ref_link"]="" - ["toggle_ipv6,feature"]="toggle_ipv6" - ["toggle_ipv6,desc"]="Toggle IPv6 on or off" - ["toggle_ipv6,example"]="toggle_ipv6" - ["toggle_ipv6,status"]="review" - ["toggle_ipv6,doc_link"]="" -) -# -# Function to toggle IPv6 on or off -# -toggle_ipv6() { - # Check if IPv6 is currently enabled - if sysctl net.ipv6.conf.all.disable_ipv6 | grep -q 0; then - # If IPv6 is enabled, disable it - echo "Disabling IPv6..." - sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 - sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 - sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1 - echo "IPv6 is now disabled." - # Confirm that IPv6 is disabled - if sysctl net.ipv6.conf.all.disable_ipv6 | grep -q 1; then - check_ip_version google.com - else - check_ip_version google.com - fi - else - # If IPv6 is disabled, enable it - echo "Enabling IPv6..." - sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 - sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0 - sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0 - echo "IPv6 is now enabled." - # Confirm that IPv6 is enabled - if sysctl net.ipv6.conf.all.disable_ipv6 | grep -q 0; then - check_ip_version google.com - else - check_ip_version google.com - fi - fi - - # Now call the function with a domain name - -} - - -module_options+=( - ["see_ping,author"]="@Tearran" - ["see_ping,ref_link"]="https://github.com/Tearran/configng/blob/main/config.ng.functions.sh#632" - ["see_ping,feature"]="see_ping" - ["see_ping,desc"]="Check the internet connection with fallback DNS" - ["see_ping,example"]="see_ping" - ["see_ping,doc_link"]="" - ["see_ping,status"]="review" -) -# -# Function to check the internet connection -# -function see_ping() { - # List of servers to ping - servers=("1.1.1.1" "8.8.8.8") - - # Check for internet connection - for server in "${servers[@]}"; do - if ping -q -c 1 -W 1 $server > /dev/null; then - echo "Internet connection: Present" - break - else - echo "Internet connection: Failed" - sleep 1 - fi - done - - if [[ $? -ne 0 ]]; then - read -n -r 1 -s -p "Warning: Configuration cannot work properly without a working internet connection. \ - Press CTRL C to stop or any key to ignore and continue." - fi - -} - - -module_options+=( - ["default_wireless_network_config,author"]="@igorpecovnik" - ["default_wireless_network_config,ref_link"]="" - ["default_wireless_network_config,feature"]="default_wireless_network_config" - ["default_wireless_network_config,desc"]="Stop hostapd, clean config" - ["default_wireless_network_config,example"]="default_wireless_network_config" - ["default_wireless_network_config,doc_link"]="" - ["default_wireless_network_config,status"]="review" -) -function default_wireless_network_config(){ - - # defaul yaml file - local yamlfile=${1:-armbian} - local adapter=${2:-wlan0} - - # remove wifi from netplan - if [[ -f /etc/netplan/${yamlfile}.yaml ]]; then - sed -i -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/'$adapter':/{s/^\( *\).*/ \1/;x;d;}' /etc/netplan/${yamlfile}.yaml - sed -i -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/- '$adapter'/{s/^\( *\).*/ \1/;x;d;}' /etc/netplan/${yamlfile}.yaml - sed -i -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/wifis:/{s/^\( *\).*/ \1/;x;d;}' /etc/netplan/${yamlfile}.yaml - fi - - # remove networkd-dispatcher hook - rm -f /etc/networkd-dispatcher/carrier.d/armbian-ap - # remove network-manager dispatcher hook - rm -f /etc/NetworkManager/dispatcher.d/armbian-ap - - # hostapd needs more cleaning - if systemctl is-active hostapd 1> /dev/null; then - systemctl stop hostapd 2> /dev/null - systemctl disable hostapd 2> /dev/null - fi - - # apply config - netplan apply - - # exceptions - if [[ "${NETWORK_RENDERER}" == "NetworkManager" ]]; then - # uninstall packages - apt_install_wrapper apt-get -y --no-install-recommends purge hostapd - systemctl restart NetworkManager - else - # uninstall packages - apt_install_wrapper apt-get -y --no-install-recommends purge hostapd networkd-dispatcher - brctl delif br0 $adapter 2> /dev/null - networkctl reconfigure br0 - fi - -} - -module_options+=( - ["connect_bt_interface,author"]="@armbian" - ["connect_bt_interface,ref_link"]="" - ["connect_bt_interface,feature"]="connect_bt_interface" - ["connect_bt_interface,desc"]="Migrated procedures from Armbian config." - ["connect_bt_interface,example"]="connect_bt_interface" - ["connect_bt_interface,status"]="Active" -) -# -# connect to bluetooth device -# -function connect_bt_interface() { - - IFS=$' -' - GLOBIGNORE='*' - show_infobox <<< " -Discovering Bluetooth devices ... " - BT_INTERFACES=($(hcitool scan | sed '1d')) - - local LIST=() - for i in "${BT_INTERFACES[@]}"; do - local a=$(echo ${i[0]//[[:blank:]]/} | sed -e 's/^\(.\{17\}\).*/\1/') - local b=${i[0]//$a/} - local b=$(echo $b | sed -e 's/^[ ]*//') - LIST+=("$a" "$b") - done - - LIST_LENGTH=$((${#LIST[@]} / 2)) - if [ "$LIST_LENGTH" -eq 0 ]; then - BT_ADAPTER=${WLAN_INTERFACES[0]} - show_message <<< " -No nearby Bluetooth devices were found!" - else - exec 3>&1 - BT_ADAPTER=$(whiptail --title "Select interface" \ - --clear --menu "" $((6 + ${LIST_LENGTH})) 50 $LIST_LENGTH "${LIST[@]}" 2>&1 1>&3) - exec 3>&- - if [[ $BT_ADAPTER != "" ]]; then - show_infobox <<< " -Connecting to $BT_ADAPTER " - BT_EXEC=$( - expect -c 'set prompt "#";set address '$BT_ADAPTER';spawn bluetoothctl;expect -re $prompt;send "disconnect $address -"; - sleep 1;send "remove $address -";sleep 1;expect -re $prompt;send "scan on -";sleep 8;send "scan off -"; - expect "Controller";send "trust $address -";sleep 2;send "pair $address -";sleep 2;send "connect $address -"; - send_user " -Should be paired now. -";sleep 2;send "quit -";expect eof' - ) - echo "$BT_EXEC" > /tmp/bt-connect-debug.log - if [[ $(echo "$BT_EXEC" | grep "Connection successful") != "" ]]; then - show_message <<< " -Your device is ready to use!" - else - show_message <<< " -Error connecting. Try again!" - fi - fi - fi - -} - - -module_options+=( - ["check_ip_version,author"]="@Tearran" - ["check_ip_version,ref_link"]="" - ["check_ip_version,feature"]="check_ip_version" - ["check_ip_version,desc"]="Check if a domain is reachable via IPv4 and IPv6" - ["check_ip_version,example"]="check_ip_version google.com" - ["check_ip_version,status"]="review" - ["check_ip_version,doc_link"]="" -) -# -# -# -check_ip_version() { - domain=${1:-armbian.com} - - if ping -c 1 $domain > /dev/null 2>&1; then - echo "IPv4" - elif ping6 -c 1 $domain > /dev/null 2>&1; then - echo "IPv6" - else - echo "Unreachable" - fi -} - diff --git a/lib/armbian-config/config.runtime.sh b/lib/armbian-config/config.runtime.sh deleted file mode 100644 index 49f926a6..00000000 --- a/lib/armbian-config/config.runtime.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash - -# This script is used to dynamically modify a JSON structure that represents a menu in the Armbian configuration tool. -# It performs several checks, such as checking if certain packages are installed and determining the network protocol used. -# Based on these checks, it appends information to the descriptions of menu and submenu items, and shows or hides certain submenu items. -# The modified JSON structure is stored in the variable 'json_data'. - -set_colors 2 # Set the color to green - -# Dynamically updates a JSON menu structure based on system checks. - -# -# Initialize variables -system_info="$(uname -m)" -locale_setting="$LANG" -installed_software="$(see_current_apt)" -held_packages=$(apt-mark showhold) - -module_options+=( - ["update_json_data,author"]="@Tearran" - ["update_json_data,ref_link"]="" - ["update_json_data,feature"]="update_json_data" - ["update_json_data,desc"]="Update JSON data with system information" - ["update_json_data,example"]="update_json_data" - ["update_json_data,status"]="review" - ["update_json_data,doc_link"]="" - -) -# -# Update JSON data with system information -update_json_data() { - json_data=$(echo "$json_data" | jq --arg key "$1" --arg value "$2" \ - '(.menu[] | select(.id == $key).description) += " (" + $value + ")"') -} - -module_options+=( - ["update_submenu_data,author"]="@Tearran" - ["update_submenu_data,ref_link"]="" - ["update_submenu_data,feature"]="update_submenu_data" - ["update_submenu_data,desc"]="Update submenu descriptions based on conditions" - ["update_submenu_data,example"]="update_submenu_data" - ["update_submenu_data,status"]="review" - ["update_submenu_data,doc_link"]="" -) -# -# Update submenu descriptions based on conditions -update_submenu_data() { - json_data=$(echo "$json_data" | jq --arg key "$1" --arg subkey "$2" --arg value "$3" \ - '(.menu[] | select(.id==$key).sub[] | select(.id == $subkey).description) += " (" + $value + ")"') -} - - -module_options+=( - ["update_sub_submenu_data,author"]="@Tearran" - ["update_sub_submenu_data,feature"]="update_sub_submenu_data" - ["update_sub_submenu_data,desc"]="Update sub-submenu descriptions based on conditions" - ["update_sub_submenu_data,example"]="update_sub_submenu_data \"MenuID\" \"SubID\" \"SubSubID\" \"CMD\"" - ["update_sub_submenu_data,status"]="" -) -# -# Update sub-submenu descriptions based on conditions -update_sub_submenu_data() { - json_data=$(echo "$json_data" | jq --arg key "$1" --arg subkey "$2" --arg subsubkey "$3" --arg value "$4" \ - '(.menu[] | select(.id == $key).sub[] | - select(.id == $subkey).sub[] | - select(.id == $subsubkey).description) += " (" + $value + ")"') -} - -# -# Check if network adapter is IPv6 or IPv4 -network_adapter="$DEFAULT_ADAPTER" - -# -# Main menu updates -update_json_data "System" "$system_info" -update_json_data "Network" "$network_adapter" -update_json_data "Localisation" "$locale_setting" -update_json_data "Software" "$installed_software" - -# Conditional submenu updates based on network type -if [ "$network_adapter" = "IPv6" ]; then - update_submenu_data "Network" "N08" "IPV6" -else - update_submenu_data "Network" "N08" "IPV4" -fi - - -# -# Sub sub menu updates - -cockpit_port="$(systemctl cat cockpit.socket | grep ListenStream | awk -F= '{print $2}' | awk '{print $1}')" -update_sub_submenu_data "Software" "Management" "M03" "https://localhost:$cockpit_port" - -emby_media_port="$(lsof -i -P -n | grep TCP | grep LISTEN | grep 'emby' | awk -F: '{print $2}' | awk '{print $1}')" -update_sub_submenu_data "Software" "Media" "SW24" "https://localhost:$emby_media_port" - -plex_media_port="$(lsof -i -P -n | grep TCP | grep LISTEN | grep 'plex' | awk -F: '{print $2}' | awk '{print $1}' | head -n 1)" -update_sub_submenu_data "Software" "Media" "SW22" "https://localhost:$plex_media_port" - diff --git a/lib/armbian-config/config.software.sh b/lib/armbian-config/config.software.sh deleted file mode 100644 index 3f8582c6..00000000 --- a/lib/armbian-config/config.software.sh +++ /dev/null @@ -1,116 +0,0 @@ - -module_options+=( - ["install_embyserver,author"]="@schwar3kat" - ["install_embyserver,ref_link"]="" - ["install_embyserver,feature"]="install_embyserver" - ["install_embyserver,desc"]="Install embyserver from repo using apt" - ["install_embyserver,example"]="install_embyserver" - ["install_embyserver,status"]="Active" -) -# -# -# Download a deb file from a URL and install using wget and apt with dialog progress bars -# -install_embyserver() { - URL=$(curl -s https://api.github.com/repos/MediaBrowser/Emby.Releases/releases/latest | - grep "/emby-server-deb.*$(dpkg --print-architecture).deb" | cut -d : -f 2,3 | tr -d '"') - cd ~/ - wget -O "emby-server.deb" $URL 2>&1 | stdbuf -oL awk '/[.] +[0-9][0-9]?[0-9]?%/ { print substr($0,63,3) }' | - $DIALOG --gauge "Please wait\nDownloading ${URL##*/}" 8 70 0 - apt_install_wrapper apt-get -y install ~/emby-server.deb - unlink emby-server.deb - $DIALOG --msgbox "To test that Emby Server has installed successfully\nIn a web browser go to http://localhost:8096 or \nhttp://127.0.0.1:8096 on this computer." 9 70 -} - - -module_options+=( - ["install_docker,author"]="@schwar3kat" - ["install_docker,ref_link"]="" - ["install_docker,feature"]="install_docker" - ["install_docker,desc"]="Install docker from a repo using apt" - ["install_docker,example"]="install_docker engine" - ["install_docker,status"]="Active" -) -# -# Install Docker from repo using apt -# Setup sources list and GPG key then install the app. If you want a full desktop then $1=desktop -# -install_docker() { - # Check if repo for distribution exists. - URL="https://download.docker.com/linux/${DISTRO,,}/dists/$DISTROID" - if wget --spider "${URL}" 2> /dev/null; then - # Add Docker's official GPG key: - wget -qO - https://download.docker.com/linux/${DISTRO,,}/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/docker.gpg > /dev/null - if [[ $? -eq 0 ]]; then - # Add the repository to Apt sources: - cat <<- EOF > "/etc/apt/sources.list.d/docker.list" - deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/${DISTRO,,} $DISTROID stable - EOF - apt_install_wrapper apt-get update - # Install docker - if [ "$1" = "engine" ]; then - apt_install_wrapper apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin - else - apt_install_wrapper apt-get -y install docker-ce docker-ce-cli containerd.io - fi - systemctl enable docker.service > /dev/null 2>&1 - systemctl enable containerd.service > /dev/null 2>&1 - $DIALOG --msgbox "To test that Docker has installed successfully -run the following command: docker run hello-world" 9 70 - fi - else - $DIALOG --msgbox "ERROR ! ${DISTRO} $DISTROID distribution not found in repository!" 7 70 - fi -} - - - -module_options+=( - ["see_monitoring,author"]="@Tearran" - ["see_monitoring,ref_link"]="" - ["see_monitoring,feature"]="see_monitoring" - ["see_monitoring,desc"]="Menu for armbianmonitor features" - ["see_monitoring,example"]="see_monitoring" - ["see_monitoring,status"]="review" - ["see_monitoring,doc_link"]="" -) -# -# @decrition generate a menu for armbianmonitor -# -function see_monitoring() { - if [ -f /usr/bin/htop ]; then - choice=$(armbianmonitor -h | grep -Ev '^\s*-c\s|^\s*-M\s' | show_menu) - - armbianmonitor -$choice - - else - echo "htop is not installed" - fi -} - -module_options+=( - ["install_plexmediaserver,author"]="@schwar3kat" - ["install_plexmediaserver,ref_link"]="" - ["install_plexmediaserver,feature"]="install_plexmediaserver" - ["install_plexmediaserver,desc"]="Install plexmediaserver from repo using apt" - ["install_plexmediaserver,example"]="install_plexmediaserver" - ["install_plexmediaserver,status"]="Active" -) -# -# Install plexmediaserver using apt -# -install_plexmediaserver() { - if [ ! -f /etc/apt/sources.list.d/plexmediaserver.list ]; then - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/plexmediaserver.gpg] https://downloads.plex.tv/repo/deb public main" | sudo tee /etc/apt/sources.list.d/plexmediaserver.list > /dev/null 2>&1 - else - sed -i "/downloads.plex.tv/s/^#//g" /etc/apt/sources.list.d/plexmediaserver.list > /dev/null 2>&1 - fi - # Note: for compatibility with existing source file in some builds format must be gpg not asc - # and location must be /usr/share/keyrings - wget -qO- https://downloads.plex.tv/plex-keys/PlexSign.key | gpg --dearmor | sudo tee /usr/share/keyrings/plexmediaserver.gpg > /dev/null 2>&1 - apt_install_wrapper apt-get update - apt_install_wrapper apt-get -y install plexmediaserver - $DIALOG --msgbox "To test that Plex Media Server has installed successfully\nIn a web browser go to http://localhost:32400/web or\nhttp://127.0.0.1:32400/web on this computer." 9 70 -} - - diff --git a/lib/armbian-config/config.system.sh b/lib/armbian-config/config.system.sh deleted file mode 100644 index 9ff8fbf7..00000000 --- a/lib/armbian-config/config.system.sh +++ /dev/null @@ -1,789 +0,0 @@ - -module_options+=( -["store_netplan_config,author"]="@igorpecovnik" -["store_netplan_config,ref_link"]="" -["store_netplan_config,feature"]="Storing netplan config to tmp" -["store_netplan_config,desc"]="" -["store_netplan_config,example"]="" -["store_netplan_config,status"]="Active" -) -# -# @description Restoring Netplan configuration from temp folder -# -function restore_netplan_config() { - - echo "Restoring NetPlan configs" | show_infobox - # just in case - if [[ -n ${restore_netplan_config_folder} ]]; then - rm -f /etc/netplan/* - rsync -ar ${restore_netplan_config_folder}/. /etc/netplan - fi - -} - - - -module_options+=( - -["adjust_motd,author"]="@igorpecovnik" -["adjust_motd,ref_link"]="" -["adjust_motd,feature"]="about_armbian_configng" -["adjust_motd,desc"]="Adjust welcome screen (motd)" -["adjust_motd,example"]="adjust_motd clear, header, sysinfo, tips, commands" -["adjust_motd,status"]="Active" -) -# -# @description Toggle message of the day items -# -function adjust_motd() { - - # show motd description - motd_desc() { - case $1 in - clear) - echo "Clear screen on login" - ;; - header) - echo "Show header with logo" - ;; - sysinfo) - echo "Display system information" - ;; - tips) - echo "Show Armbian team tips" - ;; - commands) - echo "Show recommended commands" - ;; - *) - echo "No description" - ;; - esac - } - - # read status - function motd_status() { - source /etc/default/armbian-motd - if [[ $MOTD_DISABLE == *$1* ]]; then - echo "OFF" - else - echo "ON" - fi - } - - LIST=() - for v in $(grep THIS_SCRIPT= /etc/update-motd.d/* | cut -d"=" -f2 | sed "s/\"//g"); do - LIST+=("$v" "$(motd_desc $v)" "$(motd_status $v)") - done - - INLIST=($(grep THIS_SCRIPT= /etc/update-motd.d/* | cut -d"=" -f2 | sed "s/\"//g")) - CHOICES=$($DIALOG --separate-output --nocancel --title "Adjust welcome screen" --checklist "" 11 50 5 "${LIST[@]}" 3>&1 1>&2 2>&3) - INSERT="$(echo "${INLIST[@]}" "${CHOICES[@]}" | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ' | sed 's/ *$//')" - # adjust motd config - sed -i "s/^MOTD_DISABLE=.*/MOTD_DISABLE=\"$INSERT\"/g" /etc/default/armbian-motd - clear - find /etc/update-motd.d/. -type f -executable | sort | bash - echo "Press any key to return to armbian-config" - read -} - - -module_options+=( -["store_netplan_config,author"]="@igorpecovnik" -["store_netplan_config,ref_link"]="store_netplan_config" -["store_netplan_config,feature"]="store_netplan_config" -["store_netplan_config,desc"]="Storing netplan config to tmp" -["store_netplan_config,example"]="store_netplan_config" -["store_netplan_config,status"]="Active" -) -# -# @description Storing Netplan configuration to temp folder -# -function store_netplan_config () { - - # store current configs to temporal folder - restore_netplan_config_folder=$(mktemp -d /tmp/XXXXXXXXXX) - rsync --quiet /etc/netplan/* ${restore_netplan_config_folder}/ 2>/dev/null - trap restore_netplan_config 1 2 3 6 - -} - - - -module_options+=( - ["update_skel,author"]="@igorpecovnik" - ["update_skel,ref_link"]="" - ["update_skel,feature"]="update_skel" - ["update_skel,desc"]="Update the /etc/skel files in users directories" - ["update_skel,example"]="update_skel" - ["update_skel,status"]="Active" -) -# -# check dpkg status of $1 -- currently only 'not installed at all' case caught -# -function update_skel() { - - getent passwd | - while IFS=: read -r username x uid gid gecos home shell; do - if [ ! -d "$home" ] || [ "$username" == 'root' ] || [ "$uid" -lt 1000 ]; then - continue - fi - tar -C /etc/skel/ -cf - . | su - "$username" -c "tar --skip-old-files -xf -" - done - -} - - -module_options+=( - ["are_headers_installed,author"]="@viraniac" - ["are_headers_installed,ref_link"]="" - ["are_headers_installed,feature"]="are_headers_installed" - ["are_headers_installed,desc"]="Check if kernel headers are installed" - ["are_headers_installed,example"]="are_headers_installed" - ["are_headers_installed,status"]="Pending Review" - ["are_headers_installed,doc_link"]="" -) -# -# @description Install kernel headers -# -function are_headers_installed() { - if [[ -f /etc/armbian-release ]]; then - PKG_NAME="linux-headers-${BRANCH}-${LINUXFAMILY}" - else - PKG_NAME="linux-headers-$(uname -r | sed 's/'-$(dpkg --print-architecture)'//')" - fi - - check_if_installed ${PKG_NAME} - return $? -} - - -module_options+=( - ["manage_overlayfs,author"]="@igorpecovnik" - ["manage_overlayfs,ref_link"]="" - ["manage_overlayfs,feature"]="overlayfs" - ["manage_overlayfs,desc"]="Set Armbian root filesystem to read only" - ["manage_overlayfs,example"]="manage_overlayfs enable/disable" - ["manage_overlayfs,status"]="Active" -) -# -# @description set/unset Armbian root filesystem to read only -# -function manage_overlayfs() { - - if [[ "$1" == "enable" ]]; then - debconf-apt-progress -- apt-get -o Dpkg::Options::="--force-confold" -y install overlayroot cryptsetup cryptsetup-bin - [[ ! -f /etc/overlayroot.conf ]] && cp /etc/overlayroot.conf.dpkg-new /etc/overlayroot.conf - sed -i "s/^overlayroot=.*/overlayroot=\"tmpfs\"/" /etc/overlayroot.conf - sed -i "s/^overlayroot_cfgdisk=.*/overlayroot_cfgdisk=\"enabled\"/" /etc/overlayroot.conf - else - overlayroot-chroot rm /etc/overlayroot.conf > /dev/null 2>&1 - debconf-apt-progress -- apt-get -y purge overlayroot cryptsetup cryptsetup-bin - fi - # reboot is mandatory - reboot -} - - -module_options+=( - ["Headers_install,author"]="@Tearran" - ["Headers_install,ref_link"]="" - ["Headers_install,feature"]="Headers_install" - ["Headers_install,desc"]="Install kernel headers" - ["Headers_install,example"]="is_package_manager_running" - ["Headers_install,status"]="Pending Review" - ["Headers_install,doc_link"]="" -) -# -# @description Install kernel headers -# -function Headers_install() { - if ! is_package_manager_running; then - if [[ -f /etc/armbian-release ]]; then - INSTALL_PKG="linux-headers-${BRANCH}-${LINUXFAMILY}" - else - INSTALL_PKG="linux-headers-$(uname -r | sed 's/'-$(dpkg --print-architecture)'//')" - fi - debconf-apt-progress -- apt-get -y install ${INSTALL_PKG} - fi -} - - - - -module_options+=( - ["set_header_remove,author"]="@igorpecovnik" - ["set_header_remove,ref_link"]="" - ["set_header_remove,feature"]="set_header_remove" - ["set_header_remove,desc"]="Migrated procedures from Armbian config." - ["set_header_remove,example"]="set_header_remove" - ["set_header_remove,doc_link"]="" - ["set_header_remove,status"]="Active" - ["set_header_remove,doc_ink"]="" -) -# -# remove kernel headers -# -function set_header_remove() { - - REMOVE_PKG="linux-headers-*" - if [[ -n $(dpkg -l | grep linux-headers) ]]; then - debconf-apt-progress -- apt-get -y purge ${REMOVE_PKG} - rm -rf /usr/src/linux-headers* - else - debconf-apt-progress -- apt-get -y install ${INSTALL_PKG} - fi - # cleanup - apt clean - debconf-apt-progress -- apt -y autoremove - -} - - -module_options+=( - ["set_stable,author"]="@Tearran" - ["set_stable,ref_link"]="https://github.com/armbian/config/blob/master/debian-config-jobs#L1446" - ["set_stable,feature"]="set_stable" - ["set_stable,desc"]="Set Armbian to stable release" - ["set_stable,example"]="set_stable" - ["set_stable,status"]="Active" -) -# -# @description Set Armbian to stable release -# -function set_stable() { - - if ! grep -q 'apt.armbian.com' /etc/apt/sources.list.d/armbian.list; then - sed -i "s/http:\/\/[^ ]*/http:\/\/apt.armbian.com/" /etc/apt/sources.list.d/armbian.list - apt_install_wrapper apt-get update - armbian_fw_manipulate "reinstall" - fi -} - - -module_options+=( - ["armbian_fw_manipulate,author"]="@igorpecovnik" - ["armbian_fw_manipulate,ref_link"]="" - ["armbian_fw_manipulate,feature"]="armbian_fw_manipulate" - ["armbian_fw_manipulate,desc"]="freeze, unhold, reinstall armbian related packages." - ["armbian_fw_manipulate,example"]="armbian_fw_manipulate unhold/freeze/reinstall" - ["armbian_fw_manipulate,status"]="Active" -) -# -# freeze/unhold/reinstall armbian firmware packages -# -armbian_fw_manipulate() { - - local function=$1 - local version=$2 - local branch=$3 - - [[ -n $version ]] && local version="=${version}" - - # fallback to $BRANCH - [[ -z "${branch}" ]] && branch="${BRANCH}" - [[ -z "${branch}" ]] && branch="current" # fallback in case we switch to very old BSP that have no such info - - # packages to install - local armbian_packages=( - "linux-u-boot-${BOARD}-${branch}" - "linux-image-${branch}-${LINUXFAMILY}" - "linux-dtb-${branch}-${LINUXFAMILY}" - "armbian-zsh" - "armbian-bsp-cli-${BOARD}-${branch}" - ) - - # reinstall headers only if they were previously installed - if are_headers_installed; then - local armbian_packages+="linux-headers-${branch}-${LINUXFAMILY}" - fi - - local packages="" - for pkg in "${armbian_packages[@]}"; do - if [[ "${function}" == reinstall ]]; then - local pkg_search=$(apt search "$pkg" 2> /dev/null | grep "^$pkg") - if [[ $? -eq 0 && -n "${pkg_search}" ]]; then - if [[ "${pkg_search}" == *$version* ]] ; then - packages+="$pkg${version} "; - else - packages+="$pkg "; - fi - fi - else - if check_if_installed $pkg; then - packages+="$pkg${version} " - fi - fi - done - for pkg in "${packages[@]}"; do - case $function in - unhold) apt-mark unhold ${pkg} | show_infobox ;; - hold) apt-mark hold ${pkg} | show_infobox ;; - reinstall) - apt_install_wrapper apt-get -y --simulate --download-only --allow-change-held-packages --allow-downgrades install ${pkg} - if [[ $? == 0 ]]; then - apt_install_wrapper apt-get -y purge "linux-u-boot-*" "linux-image-*" "linux-dtb-*" "linux-headers-*" "armbian-zsh-*" "armbian-bsp-cli-*" # remove all branches - apt_install_wrapper apt-get -y --allow-change-held-packages install ${pkg} - apt_install_wrapper apt-get -y autoremove - apt_install_wrapper apt-get -y clean - else - exit 1 - fi - - - ;; - *) return ;; - esac - done -} - - -module_options+=( - ["manage_desktops,author"]="@igorpecovnik" - ["manage_desktops,ref_link"]="" - ["manage_desktops,feature"]="install_de" - ["manage_desktops,desc"]="Install Desktop environment" - ["manage_desktops,example"]="manage_desktops xfce install" - ["manage_desktops,status"]="Active" -) -# -# Install desktop -# -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 - - case "$command" in - install) - - # desktops has different default login managers - case "$desktop" in - gnome) - echo "/usr/sbin/gdm3" > /etc/X11/default-display-manager - #apt_install_wrapper DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get -y install gdm3 - ;; - kde-neon) - echo "/usr/sbin/sddm" > /etc/X11/default-display-manager - #apt_install_wrapper DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get -y install sddm - ;; - *) - echo "/usr/sbin/lightdm" > /etc/X11/default-display-manager - #apt_install_wrapper DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get -y install lightdm - ;; - esac - - # just make sure we have everything in order - apt_install_wrapper dpkg --configure -a - - # install desktop - export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true - 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 - - # 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 - - # enable auto login - manage_desktops "$desktop" "auto" - - # stop display managers in case we are switching them - service gdm3 stop - service lightdm stop - service sddm stop - - # start new default display manager - service display-manager restart - ;; - uninstall) - # we are uninstalling all variants until build time packages are fixed to prevent installing one over another - service display-manager stop - 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 cinnamon-session i3-wm - apt_install_wrapper apt-get -y autoremove - # disable autologins - rm -f /etc/gdm3/custom.conf - rm -f /etc/sddm.conf.d/autologin.conf - rm -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf - ;; - auto) - # desktops has different login managers and autologin methods - case "$desktop" in - gnome) - # gdm3 autologin - mkdir -p /etc/gdm3 - cat <<- EOF > /etc/gdm3/custom.conf - [daemon] - AutomaticLoginEnable = true - AutomaticLogin = ${user} - EOF - ;; - kde-neon) - # sddm autologin - cat <<- EOF > "/etc/sddm.conf.d/autologin.conf" - [Autologin] - User=${user} - EOF - ;; - *) - # lightdm autologin - mkdir -p /etc/lightdm/lightdm.conf.d - cat <<- EOF > "/etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf" - [Seat:*] - autologin-user=${user} - autologin-user-timeout=0 - user-session=xfce - EOF - - ;; - esac - # restart after selection - service display-manager restart - ;; - manual) - case "$desktop" in - gnome) rm -f /etc/gdm3/custom.conf ;; - kde-neon) rm -f /etc/sddm.conf.d/autologin.conf ;; - *) rm -f /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf ;; - esac - # restart after selection - service display-manager restart - ;; - esac - -} - - - -module_options+=( - ["apt_install_wrapper,author"]="@igorpecovnik" - ["apt_install_wrapper,ref_link"]="" - ["apt_install_wrapper,feature"]="Install wrapper" - ["apt_install_wrapper,desc"]="Install wrapper" - ["apt_install_wrapper,example"]="apt_install_wrapper apt-get -y purge armbian-zsh" - ["apt_install_wrapper,status"]="Active" -) -# -# @description Use TUI / GUI for apt install if exists -# -function apt_install_wrapper() { - - if [ -t 0 ]; then - debconf-apt-progress -- "$@" - else - # Terminal not defined - proceed without TUI - "$@" - fi -} - - -module_options+=( - ["change_system_hostname,author"]="@igorpecovnik" - ["change_system_hostname,ref_link"]="" - ["change_system_hostname,feature"]="Change hostname" - ["change_system_hostname,desc"]="change_system_hostname" - ["change_system_hostname,example"]="change_system_hostname" - ["change_system_hostname,status"]="Active" -) -# -# @description Change system hostname -# -function change_system_hostname() { - local new_hostname=$($DIALOG --title "Enter new hostnane" --inputbox "" 7 50 3>&1 1>&2 2>&3) - [ $? -eq 0 ] && [ -n "${new_hostname}" ] && hostnamectl set-hostname "${new_hostname}" -} - - - -menu_options+=( - ["get_headers_kernel,author"]="@igorpecovnik" - ["get_headers_kernel,ref_link"]="" - ["get_headers_kernel,feature"]="get_headers_install" - ["get_headers_kernel,desc"]="Migrated procedures from Armbian config." - ["get_headers_kernel,example"]="get_headers_install" - ["get_headers_kernel,status"]="Active" - ["get_headers_kernel,doc_link"]="" -) -# -# install kernel headers -# -function get_headers_install() { - - if [[ -f /etc/armbian-release ]]; then - INSTALL_PKG="linux-headers-${BRANCH}-${LINUXFAMILY}" - else - INSTALL_PKG="linux-headers-$(uname -r | sed 's/'-$(dpkg --print-architecture)'//')" - fi - - debconf-apt-progress -- apt-get -y install ${INSTALL_PKG} || exit 1 - -} - -module_options+=( - ["toggle_ssh_lastlog,author"]="@Tearran" - ["toggle_ssh_lastlog,ref_link"]="" - ["toggle_ssh_lastlog,feature"]="toggle_ssh_lastlog" - ["toggle_ssh_lastlog,desc"]="Toggle SSH lastlog" - ["toggle_ssh_lastlog,example"]="toggle_ssh_lastlog" - ["toggle_ssh_lastlog,status"]="Active" -) -# -# @description Toggle SSH lastlog -# -function toggle_ssh_lastlog() { - - if ! grep -q '^#\?PrintLastLog ' "${SDCARD}/etc/ssh/sshd_config"; then - # If PrintLastLog is not found, append it with the value 'yes' - echo 'PrintLastLog no' >> "${SDCARD}/etc/ssh/sshd_config" - sudo service ssh restart - else - # If PrintLastLog is found, toggle between 'yes' and 'no' - sed -i '/^#\?PrintLastLog / -{ - s/PrintLastLog yes/PrintLastLog no/; - t; - s/PrintLastLog no/PrintLastLog yes/ -}' "${SDCARD}/etc/ssh/sshd_config" - sudo service ssh restart - fi - -} - - - -module_options+=( - ["release_upgrade,author"]="@igorpecovnik" - ["release_upgrade,ref_link"]="" - ["release_upgrade,feature"]="Upgrade upstream distribution release" - ["release_upgrade,desc"]="Upgrade to next stable or rolling release" - ["release_upgrade,example"]="release_upgrade stable verify" - ["release_upgrade,status"]="Active" -) -# -# Upgrade distribution -# -release_upgrade(){ - - local upgrade_type=$1 - local verify=$2 - - local distroid=${DISTROID} - - if [[ "${upgrade_type}" == stable ]]; then - local filter=$(grep "supported" /etc/armbian-distribution-status | cut -d"=" -f1) - elif [[ "${upgrade_type}" == rolling ]]; then - local filter=$(grep "eos\|csc" /etc/armbian-distribution-status | cut -d"=" -f1 | sed "s/sid/testing/g") - else - local filter=$(cat /etc/armbian-distribution-status | cut -d"=" -f1) - fi - - local upgrade=$(for j in $filter; do - for i in $(grep "^${distroid}" /etc/armbian-distribution-status | cut -d";" -f2 | cut -d"=" -f2 | sed "s/,/ /g"); do - if [[ $i == $j ]]; then - echo $i - fi - done - done | tail -1) - - if [[ -z "${upgrade}" ]]; then - return 1; - elif [[ -z "${verify}" ]]; then - [[ -f /etc/apt/sources.list.d/ubuntu.sources ]] && sed -i "s/$distroid/$upgrade/g" /etc/apt/sources.list.d/ubuntu.sources - [[ -f /etc/apt/sources.list.d/debian.sources ]] && sed -i "s/$distroid/$upgrade/g" /etc/apt/sources.list.d/debian.sources - [[ -f /etc/apt/sources.list ]] && sed -i "s/$distroid/$upgrade/g" /etc/apt/sources.list - [[ "${upgrade}" == "testing" ]] && upgrade="sid" # our repo and everything is tied to sid - [[ -f /etc/apt/sources.list.d/armbian.list ]] && sed -i "s/$distroid/$upgrade/g" /etc/apt/sources.list.d/armbian.list - apt_install_wrapper apt-get -y update - apt_install_wrapper apt-get -y -o Dpkg::Options::="--force-confold" upgrade --without-new-pkgs - apt_install_wrapper apt-get -y -o Dpkg::Options::="--force-confold" full-upgrade - apt_install_wrapper apt-get -y --purge autoremove - fi -} - -module_options+=( - ["set_rolling,author"]="@Tearran" - ["set_rolling,ref_link"]="https://github.com/armbian/config/blob/master/debian-config-jobs#L1446" - ["set_rolling,feature"]="set_rolling" - ["set_rolling,desc"]="Set Armbian to rolling release" - ["set_rolling,example"]="set_rolling" - ["set_rolling,status"]="Active" -) -# -# @description Set Armbian to rolling release -# -function set_rolling() { - - if ! grep -q 'beta.armbian.com' /etc/apt/sources.list.d/armbian.list; then - sed -i "s/http:\/\/[^ ]*/http:\/\/beta.armbian.com/" /etc/apt/sources.list.d/armbian.list - apt_install_wrapper apt-get update - armbian_fw_manipulate "reinstall" - fi -} - - - -module_options+=( -["manage_dtoverlays,author"]="@viraniac" -["manage_dtoverlays,ref_link"]="" -["manage_dtoverlays,feature"]="dtoverlays" -["manage_dtoverlays,desc"]="Enable/disable device tree overlays" -["manage_dtoverlays,example"]="manage_dtoverlays" -["manage_dtoverlays,status"]="Active" -) -# -# @description Enable/disable device tree overlays -# -function manage_dtoverlays () { - # check if user agree to enter this area - local changes="false" - local overlayconf="/boot/armbianEnv.txt" - while true; do - local options=() - j=0 - available_overlays=$(ls -1 ${OVERLAY_DIR}/*.dtbo | sed "s#^${OVERLAY_DIR}/##" | sed 's/.dtbo//g' | grep $BOOT_SOC | tr '\n' ' ') - for overlay in ${available_overlays}; do - local status="OFF" - grep '^fdt_overlays' ${overlayconf} | grep -qw ${overlay} && status=ON - options+=( "$overlay" "" "$status") - done - selection=$($DIALOG --title "Manage devicetree overlays" --cancel-button "Back" \ - --ok-button "Save" --checklist "\nUse to toggle functions and save them.\nExit when you are done.\n " \ - 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3) - exit_status=$? - case $exit_status in - 0) - changes="true" - newoverlays=$(echo $selection | sed 's/"//g') - sed -i "s/^fdt_overlays=.*/fdt_overlays=$newoverlays/" ${overlayconf} - if ! grep -q "^fdt_overlays" ${overlayconf}; then echo "fdt_overlays=$newoverlays" >> ${overlayconf}; fi - sync - ;; - 1) - if [[ "$changes" == "true" ]]; then - $DIALOG --title " Reboot required " --yes-button "Reboot" \ - --no-button "Cancel" --yesno "A reboot is required to apply the changes. Shall we reboot now?" 7 34 - if [[ $? = 0 ]]; then - reboot - fi - fi - break - ;; - 255) - ;; - esac - done -} - -module_options+=( - ["Headers_remove,author"]="@Tearran" - ["Headers_remove,ref_link"]="https://github.com/armbian/config/blob/master/debian-config-jobs#L160" - ["Headers_remove,feature"]="Headers_remove" - ["Headers_remove,desc"]="Remove Linux headers" - ["Headers_remove,example"]="Headers_remove" - ["Headers_remove,status"]="Pending Review" - ["Headers_remove,doc_link"]="https://github.com/armbian/config/wiki#System" -) -# -# @description Remove Linux headers -# -function Headers_remove() { - if ! is_package_manager_running; then - REMOVE_PKG="linux-headers-*" - if [[ -n $(dpkg -l | grep linux-headers) ]]; then - debconf-apt-progress -- apt-get -y purge ${REMOVE_PKG} - rm -rf /usr/src/linux-headers* - else - debconf-apt-progress -- apt-get -y install ${INSTALL_PKG} - fi - # cleanup - apt clean - debconf-apt-progress -- apt -y autoremove - fi -} - - - -module_options+=( -["about_armbian_configng,author"]="@igorpecovnik" -["about_armbian_configng,ref_link"]="" -["about_armbian_configng,feature"]="about_armbian_configng" -["about_armbian_configng,desc"]="Show general information about this tool" -["about_armbian_configng,example"]="about_armbian_configng" -["about_armbian_configng,status"]="Active" -) -# -# @description Show general information about this tool -# -function about_armbian_configng() { - - echo "Armbian Config: The Next Generation" - echo "" - echo "How to make this tool even better?" - echo "" - echo "- propose new features or software titles" - echo " https://github.com/armbian/configng/issues/new?template=feature-reqests.yml" - echo "" - echo "- report bugs" - echo " https://github.com/armbian/configng/issues/new?template=bug-reports.yml" - echo "" - echo "- support developers with a small donation" - echo " https://github.com/sponsors/armbian" - echo "" - -} - -module_options+=( - ["switch_kernels,author"]="@igorpecovnik" - ["switch_kernels,ref_link"]="" - ["switch_kernels,feature"]="switch_kernels" - ["switch_kernels,desc"]="Switching to alternative kernels" - ["switch_kernels,example"]="switch_kernels" - ["switch_kernels,status"]="Active" -) -# -# @description Switch between alternative kernels -# -function switch_kernels() { - - # we only allow switching kerneles that are in the test pool - [[ -z "${KERNEL_TEST_TARGET}" ]] && KERNEL_TEST_TARGET="legacy,current,edge" - local kernel_test_target=$(for x in ${KERNEL_TEST_TARGET//,/ }; do echo "linux-image-$x-${LINUXFAMILY}"; done;) - local installed_kernel_version=$(dpkg -l | grep '^ii' | grep linux-image | awk '{print $2"="$3}') - # just in case current is not installed - [[ -n ${installed_kernel_version} ]] && local grep_current_kernel=" | grep -v ${installed_kernel_version}" - local search_exec="apt-cache show ${kernel_test_target} | grep -E \"Package:|Version:|version:|family\" | grep -v \"Config-Version\" | sed -n -e 's/^.*: //p' | sed 's/\.$//g' | xargs -n3 -d' -' | sed \"s/ /=/\" $grep_current_kernel" - IFS=$' -' - local LIST=() - for line in $(eval ${search_exec}); do - LIST+=($(echo $line | awk -F ' ' '{print $1 " "}') $(echo $line | awk -F ' ' '{print "v"$2}')) - done - unset IFS - local list_length=$((${#LIST[@]} / 2)) - if [ "$list_length" -eq 0 ]; then - dialog --backtitle "$BACKTITLE" --title " Warning " --msgbox " -No other kernels available!" 7 32 - else - local target_version=$(whiptail --separate-output --title "Select kernel" --menu "ed" $((${list_length} + 7)) 80 $((${list_length})) "${LIST[@]}" 3>&1 1>&2 2>&3) - if [ $? -eq 0 ] && [ -n "${target_version}" ]; then - local branch=${target_version##*image-} - armbian_fw_manipulate "reinstall" "${target_version/*=/}" "${branch%%-*}" - fi - fi -} - -