ADD EDIT + TOOLS

This commit is contained in:
2025-11-21 12:34:11 +01:00
parent 16fc39c343
commit 57e8203eb2
11 changed files with 741 additions and 527 deletions

View File

@@ -12,7 +12,13 @@ NEW_USERNAME=$(grep ":1000:" /etc/passwd | cut -d: -f1)
export NEW_USERHOME
export NEW_USERNAME
#
# Add user-setup and first-login-user-setup, so that they can be added to as needed and run at the end and on first login.
echo "#!/usr/bin/env bash" >>"$NEW_USERHOME"/.first-login-user-setup
chmod +x "$NEW_USERHOME"/.first-login-user-setup
chown "$NEW_USERNAME":"$NEW_USERNAME" "$NEW_USERHOME"/.first-login-user-setup
echo "#!/usr/bin/bash" >>"$NEW_USERHOME"/.user-setup
chmod +x "$NEW_USERHOME"/.user-setup
chown "$NEW_USERNAME":"$NEW_USERNAME" "$NEW_USERHOME"/.user-setup
# User command
#runuser -l "$NEW_USERNAME" -c 'commands'
#
@@ -142,7 +148,7 @@ DEBIAN_FRONTEND=noninteractive apt update
if lscpu | grep -iq "QEMU"; then
echo "QEMU Virtual CPU detected. Installing xrdp and restarting service..."
apt update
DEBIAN_FRONTEND=noninteractive apt -y install xserver-xorg picom arandr autorandr rofi xrdp xorgxrdp qemu-guest-agent xsecurelock xss-lock
DEBIAN_FRONTEND=noninteractive apt -y install xserver-xorg xserver-xorg-input-all picom arandr autorandr rofi xrdp xorgxrdp qemu-guest-agent xsecurelock xss-lock
usermod -aG xrdp "$NEW_USERNAME"
systemctl restart xrdp.service
ufw allow 3389/tcp comment Remote_Desktop_Protocol
@@ -158,7 +164,7 @@ DEBIAN_FRONTEND=noninteractive apt -y install bash-completion kitty bind9-dnsuti
DEBIAN_FRONTEND=noninteractive apt -y install build-essential dkms mokutil ufw gufw unzip cron openssh-server xdg-desktop-portal xdg-desktop-portal-gtk unattended-upgrades
#DEBIAN_FRONTEND=noninteractive apt -y install xdg-desktop-portal-wlr wofi
DEBIAN_FRONTEND=noninteractive apt -y install mc thunar gvfs gvfs-backends nsxiv mpv flameshot parted gparted mpd mpc ncmpcpp fzf ccrypt xarchiver notepadqq
DEBIAN_FRONTEND=noninteractive apt -y install colord mesa-utils htop tmux numlockx xdg-utils fancontrol xbacklight brightnessctl pm-utils ncdu less
DEBIAN_FRONTEND=noninteractive apt -y install colord mesa-utils htop btop tmux numlockx xdg-utils fancontrol xbacklight brightnessctl pm-utils ncdu less tealdeer
DEBIAN_FRONTEND=noninteractive apt -y install fwupd firmware-iwlwifi bluez-firmware
#
# Keyboard layouts, fonts, character sets and replacement tables for kbd / Keyboard
@@ -933,15 +939,14 @@ GTK4SETTINGS
CURRENT_HOSTNAME=$(hostname)
if [ "$CURRENT_HOSTNAME" = "danos" ] || [ "$CURRENT_HOSTNAME" = "debian" ]; then
# Generate and set a new hostname
THE_NEW_HOSTNAME="$(openssl rand -base64 6)-DanOS"
THE_NEW_HOSTNAME="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 6)-DanOS"
#THE_NEW_HOSTNAME="$(openssl rand -base64 6)-DanOS"
echo "$THE_NEW_HOSTNAME" | tee /etc/hostname
sed -i "s/127.0.1.1.*/127.0.1.1 $THE_NEW_HOSTNAME/" /etc/hosts
# Update /etc/machine-info (for systems using systemd)
#sed -i "s/HOSTNAME=.*/HOSTNAME=$THE_NEW_HOSTNAME/" /etc/machine-info
fi
#
echo "#!/usr/bin/env bash" >>"$NEW_USERHOME"/.first-login-user-setup
chown "$NEW_USERNAME":"$NEW_USERNAME" "$NEW_USERHOME"/.first-login-user-setup
#
# Remove extrepo_google_chrome.sources it makes its own source list file after installation
rm /etc/apt/sources.list.d/extrepo_google_chrome.sources
@@ -961,6 +966,19 @@ cat <<"FIRSTUSERLOGINSETUP" >>"$NEW_USERHOME"/.first-login-user-setup
if [ -f "$HOME/.first-login-user-setup" ]; then
echo "Running User first login setup..."
xdg-user-dirs-update
gsettings set org.gnome.desktop.interface color-scheme "prefer-dark"
gsettings set org.gnome.desktop.interface gtk-theme "EliverLara-Nordic"
# Remove first-login-user-setup file
rm -f "$HOME"/.first-login-user-setup
fi
#
FIRSTUSERLOGINSETUP
#
# Add user-setup
cat <<"USERSETUP" >>"$NEW_USERHOME"/.user-setup
# User setup
if [ -f "$HOME/.user-setup" ]; then
mkdir -p ~/Screenshots
xdg-mime default kitty.desktop text/x-shellscript
xdg-mime default nsxiv.desktop image/jpeg
@@ -968,15 +986,17 @@ if [ -f "$HOME/.first-login-user-setup" ]; then
xdg-mime default thunar.desktop inode/directory
# Set xdg-desktop-portal prefer dark mode.
# See more run: gsettings list-schemas
gsettings set org.gnome.desktop.interface color-scheme "prefer-dark"
gsettings set org.gnome.desktop.interface gtk-theme "EliverLara-Nordic"
# Sound systemctl enable --user
systemctl enable --user --now pipewire.socket pipewire-pulse.socket wireplumber.service
# Remove first-login-user-setup file
rm -f "$HOME"/.first-login-user-setup
# Remove .user-setup file
rm -f "$HOME"/.user-setup
fi
#
FIRSTUSERLOGINSETUP
USERSETUP
#
# Run first-login-user-setup under the installation
# shellcheck disable=SC2016
runuser -l "$NEW_USERNAME" -c '/usr/bin/bash $HOME/.user-setup'
#
# Add / Copy the ETC Environment
if [ -d /tmp/src/etc/ ]; then