Skip to content

Commit

Permalink
fix a bunch of stuff and reduce logs
Browse files Browse the repository at this point in the history
  • Loading branch information
parmigggiana committed Jul 27, 2024
1 parent 303ad26 commit 3c776dc
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 160 deletions.
8 changes: 5 additions & 3 deletions chroot_scripts/10-software_installation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ set -e
echo "=== Software installation ==="
export DEBIAN_FRONTEND=noninteractive

apt-get -qq -o Dpkg::Use-Pty=false -y clean
apt-get -qq -o Dpkg::Use-Pty=false -y update
apt-get -qq -o Dpkg::Use-Pty=false -y clean >/dev/null
apt-get -qq -o Dpkg::Use-Pty=false -y update >/dev/null

# Remove useless packages, courtesy of "wajig large". Cool command.
# Do not remove mousepad, it removes xfce-goodies too
# /bin/bash -c 'DEBIAN_FRONTEND=noninteractive apt-get purge --auto-remove -y libreoffice libreoffice-core libreoffice-common ispell* gimp gimp-* aspell* hunspell* mythes* *sunpinyin* wpolish wnorwegian tegaki* task-thai task-thai-desktop xfonts-thai xiterm* task-khmer task-khmer-desktop fonts-khmeros khmerconverter'
# This is commented because none of these packages is present at this time

# Upgrade and install useful packages
apt-get -qq -o Dpkg::Use-Pty=false -y upgrade
apt-get -qq -o Dpkg::Use-Pty=false -y upgrade >/dev/null
# libxkbcommon-x11-0 may be not needed (see Add library to installation if needed #28)
apt-get -qq -o Dpkg::Use-Pty=false -y install \
alsa-firmware-loaders \
Expand All @@ -25,6 +25,7 @@ apt-get -qq -o Dpkg::Use-Pty=false -y install \
bluez-firmware \
ca-certificates \
cifs-utils \
cron \
curl \
dmidecode \
dnsutils \
Expand All @@ -37,6 +38,7 @@ apt-get -qq -o Dpkg::Use-Pty=false -y install \
firmware-netxen \
firmware-realtek \
firmware-samsung \
firmware-intel-sound \
firmware-ti-connectivity \
firmware-zd1211 \
geany \
Expand Down
6 changes: 3 additions & 3 deletions chroot_scripts/20-network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
echo "=== Network configuration ==="
update-ca-certificates
systemctl disable smartd
sudo tee /etc/NetworkManager/NetworkManager.conf <<EOF
sudo tee /etc/NetworkManager/NetworkManager.conf <<EOF >/dev/null
[main]
plugins=ifupdown,keyfile
Expand All @@ -16,13 +16,13 @@ sudo chmod 644 /etc/NetworkManager/NetworkManager.conf
systemctl enable NetworkManager

echo "=== DNS configuration ==="
sudo tee /etc/resolv.conf <<EOF
sudo tee /etc/resolv.conf <<EOF >/dev/null
# Generated by quel_tale and not systemd
nameserver 1.1.1.1
nameserver 8.8.8.8
EOF

sudo tee /etc/systemd/resolved.conf <<EOF
sudo tee /etc/systemd/resolved.conf <<EOF >/dev/null
# This file is not really part of systemd. It was edited by hand.
#
# Use 'systemd-analyze cat-config systemd/resolved.conf' to display the full config.
Expand Down
8 changes: 4 additions & 4 deletions chroot_scripts/20-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ echo "=== Shell and home configuration ==="
sudo -u $MISO_USERNAME mkdir -p /home/$MISO_USERNAME/Desktop
# sudo -u $MISO_USERNAME ln -sf ./Desktop /home/$MISO_USERNAME/Scrivania
# chsh -s /bin/zsh weee
sudo -u $MISO_USERNAME curl -L -o /home/$MISO_USERNAME/.zshrc https://git.grml.org/f/grml-etc-core/etc/zsh/zshrc
sudo -u $MISO_USERNAME curl -sL -o /home/$MISO_USERNAME/.zshrc https://git.grml.org/f/grml-etc-core/etc/zsh/zshrc >/dev/null
cp /home/$MISO_USERNAME/.zshrc /root/.zshrc

sudo -u $MISO_USERNAME rm /home/$MISO_USERNAME/.bash_history >/dev/null 2>/dev/null
rm /root/.bash_history >/dev/null 2>/dev/null

echo "=== Top configuration ==="
cp ./toprc /root/.toprc
sudo -u $MISO_USERNAME cp ./toprc /home/$MISO_USERNAME/.toprc
cp ./resources/toprc /root/.toprc
sudo -u $MISO_USERNAME cp ./resources/toprc /home/$MISO_USERNAME/.toprc

echo "=== XFCE configuration ==="
sudo -u $MISO_USERNAME mkdir -p /home/$MISO_USERNAME/.config/xfce4
rsync -a --force ./xfce4 /home/$MISO_USERNAME/.config
chown weee: -R /home/$MISO_USERNAME/.config
#echo "export XDG_DATA_DIRS=$XDG_DATA_DIRS:$HOME/Desktop >> $HOME/.zprofile"
echo 'export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/Desktop"' | sudo tee /etc/profile
sudo -u $MISO_USERNAME tee /home/$MISO_USERNAME/.config/autostart/light-locker.desktop <<EOF
sudo -u $MISO_USERNAME tee /home/$MISO_USERNAME/.config/autostart/light-locker.desktop <<EOF >/dev/null
[Desktop Entry]
Hidden=true
EOF
Expand Down
8 changes: 4 additions & 4 deletions chroot_scripts/30-locale.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash

echo "=== Locale configuration ==="
sudo tee /etc/locale.gen <<EOF
sudo tee /etc/locale.gen <<EOF >/dev/null
it_IT.UTF-8 UTF-8
en_US.UTF-8 UTF-8
EOF
sudo tee /etc/locale.conf <<EOF
sudo tee /etc/locale.conf <<EOF >/dev/null
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE=it_IT.UTF-8
Expand All @@ -31,7 +31,7 @@ update-locale

echo "=== Keymap configuration ==="
# Needed for sure on Debian 11:
sudo tee /etc/default/keyboard <<EOF
sudo tee /etc/default/keyboard <<EOF >/dev/null
XKBMODEL="pc105"
XKBLAYOUT="it,us"
XKBVARIANT=""
Expand All @@ -41,7 +41,7 @@ BACKSPACE="guess"
EOF
# Keyboard layout switcher:
sudo -u $MISO_USERNAME mkdir -p /home/$MISO_USERNAME/.config/autostart
sudo -u $MISO_USERNAME tee /home/$MISO_USERNAME/.config/autostart/fbxkb.desktop <<EOF
sudo -u $MISO_USERNAME tee /home/$MISO_USERNAME/.config/autostart/fbxkb.desktop <<EOF >/dev/null
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Expand Down
4 changes: 2 additions & 2 deletions chroot_scripts/30-ssh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# WEEEDebian creation script - a-porsia et al

echo "=== SSH daemon configuration ==="
sudo tee /etc/ssh/sshd_config <<EOF
sudo tee /etc/ssh/sshd_config <<EOF >/dev/null
# $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
Expand All @@ -25,7 +25,7 @@ Subsystem sftp /usr/lib/openssh/sftp-server
EOF

echo "=== s.sh ==="
sudo tee /usr/sbin/s.sh <<EOF
sudo tee /usr/sbin/s.sh <<EOF >/dev/null
#!/bin/bash
# enable and start sshd, print local IP and interface
Expand Down
25 changes: 21 additions & 4 deletions chroot_scripts/40-desktop.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
echo "=== Desktop shortcuts ==="
mkdir -p /home/$MISO_USERNAME/.config/WEEE\ Open
sudo -u $MISO_USERNAME mkdir -p /home/$MISO_USERNAME/.config/WEEE\ Open
for file in ./desktop/*.desktop; do
sudo -u $MISO_USERNAME cp $file /home/$MISO_USERNAME/Desktop
file=$(basename -s .desktop $file)
sudo -u $MISO_USERNAME cp ./img/$file.png /home/$MISO_USERNAME/.config/WEEE\ Open/
sudo -u $MISO_USERNAME chmod +x /home/$MISO_USERNAME/Desktop/$file.desktop
f=/home/$MISO_USERNAME/Desktop/$file.desktop
gio set -t string $f metadata::xfce-exe-checksum "$(sha256sum $f | awk '{print $1}')"
#su - $MISO_USERNAME -c "gio set -t string /home/$MISO_USERNAME/Desktop/Tarallo.desktop metadata::xfce-exe-checksum $(sha256sum /home/$MISO_USERNAME/Desktop/Tarallo.desktop | awk '{print $1}')"
done
sudo tee /home/$MISO_USERNAME/.config/autostart/trust_desktop_shortcuts.dekstop <<EOF >/dev/null
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=Trust Desktop Shortcuts
Comment=Automatically trust all the .desktop files on the desktop
Exec=for file in *.desktop; do gio set -t string \$file metadata::xfce-exe-checksum "\$(sha256sum \$file | awk '{print \$1}')"; done
Path=/home/$MISO_USERNAME/Desktop/
OnlyShowIn=XFCE;
StartupNotify=false
Terminal=false
Hidden=false
EOF
#sudo tee /etc/cron.d/desktop_shortcuts <<EOF >/dev/null
#@reboot weee for file in /home/$MISO_USERNAME/Desktop/*.desktop; do gio set -t string \$file metadata::xfce-exe-checksum "\$(sha256sum \$file | awk '{print \$1}')"; done
#EOF
#sudo tee /etc/cron.d/desktop_shortcuts <<EOF >/dev/null
#@reboot weee export XDG_DATA_DIRS=\$XDG_DATA_DIRS:/home/$MISO_USERNAME/Desktop
#EOF
14 changes: 7 additions & 7 deletions chroot_scripts/40-peracotta.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
echo "=== Prepare peracotta ==="
apt-get -qq -o Dpkg::Use-Pty=false install -y python3-pip pipx

sudo -u $MISO_USERNAME pipx ensurepath
sudo -u $MISO_USERNAME pipx install peracotta
sudo -u $MISO_USERNAME pipx ensurepath >/dev/null
sudo -u $MISO_USERNAME pipx install peracotta >/dev/null

echo '@reboot weee pipx upgrade peracotta' | sudo tee /etc/cron.d/peracotta_update

#sudo -u $MISO_USERNAME sh -c 'cd /home/$MISO_USERNAME/peracotta && python3 polkit.py'
sudo -u $MISO_USERNAME mkdir -p /home/$MISO_USERNAME/.config/WEEE\ Open/peracotta # Ensure the dir exists
sudo -u $MISO_USERNAME cp ./features.json /home/$MISO_USERNAME/.config/WEEE\ Open/peracotta/features.json
sudo -u $MISO_USERNAME cp ./resources/features.json /home/$MISO_USERNAME/.config/WEEE\ Open/peracotta/features.json

echo "=== Add env to peracotta ==="
if [[ -z "$TARALLO_TOKEN" ]]; then
missing="TARALLO_TOKEN"
missing="@ TARALLO_TOKEN not found in .env @"
fi
if [[ -z "$TARALLO_URL" ]]; then
if [[ -z "$missing" ]]; then
missing="TARALLO_URL"
missing="@ TARALLO_URL not found in .env @"
else
missing="TARALLO_URL and TARALLO_TOKEN"
missing="@ TARALLO_URL and TARALLO_TOKEN not found in .env @"
fi
fi
if [[ -n "$missing" ]]; then
Expand All @@ -28,7 +28,7 @@ if [[ -n "$missing" ]]; then
echo "@ @"
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
echo "@ @"
echo "@ $missing not found in .env @"
echo "$missing"
echo "@ You're missing out many great peracotta features! @"
echo "@ Check README for more info if you want to automate @"
echo "@ your life! @"
Expand Down
4 changes: 2 additions & 2 deletions chroot_scripts/40-pointerkeys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

echo "=== Pointerkeys thing ==="
sudo -u $MISO_USERNAME mkdir -p /home/$MISO_USERNAME/.config/autostart
sudo -u $MISO_USERNAME tee /home/$MISO_USERNAME/.config/autostart/Pointerkeys.desktop <<EOF
sudo -u $MISO_USERNAME tee /home/$MISO_USERNAME/.config/autostart/Pointerkeys.desktop <<EOF >/dev/null
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Expand All @@ -16,7 +16,7 @@ Terminal=false
Hidden=false
EOF

sudo -u $MISO_USERNAME tee /home/$MISO_USERNAME/Desktop/pointerkeys.txt <<EOF
sudo -u $MISO_USERNAME tee /home/$MISO_USERNAME/Desktop/pointerkeys.txt <<EOF >/dev/null
=== Controlling your mouse pointer with the keyboard ===
Hold shift and press num lock to enable this feature.
Expand Down
9 changes: 9 additions & 0 deletions chroot_scripts/50-cron.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
echo '=== Cleaning up Cron ==='
sudo rm /etc/cron.hourly/*
sudo rm /etc/cron.daily/*
sudo rm /etc/cron.weekly/*
sudo rm /etc/cron.monthly/*
sudo rm /etc/cron.yearly/*

echo '=== Setting cron.d executable ==='
sudo chmod +x /etc/cron.d/*
127 changes: 0 additions & 127 deletions chroot_scripts/99-asd.sh
Original file line number Diff line number Diff line change
@@ -1,133 +1,6 @@
#!/bin/bash
# WEEEDebian creation script - a-porsia et al

echo "=== SSH daemon configuration ==="
cp ./sshd_config /etc/ssh/sshd_config

echo "=== Modules configuration ==="
_MODULES=("eeprom" "at24" "ee1004" "i2c-i801")
for i in ${!_MODULES[@]}; do
if [[ ! -f "/etc/modules-load.d/${_MODULES[$i]}.conf" ]]; then
printf "${_MODULES[$i]}\n" >/etc/modules-load.d/${_MODULES[$i]}.conf
fi
done

echo "=== DNS configuration ==="
cp ./resolv.conf /etc/resolv.conf
cp ./resolved.conf /etc/systemd/resolved.conf
rm -f /var/run/NetworkManager/* 2>/dev/null

echo "=== NTP configuration ==="
systemctl enable systemd-timesyncd
rm -f /etc/localtime
ln -s /usr/share/zoneinfo/Europe/Rome /etc/localtime

echo "=== Top configuration ==="
cp ./toprc /root/.toprc
sudo -u $MISO_USERNAME cp ./toprc /home/$MISO_USERNAME/.toprc

echo "=== Prepare peracotta ==="
apt-get install -y python3-pip pipx

sudo -u $MISO_USERNAME pipx ensurepath
sudo -u $MISO_USERNAME pipx install peracotta

cp ./peracotta_update /etc/cron.d/peracotta_update

#sudo -u $MISO_USERNAME sh -c 'cd /home/$MISO_USERNAME/peracotta && python3 polkit.py'
sudo -u $MISO_USERNAME mkdir -p /home/$MISO_USERNAME/.config/WEEE\ Open/peracotta # Ensure the dir exists
sudo -u $MISO_USERNAME cp ./features.json /home/$MISO_USERNAME/.config/WEEE\ Open/peracotta/features.json

echo "=== Add env to peracotta ==="
if [[ -f "./env.txt" ]]; then
sudo -u $MISO_USERNAME cp ./env.txt /home/$MISO_USERNAME/.config/WEEE\ Open/peracotta/.env
else
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
echo "@ @"
echo "@ WARNING @"
echo "@ @"
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
echo "@ @"
echo "@ env.txt not found in weeedebian/. @"
echo "@ You're missing out many great peracotta features! @"
echo "@ Check README for more info if you want to create the @"
echo "@ file and automate your life! @"
echo "@ @"
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
fi

echo "=== s.sh ==="
cp ./s.sh /usr/sbin/s.sh
chmod +x /usr/sbin/s.sh
sudo -u $MISO_USERNAME cp ./ssh.desktop /home/$MISO_USERNAME/Desktop
sudo -u $MISO_USERNAME chmod +x /home/$MISO_USERNAME/Desktop/ssh.desktop
# su - $MISO_USERNAME -c "gio set -t string /home/$MISO_USERNAME/Desktop/ssh.desktop metadata::xfce-exe-checksum $(sha256sum /home/$MISO_USERNAME/Desktop/ssh.desktop | awk '{print $1}')"

echo "=== XFCE configuration ==="
sudo -u $MISO_USERNAME mkdir -p /home/$MISO_USERNAME/.config/xfce4
rsync -a --force ./xfce4 /home/$MISO_USERNAME/.config
chown weee: -R /home/$MISO_USERNAME/.config
sudo -u $MISO_USERNAME cp ./light-locker.desktop /home/$MISO_USERNAME/.config/autostart/light-locker.desktop
# sudo -u $MISO_USERNAME mkdir -p /home/$MISO_USERNAME/.config/xfce4/desktop /home/$MISO_USERNAME/.config/xfce4/terminal

echo "=== Desktop shortcuts ==="
#if [[ -d "/home/$MISO_USERNAME/limone" ]]; then
# sudo -u $MISO_USERNAME git -C /home/$MISO_USERNAME/limone pull --ff-only
#else
# sudo -u $MISO_USERNAME mkdir -p /home/$MISO_USERNAME/limone
# sudo -u $MISO_USERNAME git clone https://github.com/WEEE-Open/limone.git /home/$MISO_USERNAME/limone
#fi
#
#for desktop_file in $(sudo -u $MISO_USERNAME find /home/$MISO_USERNAME/limone -name "*.desktop" -type f -printf "%f "); do
# sudo -u $MISO_USERNAME cp "/home/$MISO_USERNAME/limone/$desktop_file" "/home/$MISO_USERNAME/Desktop/$desktop_file"
# sudo -u $MISO_USERNAME chmod +x "/home/$MISO_USERNAME/Desktop/$desktop_file"
# sed -ri -e "s#Icon=(.*/)*([a-zA-Z0-9\-\.]+)#Icon=/home/$MISO_USERNAME/limone/\2#" "/home/$MISO_USERNAME/Desktop/$desktop_file"
#done

sudo -u $MISO_USERNAME mkdir -p /home/$MISO_USERNAME/.config/WEEE\ Open/tarallo
sudo -u $MISO_USERNAME cp ./Tarallo.desktop /home/$MISO_USERNAME/Desktop
sudo -u $MISO_USERNAME cp ./tarallo.png /home/$MISO_USERNAME/.config/WEEE\ Open/tarallo/tarallo.png
sudo -u $MISO_USERNAME chmod +x /home/$MISO_USERNAME/Desktop/Tarallo.desktop
# su - $MISO_USERNAME -c "gio set -t string /home/$MISO_USERNAME/Desktop/Tarallo.desktop metadata::xfce-exe-checksum $(sha256sum /home/$MISO_USERNAME/Desktop/Tarallo.desktop | awk '{print $1}')"

sudo -u $MISO_USERNAME mkdir -p /home/$MISO_USERNAME/.config/WEEE\ Open/wiki
sudo -u $MISO_USERNAME cp ./Wiki.desktop /home/$MISO_USERNAME/Desktop
sudo -u $MISO_USERNAME cp ./limone.png /home/$MISO_USERNAME/.config/WEEE\ Open/wiki/wiki.png
sudo -u $MISO_USERNAME chmod +x /home/$MISO_USERNAME/Desktop/Wiki.desktop
# su - $MISO_USERNAME -c "gio set -t string /home/$MISO_USERNAME/Desktop/Wiki.desktop metadata::xfce-exe-checksum $(sha256sum /home/$MISO_USERNAME/Desktop/Wiki.desktop | awk '{print $1}')"

#if [[ -f "/home/$MISO_USERNAME/Desktop/PeracottaGUI.desktop" ]]; then
# rm -f "/home/$MISO_USERNAME/Desktop/PeracottaGUI.desktop"
#fi
sudo -u $MISO_USERNAME cp ./Peracotta.desktop /home/$MISO_USERNAME/Desktop
sudo -u $MISO_USERNAME cp ./peracotta.png /home/$MISO_USERNAME/.config/WEEE\ Open/peracotta/peracotta.png
sudo -u $MISO_USERNAME chmod +x /home/$MISO_USERNAME/Desktop/Peracotta.desktop
# su - $MISO_USERNAME -c "gio set -t string /home/$MISO_USERNAME/Desktop/Peracotta.desktop metadata::xfce-exe-checksum $(sha256sum /home/$MISO_USERNAME/Desktop/Peracotta.desktop | awk '{print $1}')"

sudo -u $MISO_USERNAME cp ./Peracruda.desktop /home/$MISO_USERNAME/Desktop
sudo -u $MISO_USERNAME cp ./peracruda.png /home/$MISO_USERNAME/.config/WEEE\ Open/peracotta/peracruda.png
sudo -u $MISO_USERNAME chmod +x /home/$MISO_USERNAME/Desktop/Peracruda.desktop
# su - $MISO_USERNAME -c "gio set -t string /home/$MISO_USERNAME/Desktop/Peracruda.desktop metadata::xfce-exe-checksum "$(sha256sum /home/$MISO_USERNAME/Desktop/Peracruda.desktop | awk '{print $1}')"

echo "=== Pointerkeys thing ==="
sudo -u $MISO_USERNAME mkdir -p /home/$MISO_USERNAME/.config/autostart
sudo -u $MISO_USERNAME cp ./Pointerkeys.desktop /home/$MISO_USERNAME/.config/autostart/Pointerkeys.desktop
sudo -u $MISO_USERNAME cp ./pointerkeys.txt /home/$MISO_USERNAME/Desktop

echo "=== Autologin stuff ==="
cat <<EOF >/etc/lightdm/lightdm.conf
[LightDM]
[Seat:*]
autologin-user=$MISO_USERNAME
autologin-user-timeout=0
EOF
mkdir -p /etc/systemd/system/[email protected]
touch /etc/systemd/system/[email protected]/override.conf
printf "[Service]\n" >/etc/systemd/system/[email protected]/override.conf
printf "ExecStart=\n" >>/etc/systemd/system/[email protected]/override.conf
printf "ExecStart=-/sbin/agetty --noissue --autologin weee %%I $TERM" >>/etc/systemd/system/[email protected]/override.conf

echo "=== Final cleanup ==="
# Remove unused packages
apt-get autoremove -y
Expand Down
2 changes: 1 addition & 1 deletion chroot_scripts/desktop/Peracotta.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Name=Peracotta GUI
Comment=Start peracotta GUI
Exec=/home/weee/.local/bin/peracotta
Icon=/home/weee/.config/WEEE Open/Peracotta.png
Path=/home/weee/peracotta
Path=/home/weee/.config/WEEE Open/peracotta
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 3c776dc

Please sign in to comment.