diff --git a/README.md b/README.md index 97ed67f..6b14b45 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # isard-scripts -Template generation scripts for IsardVDI +Template generation scripts for IsardVDI ## Requisites -The app can be installed within any IsardVDI's virtual machine running an Ubuntu (Server and Desktop) 22.04 LTS, but the network interfaces must be setup in the following order: +The app can be installed within any IsardVDI's virtual machine running an Ubuntu (Server and Desktop) 22.04 LTS & 24.04 LTS, but the network interfaces must be setup in the following order: 1. Default: the isolated IsardVDI network which provides internet access. 2. Personal1: this network allows connecting virtual machines to each other (must be owned by the same user). 3. WireguardVPN: this network provides access through a tunnel, in order to connect any host local to the virtual machine. @@ -13,19 +13,20 @@ The app can be installed within any IsardVDI's virtual machine running an Ubuntu

## How to install -The app can be installed within any IsardVDI's virtual machine running an Ubuntu (Server and Desktop) 22.04 LTS: +The app can be installed within any IsardVDI's virtual machine running an Ubuntu (Server and Desktop) 22.04 LTS & 24.04 LTS: 1. Deploy the app cloning the repo: `git clone https://github.com/FherStk/isard-scripts.git` -2. Then, install the app with **sudo** (it will be installed at /etc/isard-scripts): +1. Go to the current distro's folder: `cd ubuntu-24.04` +1. Then, install the app with **sudo** (it will be installed at /etc/isard-scripts): ``` cd isard-scripts sudo ./install.sh history -c ``` -3. Shutdown the virtual machine and create a template from it. +1. Shutdown the virtual machine and create a template from it. ## How to run -1. The script's deployemnt prompt will be displayed on first boot (won't be disabled if the promt is cancelled), so the user will be able to choose which template must be deployed (select an option with space and `accept`) or do nothinc (`cancel`). The prompt can also be forced by running `sudo ./run.sh` after the user login. +1. The script's deployemnt prompt will be displayed on first boot (won't be disabled if the promt is cancelled), so the user will be able to choose which template must be deployed (select an option with space and `accept`) or do nothing (`cancel`). The prompt can also be forced by running `sudo ./run.sh` after the user login.

diff --git a/install.sh b/ubuntu-22.04/install.sh similarity index 96% rename from install.sh rename to ubuntu-22.04/install.sh index 7358c83..1cbf2a0 100755 --- a/install.sh +++ b/ubuntu-22.04/install.sh @@ -4,7 +4,7 @@ SCRIPT_NAME="App Install" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/utils/main.sh +source $SCRIPT_PATH/utils/core.sh startup apt-upgrade diff --git a/run.sh b/ubuntu-22.04/run.sh similarity index 79% rename from run.sh rename to ubuntu-22.04/run.sh index 66c0b76..96326af 100755 --- a/run.sh +++ b/ubuntu-22.04/run.sh @@ -4,7 +4,7 @@ SCRIPT_NAME="Script Installer" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/utils/main.sh +source $SCRIPT_PATH/utils/core.sh startup @@ -16,7 +16,7 @@ _folder="$SCRIPT_PATH/scripts" _options=$(find $_folder -mindepth 1 -maxdepth 1 -type f -name '*.sh' -printf "%f %TY-%Tm-%Td off\n" | sort -t '\0' -n | awk -F '\0' '{print $1}'); _options+=$(echo " NONE 1900-01-01 off") -_selected=$(dialog --title "$SCRIPT_NAME v$SCRIPT_VERSION" --radiolist "\nPick an IsardVDI script in order to install" 60 70 25 $_options --output-fd 1); +_selected=$(dialog --title "$SCRIPT_NAME v$SCRIPT_VERSION for $CORE_DISTRO" --radiolist "\nPick an IsardVDI script in order to install" 60 70 25 $_options --output-fd 1); clear for f in $_selected diff --git a/scripts/dbeaver-ce.sh b/ubuntu-22.04/scripts/dbeaver-ce.sh similarity index 97% rename from scripts/dbeaver-ce.sh rename to ubuntu-22.04/scripts/dbeaver-ce.sh index 7516a77..e09c3f4 100755 --- a/scripts/dbeaver-ce.sh +++ b/ubuntu-22.04/scripts/dbeaver-ce.sh @@ -5,7 +5,7 @@ HOST_NAME="dbeaver-ce" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup diff --git a/scripts/dhcp-server.sh b/ubuntu-22.04/scripts/dhcp-server.sh similarity index 97% rename from scripts/dhcp-server.sh rename to ubuntu-22.04/scripts/dhcp-server.sh index 3a3c6e1..62e9b29 100755 --- a/scripts/dhcp-server.sh +++ b/ubuntu-22.04/scripts/dhcp-server.sh @@ -5,7 +5,7 @@ HOST_NAME="dhcp-server" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup "static-address" diff --git a/scripts/dmoj-v4.sh b/ubuntu-22.04/scripts/dmoj-v4.sh similarity index 99% rename from scripts/dmoj-v4.sh rename to ubuntu-22.04/scripts/dmoj-v4.sh index df35cc3..556bc5e 100755 --- a/scripts/dmoj-v4.sh +++ b/ubuntu-22.04/scripts/dmoj-v4.sh @@ -11,7 +11,7 @@ DMOJ_SITE="$DMOJ_PATH/site" DMOJ_MEDIA="$DMOJ_PATH/media" DMOJ_VENV="$DMOJ_PATH/dmojsite" -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup diff --git a/scripts/gantt-project-v3.sh b/ubuntu-22.04/scripts/gantt-project-v3.sh similarity index 95% rename from scripts/gantt-project-v3.sh rename to ubuntu-22.04/scripts/gantt-project-v3.sh index e47523c..d48474d 100755 --- a/scripts/gantt-project-v3.sh +++ b/ubuntu-22.04/scripts/gantt-project-v3.sh @@ -5,7 +5,7 @@ HOST_NAME="gantt-project-v3" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup diff --git a/scripts/modelio-v4.sh b/ubuntu-22.04/scripts/modelio-v4.sh similarity index 97% rename from scripts/modelio-v4.sh rename to ubuntu-22.04/scripts/modelio-v4.sh index 6954bf1..5f1223b 100755 --- a/scripts/modelio-v4.sh +++ b/ubuntu-22.04/scripts/modelio-v4.sh @@ -5,7 +5,7 @@ HOST_NAME="modelio-v4" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup diff --git a/scripts/modelio-v5.sh b/ubuntu-22.04/scripts/modelio-v5.sh similarity index 95% rename from scripts/modelio-v5.sh rename to ubuntu-22.04/scripts/modelio-v5.sh index dd39529..1a339dc 100755 --- a/scripts/modelio-v5.sh +++ b/ubuntu-22.04/scripts/modelio-v5.sh @@ -5,7 +5,7 @@ HOST_NAME="modelio-v5" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup diff --git a/scripts/mysql-v8-default.sh b/ubuntu-22.04/scripts/mysql-v8-default.sh similarity index 90% rename from scripts/mysql-v8-default.sh rename to ubuntu-22.04/scripts/mysql-v8-default.sh index 84a0112..51033d0 100755 --- a/scripts/mysql-v8-default.sh +++ b/ubuntu-22.04/scripts/mysql-v8-default.sh @@ -5,7 +5,7 @@ HOST_NAME="mysql-server-v8" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup diff --git a/scripts/mysql-v8-remote.sh b/ubuntu-22.04/scripts/mysql-v8-remote.sh similarity index 96% rename from scripts/mysql-v8-remote.sh rename to ubuntu-22.04/scripts/mysql-v8-remote.sh index 62edd08..9a79386 100755 --- a/scripts/mysql-v8-remote.sh +++ b/ubuntu-22.04/scripts/mysql-v8-remote.sh @@ -5,7 +5,7 @@ HOST_NAME="mysql-server-v8" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup diff --git a/scripts/odoo-v16-container.sh b/ubuntu-22.04/scripts/odoo-v16-container.sh similarity index 98% rename from scripts/odoo-v16-container.sh rename to ubuntu-22.04/scripts/odoo-v16-container.sh index bd5c05c..9f39eef 100755 --- a/scripts/odoo-v16-container.sh +++ b/ubuntu-22.04/scripts/odoo-v16-container.sh @@ -5,7 +5,7 @@ HOST_NAME="odoo-v16" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup diff --git a/scripts/odoo-v16.sh b/ubuntu-22.04/scripts/odoo-v16.sh similarity index 91% rename from scripts/odoo-v16.sh rename to ubuntu-22.04/scripts/odoo-v16.sh index 18cd54d..ae61572 100755 --- a/scripts/odoo-v16.sh +++ b/ubuntu-22.04/scripts/odoo-v16.sh @@ -5,7 +5,7 @@ HOST_NAME="odoo-v16" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup diff --git a/scripts/open-project-v12.sh b/ubuntu-22.04/scripts/open-project-v12.sh similarity index 96% rename from scripts/open-project-v12.sh rename to ubuntu-22.04/scripts/open-project-v12.sh index 0076378..a43ee87 100755 --- a/scripts/open-project-v12.sh +++ b/ubuntu-22.04/scripts/open-project-v12.sh @@ -5,7 +5,7 @@ HOST_NAME="open-project-v12" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup diff --git a/scripts/pgadmin-v4.sh b/ubuntu-22.04/scripts/pgadmin-v4.sh similarity index 97% rename from scripts/pgadmin-v4.sh rename to ubuntu-22.04/scripts/pgadmin-v4.sh index 6ccef40..4f85f46 100755 --- a/scripts/pgadmin-v4.sh +++ b/ubuntu-22.04/scripts/pgadmin-v4.sh @@ -5,7 +5,7 @@ HOST_NAME="pgadmin-v4" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup diff --git a/scripts/psql-v14-default.sh b/ubuntu-22.04/scripts/psql-v14-default.sh similarity index 90% rename from scripts/psql-v14-default.sh rename to ubuntu-22.04/scripts/psql-v14-default.sh index 6253c35..d7968b5 100755 --- a/scripts/psql-v14-default.sh +++ b/ubuntu-22.04/scripts/psql-v14-default.sh @@ -5,7 +5,7 @@ HOST_NAME="psql-server-v14" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup diff --git a/scripts/psql-v14-remote.sh b/ubuntu-22.04/scripts/psql-v14-remote.sh similarity index 97% rename from scripts/psql-v14-remote.sh rename to ubuntu-22.04/scripts/psql-v14-remote.sh index a16ffcd..e261db1 100755 --- a/scripts/psql-v14-remote.sh +++ b/ubuntu-22.04/scripts/psql-v14-remote.sh @@ -5,7 +5,7 @@ HOST_NAME="psql-server-v14" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup diff --git a/scripts/taiga-v6.sh b/ubuntu-22.04/scripts/taiga-v6.sh similarity index 98% rename from scripts/taiga-v6.sh rename to ubuntu-22.04/scripts/taiga-v6.sh index 477ca74..832980a 100755 --- a/scripts/taiga-v6.sh +++ b/ubuntu-22.04/scripts/taiga-v6.sh @@ -6,7 +6,7 @@ HOST_NAME="taiga-v6" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) TAIGA_PATH="/etc/taiga" -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup diff --git a/scripts/ubuntu-desktop-2204.sh b/ubuntu-22.04/scripts/ubuntu-desktop-2204.sh similarity index 87% rename from scripts/ubuntu-desktop-2204.sh rename to ubuntu-22.04/scripts/ubuntu-desktop-2204.sh index 59ed683..1f92ea0 100755 --- a/scripts/ubuntu-desktop-2204.sh +++ b/ubuntu-22.04/scripts/ubuntu-desktop-2204.sh @@ -5,7 +5,7 @@ HOST_NAME="ubuntu-2204-desktop" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup diff --git a/scripts/ubuntu-server-2204.sh b/ubuntu-22.04/scripts/ubuntu-server-2204.sh similarity index 87% rename from scripts/ubuntu-server-2204.sh rename to ubuntu-22.04/scripts/ubuntu-server-2204.sh index 9a1362d..edd3a22 100755 --- a/scripts/ubuntu-server-2204.sh +++ b/ubuntu-22.04/scripts/ubuntu-server-2204.sh @@ -6,7 +6,7 @@ HOST_NAME="ubuntu-2204-server" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/../utils/main.sh +source $SCRIPT_PATH/../utils/core.sh startup script-setup diff --git a/update.sh b/ubuntu-22.04/update.sh similarity index 88% rename from update.sh rename to ubuntu-22.04/update.sh index e4b0f39..d36dfaf 100755 --- a/update.sh +++ b/ubuntu-22.04/update.sh @@ -4,7 +4,7 @@ SCRIPT_NAME="App Update" SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPT_FILE=$(basename $BASH_SOURCE) -source $SCRIPT_PATH/utils/main.sh +source $SCRIPT_PATH/utils/core.sh trap 'abort' 0 set -e diff --git a/utils/main.sh b/ubuntu-22.04/utils/core.sh similarity index 97% rename from utils/main.sh rename to ubuntu-22.04/utils/core.sh index 95cd881..61c0a57 100755 --- a/utils/main.sh +++ b/ubuntu-22.04/utils/core.sh @@ -1,10 +1,12 @@ #!/bin/bash #Global vars: +CORE_VERSION="1.15.0" +CORE_DISTRO="Ubuntu 22.04 LTS" BASE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) IS_DESKTOP=$(gnome-shell --version 2>/dev/null | grep -c "GNOME Shell") CURRENT_BRANCH="main" INSTALL_PATH="/etc/isard-scripts" -RUN_SCRIPT="sudo bash $INSTALL_PATH/run.sh" +RUN_SCRIPT="sudo bash $INSTALL_PATH/ubuntu-22.04/run.sh" PROFILE="/home/$SUDO_USER/.profile" AUTOSTART="/home/$SUDO_USER/.config/autostart" DESKTOPFILE="$AUTOSTART/isard-scripts.desktop" @@ -298,13 +300,13 @@ set-network-static() then #Ubuntu Desktop _file="/etc/netplan/01-network-manager-all.yaml" - cp $BASE_PATH/main/netplan-static-desktop.yaml $_file + cp $BASE_PATH/core/netplan-static-desktop.yaml $_file sed -i "s|x.x.x.x/yy|$1|g" $_file chmod 0600 $_file else #Ubuntu Server _file="/etc/netplan/00-network-manager-all.yaml" - cp $BASE_PATH/main/netplan-static-server.yaml $_file + cp $BASE_PATH/core/netplan-static-server.yaml $_file sed -i "s|x.x.x.x/yy|$1|g" $_file chmod 0600 $_file fi @@ -327,12 +329,12 @@ set-network-dhcp() then #Ubuntu Desktop _file="/etc/netplan/01-network-manager-all.yaml" - cp $BASE_PATH/main/netplan-dhcp-desktop.yaml $_file + cp $BASE_PATH/core/netplan-dhcp-desktop.yaml $_file chmod 0600 $_file else #Ubuntu Server _file="/etc/netplan/00-network-manager-all.yaml" - cp $BASE_PATH/main/netplan-dhcp-server.yaml $_file + cp $BASE_PATH/core/netplan-dhcp-server.yaml $_file chmod 0600 $_file fi @@ -348,8 +350,8 @@ set-network-names() #Output: N/A #################################################################################### - cp $BASE_PATH/main/isard-scripts-network-setup.sh /usr/local/bin/ - cp $BASE_PATH/main/isard-scripts-network-setup.service /etc/systemd/system/ + cp $BASE_PATH/core/isard-scripts-network-setup.sh /usr/local/bin/ + cp $BASE_PATH/core/isard-scripts-network-setup.service /etc/systemd/system/ chmod 744 /usr/local/bin/isard-scripts-network-setup.sh chmod 664 /etc/systemd/system/isard-scripts-network-setup.service @@ -591,7 +593,7 @@ auto-login-enable() _file="/etc/systemd/system/getty@tty1.service.d/override.conf" echo "Creating the file '$_file'" - cp $BASE_PATH/main/auto-login.conf $_file + cp $BASE_PATH/core/auto-login.conf $_file sed -i "s||$SUDO_USER|g" $_file fi } @@ -657,7 +659,7 @@ passwords-background() else #Server - _source="$BASE_PATH/main/50-landscape-sysinfo" + _source="$BASE_PATH/core/50-landscape-sysinfo" _dest="/etc/update-motd.d/50-landscape-sysinfo" echo "Creating entry into '$_dest'..." cp $_source $_dest @@ -688,8 +690,9 @@ info() echo "" echo -e "${YELLOW}IsardVDI Template Generator:$NC $1 [v$2]" - echo -e "${YELLOW}Copyright © 2023:$NC Fernando Porrino Serrano" - echo -e "${YELLOW}Under the AGPL license:$NC https://github.com/FherStk/isard-scripts/blob/main/LICENSE" + echo -e "${YELLOW}Core distro:$NC ${CORE_DISTRO} [v${CORE_VERSION}]" + echo -e "${YELLOW}Copyright © 2024:$NC Fernando Porrino Serrano" + echo -e "${YELLOW}Under the AGPL license:$NC https://github.com/FherStk/isard-scripts/blob/core/LICENSE" } startup(){ @@ -755,7 +758,7 @@ script-setup(){ echo "" title "Performing system setup:" echo "Disabling auto-upgrades..." - cp $BASE_PATH/main/auto-upgrades /etc/apt/apt.conf.d/20auto-upgrades + cp $BASE_PATH/core/auto-upgrades /etc/apt/apt.conf.d/20auto-upgrades dpkg-reconfigure -f noninteractive unattended-upgrades setup-hostname "$HOST_NAME" diff --git a/utils/main/50-landscape-sysinfo b/ubuntu-22.04/utils/core/50-landscape-sysinfo similarity index 100% rename from utils/main/50-landscape-sysinfo rename to ubuntu-22.04/utils/core/50-landscape-sysinfo diff --git a/utils/main/auto-login.conf b/ubuntu-22.04/utils/core/auto-login.conf similarity index 100% rename from utils/main/auto-login.conf rename to ubuntu-22.04/utils/core/auto-login.conf diff --git a/utils/main/auto-upgrades b/ubuntu-22.04/utils/core/auto-upgrades similarity index 100% rename from utils/main/auto-upgrades rename to ubuntu-22.04/utils/core/auto-upgrades diff --git a/utils/main/isard-scripts-network-setup.service b/ubuntu-22.04/utils/core/isard-scripts-network-setup.service similarity index 100% rename from utils/main/isard-scripts-network-setup.service rename to ubuntu-22.04/utils/core/isard-scripts-network-setup.service diff --git a/utils/main/isard-scripts-network-setup.sh b/ubuntu-22.04/utils/core/isard-scripts-network-setup.sh similarity index 100% rename from utils/main/isard-scripts-network-setup.sh rename to ubuntu-22.04/utils/core/isard-scripts-network-setup.sh diff --git a/utils/main/netplan-dhcp-desktop.yaml b/ubuntu-22.04/utils/core/netplan-dhcp-desktop.yaml similarity index 100% rename from utils/main/netplan-dhcp-desktop.yaml rename to ubuntu-22.04/utils/core/netplan-dhcp-desktop.yaml diff --git a/utils/main/netplan-dhcp-server.yaml b/ubuntu-22.04/utils/core/netplan-dhcp-server.yaml similarity index 100% rename from utils/main/netplan-dhcp-server.yaml rename to ubuntu-22.04/utils/core/netplan-dhcp-server.yaml diff --git a/utils/main/netplan-static-desktop.yaml b/ubuntu-22.04/utils/core/netplan-static-desktop.yaml similarity index 100% rename from utils/main/netplan-static-desktop.yaml rename to ubuntu-22.04/utils/core/netplan-static-desktop.yaml diff --git a/utils/main/netplan-static-server.yaml b/ubuntu-22.04/utils/core/netplan-static-server.yaml similarity index 100% rename from utils/main/netplan-static-server.yaml rename to ubuntu-22.04/utils/core/netplan-static-server.yaml diff --git a/utils/dhcp-server/50-ifup-hooks b/ubuntu-22.04/utils/dhcp-server/50-ifup-hooks similarity index 100% rename from utils/dhcp-server/50-ifup-hooks rename to ubuntu-22.04/utils/dhcp-server/50-ifup-hooks diff --git a/utils/dhcp-server/dhcpd.conf b/ubuntu-22.04/utils/dhcp-server/dhcpd.conf similarity index 100% rename from utils/dhcp-server/dhcpd.conf rename to ubuntu-22.04/utils/dhcp-server/dhcpd.conf diff --git a/utils/dhcp-server/isc-dhcp-server b/ubuntu-22.04/utils/dhcp-server/isc-dhcp-server similarity index 100% rename from utils/dhcp-server/isc-dhcp-server rename to ubuntu-22.04/utils/dhcp-server/isc-dhcp-server diff --git a/utils/dmoj/config.js b/ubuntu-22.04/utils/dmoj/config.js similarity index 100% rename from utils/dmoj/config.js rename to ubuntu-22.04/utils/dmoj/config.js diff --git a/utils/dmoj/dmoj-judge.service b/ubuntu-22.04/utils/dmoj/dmoj-judge.service similarity index 100% rename from utils/dmoj/dmoj-judge.service rename to ubuntu-22.04/utils/dmoj/dmoj-judge.service diff --git a/utils/dmoj/judge.yml b/ubuntu-22.04/utils/dmoj/judge.yml similarity index 100% rename from utils/dmoj/judge.yml rename to ubuntu-22.04/utils/dmoj/judge.yml diff --git a/utils/dmoj/nginx.conf b/ubuntu-22.04/utils/dmoj/nginx.conf similarity index 100% rename from utils/dmoj/nginx.conf rename to ubuntu-22.04/utils/dmoj/nginx.conf diff --git a/utils/dmoj/startup.sh b/ubuntu-22.04/utils/dmoj/startup.sh similarity index 100% rename from utils/dmoj/startup.sh rename to ubuntu-22.04/utils/dmoj/startup.sh diff --git a/utils/install/isard-scripts.desktop b/ubuntu-22.04/utils/install/isard-scripts.desktop similarity index 100% rename from utils/install/isard-scripts.desktop rename to ubuntu-22.04/utils/install/isard-scripts.desktop diff --git a/utils/mysql-v8-remote/mysql.cnf b/ubuntu-22.04/utils/mysql-v8-remote/mysql.cnf similarity index 100% rename from utils/mysql-v8-remote/mysql.cnf rename to ubuntu-22.04/utils/mysql-v8-remote/mysql.cnf diff --git a/utils/odoo-v16/install.sh b/ubuntu-22.04/utils/odoo-v16/install.sh similarity index 91% rename from utils/odoo-v16/install.sh rename to ubuntu-22.04/utils/odoo-v16/install.sh index 0613fd8..8dcdce1 100755 --- a/utils/odoo-v16/install.sh +++ b/ubuntu-22.04/utils/odoo-v16/install.sh @@ -1,6 +1,6 @@ #!/bin/bash SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -source $SCRIPT_PATH/../main.sh +source $SCRIPT_PATH/../core.sh echo "" title "Setting up the Odoo repository:" @@ -19,7 +19,7 @@ dpkg -i $_file rm -f $_file _file="libssl1.1.deb" -wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb -O $_file +wget http://security.ubuntu.com/ubuntu/pool/core/o/openssl/libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb -O $_file dpkg -i $_file rm -f $_file diff --git a/utils/odoo-v16/upgrade.sh b/ubuntu-22.04/utils/odoo-v16/upgrade.sh similarity index 73% rename from utils/odoo-v16/upgrade.sh rename to ubuntu-22.04/utils/odoo-v16/upgrade.sh index 1a940a4..fe0ccfc 100755 --- a/utils/odoo-v16/upgrade.sh +++ b/ubuntu-22.04/utils/odoo-v16/upgrade.sh @@ -1,5 +1,5 @@ #!/bin/bash SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -source $SCRIPT_PATH/../main.sh +source $SCRIPT_PATH/../core.sh apt-upgrade \ No newline at end of file diff --git a/utils/open-project-v12/installer.dat b/ubuntu-22.04/utils/open-project-v12/installer.dat similarity index 100% rename from utils/open-project-v12/installer.dat rename to ubuntu-22.04/utils/open-project-v12/installer.dat diff --git a/utils/taiga/startup.sh b/ubuntu-22.04/utils/taiga/startup.sh similarity index 100% rename from utils/taiga/startup.sh rename to ubuntu-22.04/utils/taiga/startup.sh diff --git a/utils/taiga/taiga.service b/ubuntu-22.04/utils/taiga/taiga.service similarity index 100% rename from utils/taiga/taiga.service rename to ubuntu-22.04/utils/taiga/taiga.service diff --git a/ubuntu-24.04/install.sh b/ubuntu-24.04/install.sh new file mode 100755 index 0000000..e6f6bef --- /dev/null +++ b/ubuntu-24.04/install.sh @@ -0,0 +1,41 @@ +#!/bin/bash +SCRIPT_VERSION="1.0.0" +SCRIPT_NAME="App Install" + +SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +SCRIPT_FILE=$(basename $BASH_SOURCE) +source $SCRIPT_PATH/utils/core.sh + +startup +apt-upgrade + +echo "" +title "Installing into $INSTALL_PATH:" +rm -rf $INSTALL_PATH + +get-branch +git clone https://github.com/FherStk/isard-scripts.git --branch $CURRENT_BRANCH $INSTALL_PATH + +sudo-password-disable +auto-login-enable + +echo "" +title "Setting up the first launch after user logon (just once):" +if [ $IS_DESKTOP -eq 1 ]; +then + #Ubuntu Desktop + echo "Setting up the $DESKTOPFILE entry..." + mkdir -p $AUTOSTART + cp $BASE_PATH/install/isard-scripts.desktop $DESKTOPFILE + sed -i "s||$INSTALL_PATH|g" $DESKTOPFILE + sed -i "s||$RUN_SCRIPT|g" $DESKTOPFILE +else + #Ubuntu Server + echo "Setting up the $PROFILE entry..." + append-no-repeat "$RUN_SCRIPT" "$PROFILE" +fi + +main-password-setup +done-no-reboot + +echo -e "${YELLOW}You can now proceed with additional customizations or just shutdown the computer and template it.$NC" \ No newline at end of file diff --git a/ubuntu-24.04/run.sh b/ubuntu-24.04/run.sh new file mode 100755 index 0000000..8c111a0 --- /dev/null +++ b/ubuntu-24.04/run.sh @@ -0,0 +1,37 @@ +#!/bin/bash +SCRIPT_VERSION="1.0.0" +SCRIPT_NAME="Script Installer" + +SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +SCRIPT_FILE=$(basename $BASH_SOURCE) +source $SCRIPT_PATH/utils/core.sh + +startup + +echo "" +trap 'clear' 0 + +unset _options +_folder="$SCRIPT_PATH/scripts" +_options=$(find $_folder -mindepth 1 -maxdepth 1 -type f -name '*.sh' -printf "%f %TY-%Tm-%Td off\n" | sort -t '\0' -n | awk -F '\0' '{print $1}'); +_options+=$(echo " NONE 1900-01-01 off") + +_selected=$(dialog --title "$SCRIPT_NAME v$SCRIPT_VERSION for $CORE_DISTRO" --radiolist "\nPick an IsardVDI script in order to install" 60 70 25 $_options --output-fd 1); +clear + +for f in $_selected +do + #Disabling auto-install only if some script has been selected (or "NONE" one) + #For Ubuntu Server + sed -i "s|$RUN_SCRIPT|#$RUN_SCRIPT|g" $PROFILE + #For Ubuntu Desktop + rm -f $DESKTOPFILE + + if [ "$f" != "NONE" ]; + then + #Running the script + source $SCRIPT_PATH/scripts/$f + fi +done + +trap : 0 \ No newline at end of file diff --git a/ubuntu-24.04/scripts/dbeaver-ce.sh b/ubuntu-24.04/scripts/dbeaver-ce.sh new file mode 100755 index 0000000..1381451 --- /dev/null +++ b/ubuntu-24.04/scripts/dbeaver-ce.sh @@ -0,0 +1,31 @@ +#!/bin/bash +SCRIPT_VERSION="1.0.0" +SCRIPT_NAME="Ubuntu Desktop 24.04 LTS (DBeaver Community Edition)" +HOST_NAME="dbeaver-ce" + +SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +SCRIPT_FILE=$(basename $BASH_SOURCE) +source $SCRIPT_PATH/../utils/core.sh + +startup +script-setup + +#INFO: Installing the snap package does not allow selecting the pgadmin root folder in order to use pg_resotre, and with the flatpak package it can work by installing aditional packages: +# 1 => io.dbeaver.DBeaverCommunity +# 2 => io.dbeaver.DBeaverCommunity.Client.mariadb io.dbeaver.DBeaverCommunity.Client.pgsql +# 3 => setup DBeaver to use as local client the path "/var/lib/flatpak/runtime/io.dbeaver.DBeaverCommunity.Client.pgsql/x86_64/stable/active/files/bin" +# +# In order to make it simple for the students, the .deb package will be installed manually. +#snap-install "dbeaver-ce" + +echo "" +title "Downloading DBeaver .deb package:" +wget https://dbeaver.io/files/dbeaver-ce_latest_amd64.deb -O dbeaver-ce.deb + + +echo "" +title "Installing DBeaver:" +dpkg -i dbeaver-ce.deb + +run-in-user-session gsettings set org.gnome.shell favorite-apps "['firefox_firefox.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop', 'dbeaver-ce.desktop']" +done-and-reboot \ No newline at end of file diff --git a/ubuntu-24.04/scripts/gantt-project-v3.sh b/ubuntu-24.04/scripts/gantt-project-v3.sh new file mode 100755 index 0000000..935389d --- /dev/null +++ b/ubuntu-24.04/scripts/gantt-project-v3.sh @@ -0,0 +1,29 @@ +#!/bin/bash +SCRIPT_VERSION="1.0.0" +SCRIPT_NAME="Ubuntu Desktop 24.04 LTS (GanttProject v3)" +HOST_NAME="gantt-project-v3" + +SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +SCRIPT_FILE=$(basename $BASH_SOURCE) +source $SCRIPT_PATH/../utils/core.sh + +startup +script-setup + +apt-install "openjdk-17-jre" + +echo "" +title "Downloading GanttProject:" +wget https://www.ganttproject.biz/dl/3.3.3309/lin -O ganttproject.deb + +echo "" +title "Installing GanttProject:" +dpkg -i ganttproject.deb +run-in-user-session gsettings set org.gnome.shell favorite-apps "['firefox_firefox.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop', 'ganttproject.desktop']" + +echo "" +title "Cleaning:" +echo "Removing downloaded data..." +rm -f ganttproject.deb + +done-and-reboot \ No newline at end of file diff --git a/ubuntu-24.04/scripts/mysql-v8-default.sh b/ubuntu-24.04/scripts/mysql-v8-default.sh new file mode 100755 index 0000000..f623443 --- /dev/null +++ b/ubuntu-24.04/scripts/mysql-v8-default.sh @@ -0,0 +1,26 @@ +#!/bin/bash +SCRIPT_VERSION="1.0.0" +SCRIPT_NAME="Ubuntu Server 24.04 LTS (MySQL v8 - Default setup)" +HOST_NAME="mysql-server-v8" + +SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +SCRIPT_FILE=$(basename $BASH_SOURCE) +source $SCRIPT_PATH/../utils/core.sh + +startup +script-setup +apt-install "mysql-server-8.0" + +#TODO: request if populate or not the demo BBDD +#echo "" +#title "Setting up the demo database:" +#rm -Rf test_db +#git clone https://github.com/datacharmer/test_db.git + +#cd test_db +#sudo -H -u root bash -c "mysql -t < employees.sql" +#cd .. +#rm -R test_db + +passwords-add "PostgreSQL" "root" "root" +done-and-reboot \ No newline at end of file diff --git a/ubuntu-24.04/scripts/mysql-v8-remote.sh b/ubuntu-24.04/scripts/mysql-v8-remote.sh new file mode 100755 index 0000000..cabcbb5 --- /dev/null +++ b/ubuntu-24.04/scripts/mysql-v8-remote.sh @@ -0,0 +1,35 @@ +#!/bin/bash +SCRIPT_VERSION="1.0.0" +SCRIPT_NAME="Ubuntu Server 24.04 LTS (MySQL v8 - With remote connections)" +HOST_NAME="mysql-server-v8" + +SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +SCRIPT_FILE=$(basename $BASH_SOURCE) +source $SCRIPT_PATH/../utils/core.sh + +startup +script-setup +apt-install "mysql-server-8.0" + +#TODO: request if populate or not the demo BBDD +#echo "" +#title "Setting up the demo database:" +#rm -Rf test_db +#git clone https://github.com/datacharmer/test_db.git + +#cd test_db +#sudo -H -u root bash -c "mysql -t < employees.sql" +#cd .. +#rm -R test_db + +echo "" +title "Setting up remote connections:" +echo "Opening the binding address to '*'..." +cp $SCRIPT_PATH/../utils/mysql-v8-remote/mysql.cnf /etc/mysql/mysql.conf.d/mysqld.cnf +service mysql restart + +echo "Creating the remote user 'root@%'..." +sudo -H -u root bash -c "mysql -e \"CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY 'root'; ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';\"" + +passwords-add "PostgreSQL" "root" "root" +done-and-reboot \ No newline at end of file diff --git a/ubuntu-24.04/scripts/open-project-v14.sh b/ubuntu-24.04/scripts/open-project-v14.sh new file mode 100755 index 0000000..cbb07ae --- /dev/null +++ b/ubuntu-24.04/scripts/open-project-v14.sh @@ -0,0 +1,34 @@ +#!/bin/bash +SCRIPT_VERSION="1.0.0" +SCRIPT_NAME="Ubuntu Server 24.04 LTS (Open-Project v14)" +HOST_NAME="open-project-v14" + +SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +SCRIPT_FILE=$(basename $BASH_SOURCE) +source $SCRIPT_PATH/../utils/core.sh + +startup +script-setup + +echo "" +title "Downloading OpenProject's public key:" +wget -qO- https://dl.packager.io/srv/opf/openproject/key | sudo apt-key add - + + +echo "" +title "Adding the repository:" +wget -O /etc/apt/sources.list.d/openproject.list https://dl.packager.io/srv/opf/openproject/stable/14/installer/ubuntu/24.04.repo + +apt update +apt-install "openproject" + +echo "" +title "Copying the auto-setup configuration file:" +cp $SCRIPT_PATH/../utils/open-project-v14/installer.dat /etc/openproject/installer.dat + +echo "" +title "Setting up Open-Project:" +openproject configure #non-interactive + +passwords-add "Open-Project (http://)" "admin" "admin" +done-and-reboot \ No newline at end of file diff --git a/ubuntu-24.04/scripts/pgadmin-v4.sh b/ubuntu-24.04/scripts/pgadmin-v4.sh new file mode 100755 index 0000000..f4952d1 --- /dev/null +++ b/ubuntu-24.04/scripts/pgadmin-v4.sh @@ -0,0 +1,34 @@ +#!/bin/bash +SCRIPT_VERSION="1.0.0" +SCRIPT_NAME="Ubuntu Desktop & Server 24.04 LTS (pgAdmin v4)" +HOST_NAME="pgadmin-v4" + +SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +SCRIPT_FILE=$(basename $BASH_SOURCE) +source $SCRIPT_PATH/../utils/core.sh + +startup +script-setup + +echo "" +title "Setting up the pgAdmin4 repository:" +curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg --yes +sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list' +apt update + +if [ $IS_DESKTOP -eq 1 ]; +then + #Ubuntu Desktop + apt-install "pgadmin4-desktop" + +else + #Ubuntu Server + _user="admin@admin.com" + _pass="admin" + apt-install "pgadmin4-web" + PGADMIN_SETUP_PASSWORD=$_pass PGADMIN_SETUP_EMAIL=$_user /usr/pgadmin4/bin/setup-web.sh --yes + passwords-add "pgAdmin4 (http:///pgadmin4)" "$_user" "$_pass" +fi + +run-in-user-session gsettings set org.gnome.shell favorite-apps "['firefox_firefox.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop', 'pgadmin4.desktop']" +done-and-reboot \ No newline at end of file diff --git a/ubuntu-24.04/scripts/psql-v16-default.sh b/ubuntu-24.04/scripts/psql-v16-default.sh new file mode 100755 index 0000000..6355e51 --- /dev/null +++ b/ubuntu-24.04/scripts/psql-v16-default.sh @@ -0,0 +1,15 @@ +#!/bin/bash +SCRIPT_VERSION="1.0.0" +SCRIPT_NAME="Ubuntu Server 24.04 LTS (PostgreSQL v16 - Default setup)" +HOST_NAME="psql-server-v16" + +SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +SCRIPT_FILE=$(basename $BASH_SOURCE) +source $SCRIPT_PATH/../utils/core.sh + +startup +script-setup +apt-install "postgresql-16" + +passwords-add "PostgreSQL" "postgres" "N/A" +done-and-reboot \ No newline at end of file diff --git a/ubuntu-24.04/scripts/psql-v16-remote.sh b/ubuntu-24.04/scripts/psql-v16-remote.sh new file mode 100755 index 0000000..fd5d2d4 --- /dev/null +++ b/ubuntu-24.04/scripts/psql-v16-remote.sh @@ -0,0 +1,44 @@ +#!/bin/bash +SCRIPT_VERSION="1.0.0" +SCRIPT_NAME="Ubuntu Server 24.04 LTS (PostgreSQL v16 - With remote connections)" +HOST_NAME="psql-server-v16" + +SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +SCRIPT_FILE=$(basename $BASH_SOURCE) +source $SCRIPT_PATH/../utils/core.sh + +startup +script-setup +apt-install "postgresql-16" +apt-install "unzip" + +echo "" +title "Setting up remote connections:" +echo "Preparing the localhost 'postgres' user..." +sudo -i -u postgres bash -c "psql -c \"ALTER USER postgres WITH PASSWORD 'postgres';\"" + +echo "Opening the binding address to '*'..." +sed -i "s|#listen_addresses = 'localhost'|listen_addresses = '*'|g" /etc/postgresql/16/main/postgresql.conf + +_pghba_file="/etc/postgresql/16/main/pg_hba.conf" +_pghba_line1="host all all 192.168.1.1/16 md5" #personal +_pghba_line2="host all all 10.0.0.1/8 md5" #vpn + +append-no-repeat "$_pghba_line1" "$_pghba_file" +append-no-repeat "$_pghba_line2" "$_pghba_file" + +service postgresql restart + +#TODO: request if populate or not the demo BBDD +# echo "" +# title "Setting up the demo database:" +# wget https://www.postgresqltutorial.com/wp-content/uploads/2019/05/dvdrental.zip -O dvdrental.zip +# unzip dvdrental.zip +# rm -f dvdrental.zip + +# PGPASSWORD=postgres psql -U postgres -h localhost -c "CREATE DATABASE dvdrental;" +# PGPASSWORD=postgres pg_restore -U postgres -h localhost -d dvdrental dvdrental.tar; +# rm -f dvdrental.tar + +passwords-add "PostgreSQL" "postgres" "postgres" +done-and-reboot \ No newline at end of file diff --git a/ubuntu-24.04/scripts/ubuntu-desktop-2404.sh b/ubuntu-24.04/scripts/ubuntu-desktop-2404.sh new file mode 100755 index 0000000..5c75c0a --- /dev/null +++ b/ubuntu-24.04/scripts/ubuntu-desktop-2404.sh @@ -0,0 +1,12 @@ +#!/bin/bash +SCRIPT_VERSION="1.0.0" +SCRIPT_NAME="Ubuntu Desktop 24.04 LTS (Default setup)" +HOST_NAME="ubuntu-desktop-2404" + +SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +SCRIPT_FILE=$(basename $BASH_SOURCE) +source $SCRIPT_PATH/../utils/core.sh + +startup +script-setup +done-and-reboot \ No newline at end of file diff --git a/ubuntu-24.04/scripts/ubuntu-server-2404.sh b/ubuntu-24.04/scripts/ubuntu-server-2404.sh new file mode 100755 index 0000000..dce9fe0 --- /dev/null +++ b/ubuntu-24.04/scripts/ubuntu-server-2404.sh @@ -0,0 +1,12 @@ +#!/bin/bash +SCRIPT_VERSION="1.0.0" +SCRIPT_NAME="Ubuntu Server 24.04 LTS (Default setup)" +HOST_NAME="ubuntu-server-2404" + +SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +SCRIPT_FILE=$(basename $BASH_SOURCE) +source $SCRIPT_PATH/../utils/core.sh + +startup +script-setup +done-and-reboot \ No newline at end of file diff --git a/ubuntu-24.04/update.sh b/ubuntu-24.04/update.sh new file mode 100755 index 0000000..a819e64 --- /dev/null +++ b/ubuntu-24.04/update.sh @@ -0,0 +1,16 @@ +#!/bin/bash +SCRIPT_VERSION="1.0.0" +SCRIPT_NAME="App Update" + +SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +SCRIPT_FILE=$(basename $BASH_SOURCE) +source $SCRIPT_PATH/utils/core.sh + +trap 'abort' 0 +set -e + +info "$SCRIPT_NAME" "$SCRIPT_VERSION" +auto-update false + +echo "" +trap : 0 \ No newline at end of file diff --git a/ubuntu-24.04/utils/core.sh b/ubuntu-24.04/utils/core.sh new file mode 100755 index 0000000..3fc4596 --- /dev/null +++ b/ubuntu-24.04/utils/core.sh @@ -0,0 +1,840 @@ +#!/bin/bash +#Global vars: +CORE_VERSION="1.0.0" +CORE_DISTRO="Ubuntu 24.04 LTS" +BASE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +IS_DESKTOP=$(gnome-shell --version 2>/dev/null | grep -c "GNOME Shell") +CURRENT_BRANCH="main" +INSTALL_PATH="/etc/isard-scripts" +RUN_SCRIPT="sudo bash $INSTALL_PATH/ubuntu-24.04/run.sh" +PROFILE="/home/$SUDO_USER/.profile" +AUTOSTART="/home/$SUDO_USER/.config/autostart" +DESKTOPFILE="$AUTOSTART/isard-scripts.desktop" +PASSWORDS="/home/$SUDO_USER/passwords.info" + +# Terminal colors: +# Black 0;30 Dark Gray 1;30 +# Red 0;31 Light Red 1;31 +# Green 0;32 Light Green 1;32 +# Brown/Orange 0;33 Yellow 1;33 +# Blue 0;34 Light Blue 1;34 +# Purple 0;35 Light Purple 1;35 +# Cyan 0;36 Light Cyan 1;36 +# Light Gray 0;37 White 1;37 +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +ORANGE='\033[0;33m' +CYAN='\033[0;36m' +LCYAN='\033[1;36m' +NC='\033[0m' # No Color + +abort() +{ + #################################################################################### + #Description: Used by "trap" in order to display the error message in red. + #Source: https://stackoverflow.com/a/22224317 + #Input: N/A + #Output: N/A + #################################################################################### + + echo "" + echo -e "${RED}An error occurred. Exiting...$NC" >&2 + exit 1 +} + +title(){ + #################################################################################### + #Description: Displays a title caption using the correct colors. + #Input: $1 => Main caption | $2 => secondary caption + #Output: N/A + #################################################################################### + + echo -e "${LCYAN}${1}${CYAN}${2}${NC}" +} + +apt-upgrade() +{ + #################################################################################### + #Description: Updates all the installed apps (apt/snap/flatpak). + #Input: N/A + #Output: N/A + #################################################################################### + + _file="/etc/needrestart/needrestart.conf" + if test -f "$_file"; then + #Note: this is needed in order to disable interactive prompts like service-restart on server systems + echo "" + title "Enabling non-interactive mode:" + echo "Disabling kernel restart warnings..." + sed -i 's/#$nrconf{restart} = '"'"'i'"'"';/$nrconf{restart} = '"'"'a'"'"';/g' $_file + sed -i 's/#$nrconf{kernelhints} = -1;/$nrconf{kernelhints} = -1;/g' $_file + fi + + echo "" + title "Upgrading the installed apps: " + apt update + apt upgrade -y + apt autoremove -y + + if [ $IS_DESKTOP -eq 1 ]; + then + snap refresh + + if [ $(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed") -eq 0 ]; + then + flatpak update -y + fi + fi +} + +auto-update() +{ + #################################################################################### + #Description: Updates this app and restarts it. + #Input: $1 => If 'true' then restarts the app + #Output: N/A + #################################################################################### + + echo "" + title "Checking for a new app version: " + get-branch + + if [ $(LC_ALL=C git -C $BASE_PATH status -uno | grep -c "Your branch is up to date with 'origin/$CURRENT_BRANCH'") -eq 1 ]; + then + echo -e "Up to date, skipping..." + else + echo "" + echo -e "${CYAN}New version found, updating...$NC" + git -C $BASE_PATH reset --hard origin/$CURRENT_BRANCH + git pull + echo "Update completed." + + if [ $1 = true ]; + then + echo "Restarting the app..." + + trap : 0 + bash $SCRIPT_PATH/$SCRIPT_FILE + exit 0 + fi + fi +} + +apt-install() +{ + #################################################################################### + #Description: Unnatended package install (if not installed) using apt. + #Input: $1 => The app name + #Output: N/A + #################################################################################### + + echo "" + if [ $(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed") -eq 0 ]; + then + title "Installing apt package: " "$1" + DEBIAN_FRONTEND=noninteractive apt install -y $1; + else + echo -e "${CYAN}Package ${LCYAN}${1}${CYAN} already installed, skipping...$NC" + fi +} + +pip-install() +{ + #################################################################################### + #Description: Installs an app (if not installed) using pip3. + #Input: $1 => The app name | $2 (optional) => The app version + #Output: N/A + #################################################################################### + + echo "" + if [ $(pip3 list 2>/dev/null | grep -io -c "$1") -eq 0 ]; + then + _text="Installing pip3 package: " + if [ -f "$MARK" ]; then + title "$_text" "$1 v$2" + pip3 install $1==$2; + else + title "$_text" "$1" + pip3 install $1; + fi + + else + echo -e "${CYAN}Package ${LCYAN}${1}${CYAN} already installed, skipping...$NC" + fi +} + +snap-install() +{ + #################################################################################### + #Description: Installs an app (if not installed) using snap. + #Input: $1 => The app name | $2 (optional) => The snap arguments (like '--classic') + #Output: N/A + #################################################################################### + + echo "" + if [ $(snap list | grep -c $1) -eq 0 ]; + then + title "Installing snap package: " "$1" + snap install $1 $2; + else + echo -e "${CYAN}Package ${LCYAN}${1}${CYAN} already installed, skipping...$NC" + fi +} + +flatpak-install() +{ + #################################################################################### + #Description: Installs an app (if not installed) using flatpak. + #Input: $1 => The app ID (like 'org.videolan.VLC') + #Output: N/A + #################################################################################### + + echo "" + if [ $(flatpak list | grep -c $1) -eq 0 ]; + then + title "Installing flatpak package: " "$1" + flatpak install --noninteractive --assumeyes $1; + else + echo -e "${CYAN}Package ${LCYAN}${1}${CYAN} already installed, skipping...$NC" + fi +} + +get-branch() +{ + #################################################################################### + #Description: Loads the current git branch. + #Input: N/A + #Output: CURRENT_BRANCH => The current git branch + #################################################################################### + + echo -e "Getting the current branch info..." + git -C $BASE_PATH fetch --all + CURRENT_BRANCH=$(git -C $BASE_PATH rev-parse --abbrev-ref HEAD) +} + +get-interface-address() +{ + #################################################################################### + #Description: Displays a graphical prompt with a list of the network interfaces. + #Input: $1 => the interface name + #Output: ADDRESS => the selected network interface. + #Source: https://stackoverflow.com/a/62578085 + #################################################################################### + ADDRESS=$(ip -br -4 a sh | grep "$1" | awk '{print $3}' | cut -d "/" -f 1) +} + +setup-network() +{ + #################################################################################### + #Description: Displays a graphical prompt and sets the current host's address using + # netplan. + #Input: $1 => The default new host address + #Output: N/A + #################################################################################### + + request-network-config $1 + + if [[ "$ADDRESS" == "DHCP" ]]; + then + set-network-dhcp + else + set-network-static $ADDRESS + fi +} + +setup-network-static() +{ + #################################################################################### + #Description: Displays a graphical prompt and sets an static address using netplan. + #Input: $1 => The default new host static address + #Output: N/A + #################################################################################### + + #Some scripts could force this (like dhcp-server.sh) + request-static-address "Network Configuration for 'Personal1 (enp2s0)' interface" "Enter the host address:" "$1" + set-network-static $ADDRESS +} + +setup-hostname() +{ + #################################################################################### + #Description: Displays a graphical prompt and sets the current host's name. + #Input: $1 => The default new host name + #Output: N/A + #################################################################################### + + _new_hostname=$(dialog --nocancel --title "Hostname Configuration" --inputbox "\nEnter the host name:" 8 40 $1 --output-fd 1) + clear + + set-hostname $_new_hostname +} + +set-hostname() +{ + #################################################################################### + #Description: Sets the current host's name. + #Input: $1 => The new host name + #Output: N/A + #################################################################################### + + echo "" + echo "Setting up hostname..." + + _old_hostname=$(hostname) + hostnamectl set-hostname $1 + sed -i "s/'$_old_hostname'/'$1'/g" /etc/hosts +} + +set-network-static() +{ + #################################################################################### + #Description: Sets an static address using netplan. + #Input: $1 => The new host static address + #Output: N/A + #################################################################################### + + #Some scripts could force this (like dhcp-server.sh) + echo "Setting up network data..." + if [ $IS_DESKTOP -eq 1 ]; + then + #Ubuntu Desktop + _file="/etc/netplan/01-network-manager-all.yaml" + cp $BASE_PATH/core/netplan-static-desktop.yaml $_file + sed -i "s|x.x.x.x/yy|$1|g" $_file + chmod 0600 $_file + else + #Ubuntu Server + _file="/etc/netplan/00-network-manager-all.yaml" + cp $BASE_PATH/core/netplan-static-server.yaml $_file + sed -i "s|x.x.x.x/yy|$1|g" $_file + chmod 0600 $_file + fi + + echo "Setting up netplan..." + netplan apply +} + +set-network-dhcp() +{ + #################################################################################### + #Description: Setups the netplan for using DHCP (without prompt). + #Input: N/A + #Output: N/A + #################################################################################### + + #Some scripts could force this2 + echo "Setting up network data..." + if [ $IS_DESKTOP -eq 1 ]; + then + #Ubuntu Desktop + _file="/etc/netplan/01-network-manager-all.yaml" + cp $BASE_PATH/core/netplan-dhcp-desktop.yaml $_file + chmod 0600 $_file + else + #Ubuntu Server + _file="/etc/netplan/00-network-manager-all.yaml" + cp $BASE_PATH/core/netplan-dhcp-server.yaml $_file + chmod 0600 $_file + fi + + echo "Setting up netplan..." + netplan apply +} + +set-network-names() +{ + #################################################################################### + #Description: Prepares the service which renames the network adapters names on boot. + #Input: N/A + #Output: N/A + #################################################################################### + + cp $BASE_PATH/core/isard-scripts-network-setup.sh /usr/local/bin/ + cp $BASE_PATH/core/isard-scripts-network-setup.service /etc/systemd/system/ + + chmod 744 /usr/local/bin/isard-scripts-network-setup.sh + chmod 664 /etc/systemd/system/isard-scripts-network-setup.service + + systemctl daemon-reload + systemctl enable isard-scripts-network-setup.service + + if [ $IS_DESKTOP -eq 1 ]; + then + run-in-user-session gsettings set org.gnome.nm-applet disable-disconnected-notifications "true" + run-in-user-session gsettings set org.gnome.nm-applet disable-connected-notifications "true" + fi +} + +request-network-config() +{ + #################################################################################### + #Description: Displays a graphical prompt for the network configuration. + #Input: $1 => The default static host address + #Output: ADDRESS => Returns "DHCP" or a network address + #################################################################################### + + echo "" + echo "Setting up host address..." + _title="Network Configuration for the 'Personal1 (enp2s0)' interface" + _selected=$(dialog --nocancel --title "$_title" --radiolist "\nSelect a configuration for the 'personal' network interface." 20 70 25 1 DHCP off 2 'Static IP address' on --output-fd 1); + clear + + for f in $_selected + do + if [[ "$f" == 1 ]]; + then + ADDRESS="DHCP" + else + request-static-address "$_title" "Please, select the IP address for the 'Personal1 (enp2s0)' interface:" "192.168.1.1/24" + fi + done +} + +request-interface() +{ + #################################################################################### + #Description: Displays a graphical prompt with a list of the network interfaces. + #Input: $1 => Title | $2 => Description + #Output: INTERFACE => the selected network interface. + #Source: https://stackoverflow.com/a/62578085 + #################################################################################### + ${1:-"Network Interfaces"} + ${2:-"Select a network interface:"} + + declare –a _interfaces=() + for iface in $(ip address | grep -oP '(^[\d]+:\s)\K[\d\w]+'); do + #mac=$(ip address show ${each} | grep -oP '(?<=link/ether\s)\K[\da-f:]+|(?<=link/loopback\s)\K[\da-f:]+') + #for address in $(ip address show ${iface} | grep -oP '(?<=inet\s)\K[\d.]+|(?<=inet6\s)\K[\da-f:]+'); do + for address in $(ip address show ${iface} | grep -oP '(?<=inet\s)\K[\d.]+'); do #exclude IPv& + _interfaces+=$(echo " $iface $address off") + done + done + + _selected=$(dialog --nocancel --title "$1" --radiolist "\n$2" 20 70 25 $_interfaces --output-fd 1); + clear + + for iface in $_selected + do + INTERFACE=$iface + done +} + +request-static-address() +{ + #################################################################################### + #Description: Displays a graphical prompt and requests an static address. + #Input: $1 => The title prompt. + #Input: $2 => The caption to display. + #Input: $3 => The default static address. + #Output: ADDRESS => The new static address + #################################################################################### + + ADDRESS=$(dialog --nocancel --title "$1" --inputbox "\n$2" 8 70 "$3" --output-fd 1) + if [ $(ipcalc -b $ADDRESS | grep -c "INVALID ADDRESS") -eq 1 ]; + then + request-static-address "$1" "$2" "$3" + else + clear + fi +} + +request-data() +{ + #################################################################################### + #Description: Displays a graphical prompt and requests some data. + #Input: $1 => The title prompt. + #Input: $2 => The caption to display. + #Input: $3 => If empty values are allowed. + #Input: $4 => The default value. + #Output: DATA => The read data. + #################################################################################### + + DATA=$(dialog --nocancel --title "$1" --inputbox "\n$2" 8 50 "$4" --output-fd 1) + if [ $3 = false ] && [ -z "$DATA" ]; + then + request-data "$1" "$2" "$3" "$4" + else + clear + fi +} + +done-no-reboot(){ + #################################################################################### + #Description: Cleans the temp data and the bash history, sets the background + # passwords (for desktop only) and prompts an ending message. + #Input: N/A + #Output: N/A + #################################################################################### + + clean + passwords-background + + echo "" + echo -e "${GREEN}DONE!$NC" + echo "" + trap : 0 +} + +done-and-reboot(){ + #################################################################################### + #Description: Cleans the temp data and the bash history, sets the background + # passwords (for desktop only) and reboots the system. + #Input: N/A + #Output: N/A + #################################################################################### + + clean + passwords-background + + echo "" + echo -e "${GREEN}DONE! Rebooting...$NC" + trap : 0 + reboot +} + +clean() +{ + #################################################################################### + #Description: Cleans the temp data and the bash history, no message prompted. + #Input: N/A + #Output: N/A + #################################################################################### + + echo "Clearing bash history..." + cat /dev/null > /home/$SUDO_USER/.bash_history + history -c +} + +append-no-repeat() +{ + #################################################################################### + #Description: Appends a line into a file if does not exist. + #Input: $1 => The line to append. | $2 => The file where append. + #Output: N/A + #################################################################################### + + grep -qxF "$1" "$2" || echo "$1" >> $2 +} + +run-in-user-session() { + #################################################################################### + #Description: Runs the given command for the current user (even if sudo) + #Source: https://stackoverflow.com/a/54720717 + #Input: $1 => the command to run + #Output: N/A + #################################################################################### + + _display_id=":$(find /tmp/.X11-unix/* | sed 's#/tmp/.X11-unix/X##' | head -n 1)" + _username=$(who | grep "\($_display_id\)" | awk '{print $1}') + _user_id=$(id -u "$_username") + _environment=("DISPLAY=$_display_id" "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$_user_id/bus") + + sudo -Hu "$_username" env "${_environment[@]}" "$@" +} + +sudo-password-enable() +{ + #################################################################################### + #Description: Enables the sudo password (the sudo password will be requested). + #Input: N/A + #Output: N/A + #################################################################################### + echo "" + title "Enabling sudo password..." + + _file="/etc/sudoers" + echo "Setting up the file '$_file'" + + _line="%sudo ALL=(ALL:ALL) NOPASSWD:ALL" + sed -i "s|$_line||g" $_file +} + +sudo-password-disable() +{ + #################################################################################### + #Description: Disables the sudo password (no sudo password will be requested). + #Input: N/A + #Output: N/A + #################################################################################### + echo "" + title "Disabling sudo password..." + + _file="/etc/sudoers" + echo "Setting up the file '$_file'" + + _line="%sudo ALL=(ALL:ALL) NOPASSWD:ALL" + append-no-repeat "$_line" "$_file" +} + +auto-login-enable() +{ + #################################################################################### + #Description: Enables auto-login (no user/password will be prompted) and also disables Wayland. + #Input: N/A + #Output: N/A + #################################################################################### + + echo "" + title "Enabling auto-login..." + + if [ $IS_DESKTOP -eq 1 ]; + then + #Ubuntu Desktop + _file="/etc/gdm3/custom.conf" + echo "Setting up the file '$_file'" + sed -i "s|AutomaticLoginEnable=False|AutomaticLoginEnable=True|g" $_file + sed -i "s|#WaylandEnable=false|WaylandEnable=false|g" $_file + + else + #Ubuntu Server + echo "Creating the folder..." + mkdir -p /etc/systemd/system/getty@tty1.service.d + + _file="/etc/systemd/system/getty@tty1.service.d/override.conf" + echo "Creating the file '$_file'" + cp $BASE_PATH/core/auto-login.conf $_file + sed -i "s||$SUDO_USER|g" $_file + fi +} + +auto-login-disable() +{ + #################################################################################### + #Description: Disables auto-login (user/password will be prompted). + #Input: N/A + #Output: N/A + #################################################################################### + + echo "" + title "Disabling auto-login..." + + if [ $IS_DESKTOP -eq 1 ]; + then + #Ubuntu Desktop + _file="/etc/gdm3/custom.conf" + echo "Setting up the file '$_file'" + sed -i "s|AutomaticLoginEnable=True|AutomaticLoginEnable=False|g" $_file + sed -i "s|WaylandEnable=false|#WaylandEnable=false|g" $_file + + else + #Ubuntu Server + _file="/etc/systemd/system/getty@tty1.service.d" + echo "Removing the file '$_file'" + rm -Rf $_file + fi +} + +passwords-background() +{ + #################################################################################### + #Description: Writes the passwords file content into the background image + # on desktop systems. + #Input: N/A + #Output: N/A + #################################################################################### + echo "" + title "Setting up the system credentials information:" + + if [ $(test -e $PASSWORDS && echo 1 || echo 0) -eq 0 ]; + then + #Only if no password file exists, for example when a script has been called manually (app not installed) + main-password-setup + fi + + if [ $IS_DESKTOP -eq 1 ]; + then + #Manual generation through terminal + #sudo convert /usr/share/backgrounds/warty-final-ubuntu.png -font helvetica -fill white -pointsize 36 -gravity SouthEast -annotate +50+100 "@/home/usuario/passwords.info" /usr/share/backgrounds/warty-final-ubuntu-text.png + + #Desktop + echo "Creating the background image..." + _source="/usr/share/backgrounds/warty-final-ubuntu.png" + _dest="/usr/share/backgrounds/warty-final-ubuntu-text.png" + rm -f $_dest + convert $_source -font helvetica -fill white -pointsize 36 -gravity SouthEast -annotate +50+100 "@$PASSWORDS" $_dest + + echo "Setting up the background image..." + run-in-user-session gsettings set org.gnome.desktop.background picture-uri file:///$_dest + + else + #Server + _source="$BASE_PATH/core/50-landscape-sysinfo" + _dest="/etc/update-motd.d/50-landscape-sysinfo" + echo "Creating entry into '$_dest'..." + cp $_source $_dest + sed -i "s||$PASSWORDS|g" $_dest + fi +} + +passwords-add(){ + #################################################################################### + #Description: Adds a password entry to the passwords file + #Input: $1 => Header | $2 => Username | $3 => Password + #Output: N/A + #################################################################################### + + echo "" >> $PASSWORDS + echo "$1" >> $PASSWORDS + echo "Username: $2" >> $PASSWORDS + echo "Password: $3" >> $PASSWORDS +} + +info() +{ + #################################################################################### + #Description: Displays the "slash screen" + #Input: N/A + #Output: N/A + #################################################################################### + + echo "" + echo -e "${YELLOW}IsardVDI Template Generator:$NC $1 [v$2]" + echo -e "${YELLOW}Core distro:$NC ${CORE_DISTRO} [v${CORE_VERSION}]" + echo -e "${YELLOW}Copyright © 2024:$NC Fernando Porrino Serrano" + echo -e "${YELLOW}Under the AGPL license:$NC https://github.com/FherStk/isard-scripts/blob/core/LICENSE" +} + +startup(){ + #################################################################################### + #Description: This method must be executed at the begining of each script: + # 1. Displays the splash + # 2. Checks for sudo + # 3. Updates to the lastest current app version + # 4. Updates all the installed apps + # 5. Install the installer requirements. + # + #Input: $1 => first-launch: when 0, avoids some redundant calls (like apt-update, etc.) + #Output: N/A + #################################################################################### + + trap 'abort' 0 + + #Splash "screen" + info "$SCRIPT_NAME" "$SCRIPT_VERSION" + + #Checking for "sudo" + if [ "$EUID" -ne 0 ] + then + echo "" + echo -e "${RED}Please, run with 'sudo'.$NC" + + trap : 0 + exit 0 + fi + + #Update if new versions + auto-update true + + echo "" + title "Reloading daemons:" + systemctl daemon-reload + echo "Done!" + + #Some packages are needed + echo "" + title "Installing requirements:" + apt update + apt-install "dialog" #for requesting information + apt-install "ipcalc" #for static address validation + + if [ $IS_DESKTOP -eq 1 ]; + then + apt-install "imagemagick-6.q16" #background passwords + sed -i "s| If 'ignore-address' the address setup will be ignored + #Output: N/A + #################################################################################### + + #must be the first one in order to prevent dpkg blockings + echo "" + title "Performing system setup:" + echo "Disabling auto-upgrades..." + cp $BASE_PATH/core/auto-upgrades /etc/apt/apt.conf.d/20auto-upgrades + dpkg-reconfigure -f noninteractive unattended-upgrades + + setup-hostname "$HOST_NAME" + + _address="192.168.1.1/24" + if [ "$1" == "static-address" ]; + then + setup-network-static $_address + elif [ "$1" == "dhcp-address" ]; + then + set-network-dhcp + else + setup-network $_address + fi + + set-network-names + apt-upgrade + + if [ $IS_DESKTOP -eq 1 ]; + then + apt-install "openssh-server" + apt-install "curl" + + #Ubuntu Desktop + echo "" + title "Setting up the desktop:" + echo "Disabling the session timeout..." + run-in-user-session gsettings set org.gnome.desktop.session idle-delay 0 + + echo "Attaching favourite apps to the dash..." + run-in-user-session gsettings set org.gnome.shell favorite-apps "['firefox_firefox.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop']" + + #else + #Ubuntu Server + fi +} + +main-password-setup(){ + #################################################################################### + #Description: This method creates the password file and requests for the main user and password. + #Input: $1 => The default username + #Input: $1 => The default password + #Output: N/A + #################################################################################### + + echo "" + title "Setting up the passwords file:" + echo "Creating the file..." + rm -f $PASSWORDS + touch $PASSWORDS + + echo "Storing basic data..." + if [ $IS_DESKTOP -eq 1 ]; + then + #Desktop + #Printing to an image unaligns the text :( + echo "#########################" >> $PASSWORDS + echo "# SYSTEM CREDENTIALS #" >> $PASSWORDS + echo "#########################" >> $PASSWORDS + else + #Server + echo "##########################" >> $PASSWORDS + echo "# SYSTEM CREDENTIALS #" >> $PASSWORDS + echo "##########################" >> $PASSWORDS + fi + + request-data "Main user's credentials" "Please, write the main user's name:" false $1 + _req_uname=$DATA + + request-data "Main user's credentials" "Please, write the main user's password:" true $2 + _req_upass=$DATA + + passwords-add "Ubuntu" $_req_uname $_req_upass +} \ No newline at end of file diff --git a/ubuntu-24.04/utils/core/50-landscape-sysinfo b/ubuntu-24.04/utils/core/50-landscape-sysinfo new file mode 100644 index 0000000..a627c19 --- /dev/null +++ b/ubuntu-24.04/utils/core/50-landscape-sysinfo @@ -0,0 +1,35 @@ +#!/bin/sh + +# don't try refresh this more than once per minute +# Due to cpu consumption and login delays (LP: #1893716) +stamp="/var/lib/landscape/landscape-sysinfo.cache" +NEED_UPDATE="FALSE" +[ -z "$(find "$stamp" -newermt 'now-1 minutes' 2> /dev/null)" ] && NEED_UPDATE="TRUE" + +if [ "$NEED_UPDATE" = "TRUE" ]; then + # pam_motd does not carry the environment + [ -f /etc/default/locale ] && . /etc/default/locale + export LANG + cores=$(grep -c ^processor /proc/cpuinfo 2>/dev/null) + [ "$cores" -eq "0" ] && cores=1 + threshold="${cores:-1}.0" + #if [ $(echo "`cut -f1 -d ' ' /proc/loadavg` < $threshold" | bc) -eq 1 ]; then + printf "\n System information as of %s\n\n%s\n" \ + "$(/bin/date)" \ + "$(/usr/bin/landscape-sysinfo)" \ + > "$stamp" + + #System credentials (isard-scripts) + echo "" >> "$stamp" + echo "System Credentials:" >> "$stamp" + tail -n +5 | column -t -o " " | awk '{a[FNR%3] = a[FNR%3] == "" ? $0 : a[FNR%3] "\t" $0} END{for(i=1;i<=3;i++) print a[i%3]}' | column -t -o " " -s "$(printf '\t')" >> "$stamp" + + #else + # # do not replace a formerly good result due to load + # if ! grep -q "System information as of" $stamp 2> /dev/null; then + # printf "\n System information disabled due to load higher than %s\n" "$threshold" > "$stamp" + # fi + #fi +fi + +[ ! -r "$stamp" ] || cat "$stamp" diff --git a/ubuntu-24.04/utils/core/auto-login.conf b/ubuntu-24.04/utils/core/auto-login.conf new file mode 100644 index 0000000..90495f4 --- /dev/null +++ b/ubuntu-24.04/utils/core/auto-login.conf @@ -0,0 +1,4 @@ +[Service] +ExecStart= +ExecStart=-/sbin/agetty --noissue --autologin %I $TERM +Type=idle \ No newline at end of file diff --git a/ubuntu-24.04/utils/core/auto-upgrades b/ubuntu-24.04/utils/core/auto-upgrades new file mode 100644 index 0000000..f066dcb --- /dev/null +++ b/ubuntu-24.04/utils/core/auto-upgrades @@ -0,0 +1,2 @@ +APT::Periodic::Update-Package-Lists "0"; +APT::Periodic::Unattended-Upgrade "0"; \ No newline at end of file diff --git a/ubuntu-24.04/utils/core/isard-scripts-network-setup.service b/ubuntu-24.04/utils/core/isard-scripts-network-setup.service new file mode 100644 index 0000000..885ed80 --- /dev/null +++ b/ubuntu-24.04/utils/core/isard-scripts-network-setup.service @@ -0,0 +1,11 @@ +[Unit] +#Time out too large if no DHCP found in group network... +#Wants=network-online.target +#After=network.target network-online.target + +[Service] +ExecStartPre= /bin/sh -c 'until ping -c1 google.com; do sleep 1; done;' +ExecStart=/usr/local/bin/isard-scripts-network-setup.sh + +[Install] +WantedBy=default.target diff --git a/ubuntu-24.04/utils/core/isard-scripts-network-setup.sh b/ubuntu-24.04/utils/core/isard-scripts-network-setup.sh new file mode 100644 index 0000000..b02a162 --- /dev/null +++ b/ubuntu-24.04/utils/core/isard-scripts-network-setup.sh @@ -0,0 +1,17 @@ +#!/bin/bash +ip link set enp1s0 down +ip link set enp2s0 down +ip link set enp3s0 down +ip link set enp4s0 down + +ip link set enp1s0 name Default +ip link set enp2s0 name Personal1 +ip link set enp3s0 name WireguardVPN +ip link set enp4s0 name GroupNetwork1 + +ip link set Default up +ip link set Personal1 up +ip link set WireguardVPN up +ip link set GroupNetwork1 up + +netplan apply \ No newline at end of file diff --git a/ubuntu-24.04/utils/core/netplan-dhcp-desktop.yaml b/ubuntu-24.04/utils/core/netplan-dhcp-desktop.yaml new file mode 100644 index 0000000..64bffbe --- /dev/null +++ b/ubuntu-24.04/utils/core/netplan-dhcp-desktop.yaml @@ -0,0 +1,24 @@ +# This is the network config written by 'isard-scripts' (https://github.com/FherStk/isard-scripts) +network: + version: 2 + renderer: NetworkManager + ethernets: + #Default (internet access only) + enp1s0: + dhcp4: true + dhcp-identifier: mac + #Personal1 (private network between IsardVDI machines) + enp2s0: + dhcp4: true + dhcp-identifier: mac + optional: true + #WireguardVPN (private VPN between IsardVDI and an external computer) + enp3s0: + dhcp4: true + dhcp-identifier: mac + optional: true + #GroupNetwork1 (private VPN between IsardVDI and an your corporation's computers) + enp4s0: + dhcp4: true + dhcp-identifier: mac + optional: true \ No newline at end of file diff --git a/ubuntu-24.04/utils/core/netplan-dhcp-server.yaml b/ubuntu-24.04/utils/core/netplan-dhcp-server.yaml new file mode 100644 index 0000000..e5d8ae2 --- /dev/null +++ b/ubuntu-24.04/utils/core/netplan-dhcp-server.yaml @@ -0,0 +1,23 @@ +# This is the network config written by 'isard-scripts' (https://github.com/FherStk/isard-scripts) +network: + version: 2 + ethernets: + #Default (internet access only) + enp1s0: + dhcp4: true + dhcp-identifier: mac + #Personal1 (private network between IsardVDI machines) + enp2s0: + dhcp4: true + dhcp-identifier: mac + optional: true + #WireguardVPN (private VPN between IsardVDI and an external computer) + enp3s0: + dhcp4: true + dhcp-identifier: mac + optional: true + #GroupNetwork1 (private VPN between IsardVDI and an your corporation's computers) + enp4s0: + dhcp4: true + dhcp-identifier: mac + optional: true \ No newline at end of file diff --git a/ubuntu-24.04/utils/core/netplan-static-desktop.yaml b/ubuntu-24.04/utils/core/netplan-static-desktop.yaml new file mode 100644 index 0000000..1c98b36 --- /dev/null +++ b/ubuntu-24.04/utils/core/netplan-static-desktop.yaml @@ -0,0 +1,24 @@ +# This is the network config written by 'isard-scripts' (https://github.com/FherStk/isard-scripts) +network: + version: 2 + renderer: NetworkManager + ethernets: + #Default (internet access only) + enp1s0: + dhcp4: true + dhcp-identifier: mac + #Personal1 (private network between IsardVDI machines) + enp2s0: + dhcp4: no + addresses: [x.x.x.x/yy] + optional: true + #WireguardVPN (private VPN between IsardVDI and an external computer) + enp3s0: + dhcp4: true + dhcp-identifier: mac + optional: true + #GroupNetwork1 (private VPN between IsardVDI and an your corporation's computers) + enp4s0: + dhcp4: true + dhcp-identifier: mac + optional: true \ No newline at end of file diff --git a/ubuntu-24.04/utils/core/netplan-static-server.yaml b/ubuntu-24.04/utils/core/netplan-static-server.yaml new file mode 100644 index 0000000..7ec7768 --- /dev/null +++ b/ubuntu-24.04/utils/core/netplan-static-server.yaml @@ -0,0 +1,23 @@ +# This is the network config written by 'isard-scripts' (https://github.com/FherStk/isard-scripts) +network: + version: 2 + ethernets: + #Default (internet access only) + enp1s0: + dhcp4: true + dhcp-identifier: mac + #Personal1 (private network between IsardVDI machines) + enp2s0: + dhcp4: no + addresses: [x.x.x.x/yy] + optional: true + #WireguardVPN (private VPN between IsardVDI and an external computer) + enp3s0: + dhcp4: true + dhcp-identifier: mac + optional: true + #GroupNetwork1 (private VPN between IsardVDI and an your corporation's computers) + enp4s0: + dhcp4: true + dhcp-identifier: mac + optional: true \ No newline at end of file diff --git a/ubuntu-24.04/utils/dhcp-server/50-ifup-hooks b/ubuntu-24.04/utils/dhcp-server/50-ifup-hooks new file mode 100644 index 0000000..3f560f7 --- /dev/null +++ b/ubuntu-24.04/utils/dhcp-server/50-ifup-hooks @@ -0,0 +1,2 @@ +#!/bin/bash +systemctl restart isc-dhcp-server.service \ No newline at end of file diff --git a/ubuntu-24.04/utils/dhcp-server/dhcpd.conf b/ubuntu-24.04/utils/dhcp-server/dhcpd.conf new file mode 100644 index 0000000..0d12a15 --- /dev/null +++ b/ubuntu-24.04/utils/dhcp-server/dhcpd.conf @@ -0,0 +1,8 @@ +# minimal sample /etc/dhcp/dhcpd.conf +default-lease-time 600; +max-lease-time 7200; + +subnet netmask { + interface ; + range ; +} \ No newline at end of file diff --git a/ubuntu-24.04/utils/dhcp-server/isc-dhcp-server b/ubuntu-24.04/utils/dhcp-server/isc-dhcp-server new file mode 100644 index 0000000..3608681 --- /dev/null +++ b/ubuntu-24.04/utils/dhcp-server/isc-dhcp-server @@ -0,0 +1,18 @@ +# Defaults for isc-dhcp-server (sourced by /etc/init.d/isc-dhcp-server) + +# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf). +#DHCPDv4_CONF=/etc/dhcp/dhcpd.conf +#DHCPDv6_CONF=/etc/dhcp/dhcpd6.conf + +# Path to dhcpd's PID file (default: /var/run/dhcpd.pid). +#DHCPDv4_PID=/var/run/dhcpd.pid +#DHCPDv6_PID=/var/run/dhcpd6.pid + +# Additional options to start dhcpd with. +# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead +#OPTIONS="" + +# On what interfaces should the DHCP server (dhcpd) serve DHCP requests? +# Separate multiple interfaces with spaces, e.g. "eth0 eth1". +INTERFACESv4="" +INTERFACESv6="" diff --git a/ubuntu-24.04/utils/install/isard-scripts.desktop b/ubuntu-24.04/utils/install/isard-scripts.desktop new file mode 100644 index 0000000..93bc711 --- /dev/null +++ b/ubuntu-24.04/utils/install/isard-scripts.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=Application +Path= +Exec=gnome-terminal --window --full-screen -- bash -c "" +Hidden=false +NoDisplay=false +X-GNOME-Autostart-enabled=true +Name[en_NG]=Terminal +Name=Terminal +Comment[en_NG]=Start Isard-Scripts On Startup +Comment=Start Isard-Scripts On Startup \ No newline at end of file diff --git a/ubuntu-24.04/utils/mysql-v8-remote/mysql.cnf b/ubuntu-24.04/utils/mysql-v8-remote/mysql.cnf new file mode 100644 index 0000000..93599f8 --- /dev/null +++ b/ubuntu-24.04/utils/mysql-v8-remote/mysql.cnf @@ -0,0 +1,79 @@ +# +# The MySQL database server configuration file. +# +# One can use all long options that the program supports. +# Run program with --help to get a list of available options and with +# --print-defaults to see which it would actually understand and use. +# +# For explanations see +# http://dev.mysql.com/doc/mysql/en/server-system-variables.html + +# Here is entries for some specific programs +# The following values assume you have at least 32M ram + +[mysqld] +# +# * Basic Settings +# +user = mysql +default-authentication-plugin=mysql_native_password +# pid-file = /var/run/mysqld/mysqld.pid +# socket = /var/run/mysqld/mysqld.sock +# port = 3306 +# datadir = /var/lib/mysql + + +# If MySQL is running as a replication slave, this should be +# changed. Ref https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_tmpdir +# tmpdir = /tmp +# +# Instead of skip-networking the default is now to listen only on +# localhost which is more compatible and is not less secure. +bind-address = * +mysqlx-bind-address = * +# +# * Fine Tuning +# +key_buffer_size = 16M +# max_allowed_packet = 64M +# thread_stack = 256K + +# thread_cache_size = -1 + +# This replaces the startup script and checks MyISAM tables if needed +# the first time they are touched +myisam-recover-options = BACKUP + +# max_connections = 151 + +# table_open_cache = 4000 + +# +# * Logging and Replication +# +# Both location gets rotated by the cronjob. +# +# Log all queries +# Be aware that this log type is a performance killer. +# general_log_file = /var/log/mysql/query.log +# general_log = 1 +# +# Error log - should be very few entries. +# +log_error = /var/log/mysql/error.log +# +# Here you can see queries with especially long duration +# slow_query_log = 1 +# slow_query_log_file = /var/log/mysql/mysql-slow.log +# long_query_time = 2 +# log-queries-not-using-indexes +# +# The following can be used as easy to replay backup logs or for replication. +# note: if you are setting up a replication slave, see README.Debian about +# other settings you may need to change. +# server-id = 1 +# log_bin = /var/log/mysql/mysql-bin.log +# binlog_expire_logs_seconds = 2592000 +max_binlog_size = 100M +# binlog_do_db = include_database_name +# binlog_ignore_db = include_database_name \ No newline at end of file diff --git a/ubuntu-24.04/utils/open-project-v14/installer.dat b/ubuntu-24.04/utils/open-project-v14/installer.dat new file mode 100644 index 0000000..40f228b --- /dev/null +++ b/ubuntu-24.04/utils/open-project-v14/installer.dat @@ -0,0 +1,26 @@ +openproject/edition default +openproject/admin_email admin@admin.com + +postgres/db_host 127.0.0.1 +postgres/db_port 45432 +postgres/db_name openproject +postgres/db_username openproject +postgres/db_password kFITfFsW1u4yrow6D7apAxpleXBBqkoE +postgres/addon_version v1 +postgres/autoinstall install + +server/autoinstall install +server/variant apache2 +server/hostname open-project +server/server_path_prefix +server/ssl no + +repositories/api-key fNiBfEDWTqmT0HGRoWCyHrNa1amG81Vu +repositories/svn-install install +repositories/svn-path /var/db/openproject/svn +repositories/apache-wrapper-token ZZKExtvjJwfH5I5aTMWmxmWGNgXFLArI +repositories/git-install install +repositories/git-path /var/db/openproject/git +repositories/git-http-backend /usr/lib/git-core/git-http-backend/ + +memcached/autoinstall install \ No newline at end of file