first commit

This commit is contained in:
julien
2026-01-14 13:05:05 +01:00
commit 1a02980bbc
7 changed files with 343 additions and 0 deletions

48
modules/config.sh Executable file
View File

@@ -0,0 +1,48 @@
#!/bin/bash
source $config_file
echo
echo " => Configuration"
echo
# Check config
if [ ! -z $config ]; then
echo "Configuration already applied."
exit
fi
# Enable firewall
ufw enable
ufw default deny incoming
ufw default allow outgoing
# Grub configuration
sed -i "s/GRUB_CMDLINE_LINUX_DEFAULT=\"quiet/& loglevel=3 nowatchdog/" /etc/default/grub
update-grub
# Server only configuration
if [ $profile = server ]; then
# Firewall configuration
ports="ssh
http
https
imap
imaps
smtp
smtps"
for i in $ports
do
ufw allow $i
done
# SSH keys only
echo -e "# SSH keys only\nPasswordAuthentication no\nPubkeyAuthentication yes" > /etc/ssh/sshd_config.d/custom.conf
fi
# Desktop only configuration
if [ $profile = desktop ]; then
# Disable all managed interfaces excerpt loopback from /etc/network/interfaces file to allow NetworkManager to manage them
sed -i '/# The primary network interface/Q' /etc/network/interfaces
fi

49
modules/docker.sh Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/bash
echo
echo " => Docker"
echo
# Check for Docker
pkgs="docker-ce
docker-ce-cli
containerd.io
docker-buildx-plugin
docker-compose-plugin"
for pkg in $pkgs
do
dpkg-query -W -f='${Status}' $pkg 2>&1 | grep -q " installed"
if [ $? -ne 0 ]; then
installed=false
fi
done
if [ -z $installed ]; then
echo "Docker found."
exit
fi
# Install needed packages
pkgs="ca-certificates
curl"
for pkg in $pkgs
do
dpkg-query -W -f='${Status}' $pkg 2>&1 | grep -q " installed"
if [ $? -ne 0 ]; then
apt-get install $pkg -y
fi
done
# Add Docker's official GPG key:
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
# Install packages
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

72
modules/pkgs.sh Executable file
View File

@@ -0,0 +1,72 @@
#!/bin/bash
source $config_file
echo
echo " => Packages"
echo
# Localization
if [ $profile = desktop ] || [ $profile = full-desktop ]; then
echo "What is your language code for localization packages ? (eg. de, en-gb, fr)"
read -p "> " lang
fi
# Packages sets by profile
base="git
htop
rsync
tree
ufw"
server=""
desktop="gnome-core gnome-console
gnome-shell-extension-caffeine
gnome-shell-extension-tiling-assistant
gnome-themes-extra
gnome-tweaks
gufw
papirus-icon-theme"
applications="firefox-esr
firefox-esr-l10n-$lang
gimp
libreoffice
libreoffice-gnome
libreoffice-l10n-$lang"
if [ $profile = server ]; then
pkgs="$base
$server"
fi
if [ $profile = desktop ]; then
pkgs="$base
$desktop"
fi
if [ $profile = full-desktop ]; then
pkgs="$base
$desktop
$applications"
fi
# Check updates
apt-get update && apt-get upgrade -y
echo
# Install packages
for pkg in $pkgs
do
dpkg-query -W -f='${Status}' $pkg 2>&1 | grep -q " installed"
if [ $? -ne 0 ]; then
installed=false
fi
done
if [ ! -z $installed ]; then
apt-get install $pkgs -y
else
echo "All packages are already installed."
fi

23
modules/zram.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
echo
echo " => ZRAM"
echo
# Check for zram
pkg=zram-tools
dpkg-query -W -f='${Status}' $pkg 2>&1 | grep -q " installed"
if [ $? -eq 0 ]; then
echo "ZRAM found."
exit
fi
# Install zram
apt-get install zram-tools -y
# Configure zram
sed -i '/#ALGO=lz4/s/^#//g' /etc/default/zramswap
sed -i '/#PERCENT=50/s/^#//g' /etc/default/zramswap
sed -i 's/ALGO=lz4/ALGO=zstd/g' /etc/default/zramswap
systemctl restart zramswap.service