workflow/initialization/check_installed.sh
2025-07-19 17:15:10 +02:00

73 lines
2.6 KiB
Bash
Executable file

#!/bin/bash
echo "========== Checking installed programs and files ======="
source $HOME/Nextcloud/ressources/workflow_nextcloud/public_workflow/workflow_variables.sh
# Check if apt-installed packages are present
echo "Checking apt-installed packages..."
PACKAGES="adduser ansible arp-scan automysqlbackup borgbackup calibre certbot curl docker docker-compose etckeeper eza fail2ban geeqie git gnupg ghostty htop jq meld nano ncdu nginx npm pandoc php-curl php-mysql php-xml php8.4 php8.4-fpm php8.4-xml python3 python3-pip python3-setuptools rbenv restic rsync smartmontools snapd sshfs syncthing testdisk texlive tig unattended-upgrades vrms zsh"
MISSING_PACKAGES=""
for pkg in $PACKAGES; do
if ! dpkg -l | grep -q " $pkg "; then
MISSING_PACKAGES="$MISSING_PACKAGES $pkg"
fi
done
if [ -n "$MISSING_PACKAGES" ]; then
echo -e "\e[31mThe following packages are missing:$MISSING_PACKAGES\e[0m"
else
echo "All apt packages are installed."
fi
# Check if snap-installed packages are present
echo "Checking snap-installed packages..."
SNAP_PACKAGES="btop emacs"
MISSING_SNAP_PACKAGES=""
for pkg in $SNAP_PACKAGES; do
if ! snap list | grep -q "$pkg"; then
MISSING_SNAP_PACKAGES="$MISSING_SNAP_PACKAGES $pkg"
fi
done
if [ -n "$MISSING_SNAP_PACKAGES" ]; then
echo -e "\e[31mThe following snap packages are missing:$MISSING_SNAP_PACKAGES\e[0m"
else
echo "All snap packages are installed."
fi
cd $WORKFLOW_PATH_PUBLIC/bin
# Check if AppImages are present
echo "Checking AppImages..."
if [ ! -f "$WORKFLOW_PATH_PUBLIC/bin/Nextcloud-3.16.6-x86_64.AppImage" ]; then
echo -e "\e[31m Nextcloud AppImage is missing.\e[0m"
fi
if [ ! -f "$WORKFLOW_PATH_PUBLIC/bin/VeraCrypt-1.26.24-x86_64.AppImage" ]; then
echo -e "\e[31m VeraCrypt AppImage is missing.\e[0m"
fi
if [ ! -f "$HOME/Nextcloud/ressources/workflow_nextcloud/secrets_vars.sh" ]; then
echo -e "\e[31m secret vars file is missing. $HOME/Nextcloud/ressources/workflow_nextcloud/secrets_vars.sh \e[0m"
fi
# Check if configuration files are present in home directory
echo "Checking configuration files in home directory..."
# Note: .bash_custom_aliases is downloaded as .bash_aliases in fast.sh
CONFIG_FILES=".bash_aliases .bashrc .zshrc"
MISSING_CONFIG_FILES=""
for file in $CONFIG_FILES; do
if [ ! -f "$HOME/$file" ]; then
MISSING_CONFIG_FILES="$MISSING_CONFIG_FILES $file"
fi
done
if [ -n "$MISSING_CONFIG_FILES" ]; then
echo -e "\e[31mThe following configuration files are missing in your home directory:$MISSING_CONFIG_FILES\e[0m"
else
echo "All configuration files are present in your home directory."
fi
echo "========== Check completed ======="