From 4a38feca344fa829145c20033c0815130731fe8a Mon Sep 17 00:00:00 2001 From: Tykayn Date: Sat, 19 Jul 2025 14:58:00 +0200 Subject: [PATCH] list installed, add zshrc --- assets/.zshrc | 12 +- initialization/check_installed_in_history.sh | 167 +++++++++++ initialization/fast.sh | 118 +++++++- initialization/installed.txt | 287 +++++++++++++++++++ 4 files changed, 581 insertions(+), 3 deletions(-) create mode 100644 initialization/check_installed_in_history.sh create mode 100644 initialization/installed.txt diff --git a/assets/.zshrc b/assets/.zshrc index 3d38210..68b6fce 100644 --- a/assets/.zshrc +++ b/assets/.zshrc @@ -41,7 +41,7 @@ zstyle ':omz:update' mode auto # update automatically without asking # DISABLE_AUTO_TITLE="true" # Uncomment the following line to enable command auto-correction. -ENABLE_CORRECTION="true" +#ENABLE_CORRECTION="true" # Uncomment the following line to display red dots whilst waiting for completion. # You can also set it to another string to have that shown instead of the default red dots. @@ -101,3 +101,13 @@ if [[ -n $SSH_CONNECTION ]]; then # alias ohmyzsh="mate ~/.oh-my-zsh" source ~/.bash_aliases + +fpath+=~/.zfunc; autoload -Uz compinit; compinit + + +# Load Angular CLI autocompletion. +source <(ng completion script) + +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion diff --git a/initialization/check_installed_in_history.sh b/initialization/check_installed_in_history.sh new file mode 100644 index 0000000..4e199a9 --- /dev/null +++ b/initialization/check_installed_in_history.sh @@ -0,0 +1,167 @@ +#!/bin/bash + +# Script to search for installed packages in bash and zsh history +# It looks for installations via apt, apt-get, snap, pipx, pip, and npm + +# Define arrays to store package names +declare -a APT_PACKAGES=() +declare -a APTGET_PACKAGES=() +declare -a SNAP_PACKAGES=() +declare -a PIPX_PACKAGES=() +declare -a PIP_PACKAGES=() +declare -a NPM_PACKAGES=() + +# Function to extract package names from apt install commands +extract_apt_packages() { + local line="$1" + # Remove sudo and apt install/apt-get install part + local packages=$(echo "$line" | sed -E 's/^.*apt(-get)? install(-y)? //g') + # Split by spaces and add to array + for pkg in $packages; do + # Skip options that start with - + if [[ ! "$pkg" =~ ^- ]]; then + APT_PACKAGES+=("$pkg") + fi + done +} + +# Function to extract package names from apt-get install commands +extract_aptget_packages() { + local line="$1" + # Remove sudo and apt-get install part + local packages=$(echo "$line" | sed -E 's/^.*apt-get install(-y)? //g') + # Split by spaces and add to array + for pkg in $packages; do + # Skip options that start with - + if [[ ! "$pkg" =~ ^- ]]; then + APTGET_PACKAGES+=("$pkg") + fi + done +} + +# Function to extract package names from snap install commands +extract_snap_packages() { + local line="$1" + # Remove sudo and snap install part + local packages=$(echo "$line" | sed -E 's/^.*snap install //g') + # Split by spaces and add to array + for pkg in $packages; do + # Skip options that start with - + if [[ ! "$pkg" =~ ^- && ! "$pkg" =~ ^--classic$ ]]; then + SNAP_PACKAGES+=("$pkg") + fi + done +} + +# Function to extract package names from pipx install commands +extract_pipx_packages() { + local line="$1" + # Remove pipx install part + local packages=$(echo "$line" | sed -E 's/^.*pipx install //g') + # Split by spaces and add to array + for pkg in $packages; do + # Skip options that start with - + if [[ ! "$pkg" =~ ^- ]]; then + PIPX_PACKAGES+=("$pkg") + fi + done +} + +# Function to extract package names from pip install commands +extract_pip_packages() { + local line="$1" + # Remove pip/pip3 install part + local packages=$(echo "$line" | sed -E 's/^.*(pip|pip3) install //g') + # Split by spaces and add to array + for pkg in $packages; do + # Skip options that start with - + if [[ ! "$pkg" =~ ^- ]]; then + PIP_PACKAGES+=("$pkg") + fi + done +} + +# Function to extract package names from npm install commands +extract_npm_packages() { + local line="$1" + # Remove npm install part + local packages=$(echo "$line" | sed -E 's/^.*npm install(-g)? //g') + # Split by spaces and add to array + for pkg in $packages; do + # Skip options that start with - + if [[ ! "$pkg" =~ ^- ]]; then + NPM_PACKAGES+=("$pkg") + fi + done +} + +echo "Searching for installed packages in bash and zsh history..." + +# Parse bash history if it exists +if [ -f ~/.bash_history ]; then + echo "Parsing bash history..." + while IFS= read -r line; do + if [[ "$line" =~ apt\ install ]]; then + extract_apt_packages "$line" + elif [[ "$line" =~ apt-get\ install ]]; then + extract_aptget_packages "$line" + elif [[ "$line" =~ snap\ install ]]; then + extract_snap_packages "$line" + elif [[ "$line" =~ pipx\ install ]]; then + extract_pipx_packages "$line" + elif [[ "$line" =~ (pip|pip3)\ install ]]; then + extract_pip_packages "$line" + elif [[ "$line" =~ npm\ install ]]; then + extract_npm_packages "$line" + fi + done < ~/.bash_history +else + echo "Bash history file not found." +fi + +# Parse zsh history if it exists +if [ -f ~/.zsh_history ]; then + echo "Parsing zsh history..." + while IFS= read -r line; do + # ZSH history has a different format, we need to extract the command part + # Format is typically: : timestamp:0;command + cmd=$(echo "$line" | sed -E 's/^: [0-9]+:[0-9];(.*)$/\1/') + + if [[ "$cmd" =~ apt\ install ]]; then + extract_apt_packages "$cmd" + elif [[ "$cmd" =~ apt-get\ install ]]; then + extract_aptget_packages "$cmd" + elif [[ "$cmd" =~ snap\ install ]]; then + extract_snap_packages "$cmd" + elif [[ "$cmd" =~ pipx\ install ]]; then + extract_pipx_packages "$cmd" + elif [[ "$cmd" =~ (pip|pip3)\ install ]]; then + extract_pip_packages "$cmd" + elif [[ "$cmd" =~ npm\ install ]]; then + extract_npm_packages "$cmd" + fi + done < ~/.zsh_history +else + echo "ZSH history file not found." +fi + +# Display results +echo -e "\n=== Packages installed via apt ===" +printf '%s\n' "${APT_PACKAGES[@]}" | sort -u + +echo -e "\n=== Packages installed via apt-get ===" +printf '%s\n' "${APTGET_PACKAGES[@]}" | sort -u + +echo -e "\n=== Packages installed via snap ===" +printf '%s\n' "${SNAP_PACKAGES[@]}" | sort -u + +echo -e "\n=== Packages installed via pipx ===" +printf '%s\n' "${PIPX_PACKAGES[@]}" | sort -u + +echo -e "\n=== Packages installed via pip/pip3 ===" +printf '%s\n' "${PIP_PACKAGES[@]}" | sort -u + +echo -e "\n=== Packages installed via npm ===" +printf '%s\n' "${NPM_PACKAGES[@]}" | sort -u + +echo -e "\nSearch complete." \ No newline at end of file diff --git a/initialization/fast.sh b/initialization/fast.sh index 024fd01..f038a56 100644 --- a/initialization/fast.sh +++ b/initialization/fast.sh @@ -3,6 +3,108 @@ sudo apt update -y sudo apt upgrade -y sudo apt autoremove -y +# Liste des programmes à installer avec apt +APT_PACKAGES=( + ansible + python3-pip + arp-scan + borgbackup + curl + docker + docker-compose + etckeeper + git + gnupg + jq + meld + nano + ncdu + nginx + restic + npm + pandoc + php8.4 + python3 + python3-pip + tig + zsh + testdisk + texlive + rbenv + htop + python3-setuptools + automysqlbackup + certbot + smartmontools + fail2ban + snapd + unattended-upgrades + php8.4-fpm + php-xml + php-mysql + rsync + php8.4-xml + php-curl + vrms + syncthing + sshfs + geeqie + calibre + adduser + snapd + borgbackup + eza + adduser +) + +# Fonction pour vérifier l'installation des programmes +verify_installation() { + echo "Vérification de l'installation des programmes..." + local missing_packages=() + + for package in "${APT_PACKAGES[@]}"; do + # Vérification simplifiée - on pourrait améliorer avec dpkg -l | grep -q "^ii.*$package" + if ! command -v "$package" &> /dev/null && ! dpkg -l | grep -q "$package"; then + missing_packages+=("$package") + fi + done + + if [ ${#missing_packages[@]} -eq 0 ]; then + echo "✅ Tous les programmes ont été installés avec succès." + else + echo "❌ Les programmes suivants n'ont pas été installés correctement:" + for package in "${missing_packages[@]}"; do + echo " - $package" + done + fi +} + +# Fonction pour vérifier l'existence des alias +verify_aliases() { + echo "Vérification des alias..." + local missing_aliases=() + + # Vérification de l'alias gst + if ! alias gst &> /dev/null; then + missing_aliases+=("gst") + fi + + # Vérification de l'alias phps + if ! alias phps &> /dev/null; then + missing_aliases+=("phps") + fi + + if [ ${#missing_aliases[@]} -eq 0 ]; then + echo "✅ Tous les alias requis sont disponibles." + else + echo "❌ Les alias suivants ne sont pas disponibles:" + for alias_name in "${missing_aliases[@]}"; do + echo " - $alias_name" + done + echo "Note: Les alias sont définis dans le fichier .bash_aliases, assurez-vous de l'avoir chargé avec 'source ~/.bash_aliases'" + fi +} + mkdir -p $HOME/Nextcloud/ressources/workflow_nextcloud/ cd $HOME/Nextcloud/ressources/workflow_nextcloud/ git clone https://source.cipherbliss.com/tykayn/workflow public_workflow @@ -12,7 +114,10 @@ git pull sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B188E2B695BD4743 source $HOME/Nextcloud/ressources/workflow_nextcloud/public_workflow/workflow_variables.sh -apt install ansible python3-pip arp-scan borgbackup curl docker docker-compose etckeeper git gnupg jq meld nano ncdu nginx restic npm pandoc php8.4 python3 python3-pip tig zsh testdisk texlive rbenv htop python3-setuptools automysqlbackup certbot smartmontools fail2ban snapd unattended-upgrades php8.4-fpm php-xml php-mysql rsync php8.4-xml php-curl vrms syncthing sshfs geeqie calibre adduser snapd borgbackup eza adduser + +# Installation des paquets +echo "Installation des paquets apt..." +sudo apt install -y "${APT_PACKAGES[@]}" wget https://github.com/nextcloud-releases/desktop/releases/download/v3.16.6/Nextcloud-3.16.6-x86_64.AppImage chmod +x Nextcloud-3.16.6-x86_64.AppImage wget https://launchpad.net/veracrypt/trunk/1.26.24/+download/VeraCrypt-1.26.24-x86_64.AppImage @@ -26,4 +131,13 @@ wget https://source.cipherbliss.com/tykayn/workflow/raw/branch/main/assets/.bash wget https://source.cipherbliss.com/tykayn/workflow/raw/branch/main/assets/.bashrc curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh > install_oh_my_zsh.sh -bash install_oh_my_zsh.sh \ No newline at end of file +bash install_oh_my_zsh.sh + +# Charger les alias pour pouvoir les vérifier +source ~/.bash_aliases + +# Vérification des installations et des alias +verify_installation +verify_aliases + +echo "========== Fin de l'initialisation du workflow =======" diff --git a/initialization/installed.txt b/initialization/installed.txt new file mode 100644 index 0000000..01cf1f3 --- /dev/null +++ b/initialization/installed.txt @@ -0,0 +1,287 @@ +Searching for installed packages in bash and zsh history... +Parsing bash history... +Parsing zsh history... + +=== Packages installed via apt === +adb +android +android-sdk +ansible +apt-transport-https +apt-transport-https\ +bison +boinc-client +boinc-manager +build-essential +ca-certificates +cargo +cmake +cnijfilter2 +cups +cups-client +curl +displaylink-driver +docker-ce +docker.io +dolphin-plugins +dotnet-sdk-6.0 +./Downloads/synaptics-repository-keyring.deb +duf +element-desktop +extra-cmake-modules +ffmpeg +firefox +flatpak +flex +g++ +git +gnome-software-plugin-flatpak +gnome-terminal +gnupg2 +grafana +heimdall-flash +john +john\ +kde-config-tablet +libarchive-dev +libcups2-dev +libcupsimage2 +libgeos-dev +libgtk-4-dev +librrd-dev +libusb-1.0-0-dev +mariadb-client-core +mariadb-plugin-provider-lz4 +mariadb-server +mysql-server +pandoc +poppler-utils +python3 +python3-dateutil +python3-gi +python3-nautilus +python3-pip +python3-polib +python3-psycopg2 +python3-regex +python3-requests +python3-shapely +qtbase5-dev +ripgrep +scangearmp2 +signal-desktop +smartmontools +software-properties-common\ +wget +winehq +winehq-stable +xz-utils + +=== Packages installed via apt-get === +\\ +apache2 +apache2-utils +arbtt +autoconf +boinc-client +build-essential +ca-certificates +cmake +containerd.io +curl +dkms +docker-buildx-plugin +docker-ce +docker-ce-cli +docker-compose-plugin +docker-compose-v2 +dotnet-runtime-6.0 +dotnet-runtime-7.0 +dotnet-sdk-6.0 +dotnet-sdk-7.0 +ffmpeg +gcc +gnupg\ +libbluetooth-dev +libc6 +libgd-dev\ +libpq-dev +libsdl2-dev +libssl-dev +libssl-dev\ +"linux-headers-$(uname +make +mkusb +mkusb-nox +munin-node +numlockx +obs-studio +openssl +php +php8.0-intl +php8.1-intl +php8.2-intl +php8.3-intl +php-intl +playonlinux +python3 +python3-dev +python3-venv +python3-virtualenv +python-dev +python-pip +python-virtualenv +redis-server +ruby-full +sile +tesseract-ocr +tesseract-ocr-fra\ +unzip +usb-pack-efi\ +virtualenv +wacom-tools +wget +zlib1g-dev + +=== Packages installed via snap === +barrier +berreer +chromium +chromium-browser +core +czkawka +czkawkaw +dotnet +dotnet-dsk +dotnet-sdk +dust +exa +ferdium\ +firefox +manuskript +ms-teams +msteams +plex-desktop +rpi-imager +rustup +sqlitebrowser +storage-explorer +teams +teams-for-linux +telegram-desktop +tor-mkg20001 + +=== Packages installed via pipx === +borgmatic +flask +json +matplotlib\ +numpy\ +panoramax + +=== Packages installed via pip/pip3 === +addok +addok-csv +addok-france +appendfilename +argparse +argsparse +chafa +dash +dash_html_components +dash_table +date2name +docker-compose +exifread +filetags +flask +folium +geojson +geojson2osm +geovisio-cli +geovisio_cli +guessfilename +hgrep +install +install" +jinja2 +json +jupyter +kaleido +matplotlib +md2gemini +mdgemini +notebook +numpy +ogr2ogr +ogrtools +opentimelineio +osm2geojson +osmnx +pandas +pandas_geojson +panoramax +panoramax-cli +panoramax_cli +piexif +"pip +pip +"pip3 +pipx\ +plotly +pyexiv2 +pypandoc +pytest +readability-lxml +requirements.txt +scikit +scikit-learn +sentencepiece +setuptools +streamlit +svgwrite +timezonefinder +timg +torch +torchaudio +torchvision +wheel +youtube_dl +yt-dlp + +=== Packages installed via npm === +@angular/cli +@babel/core +babel-jest +@babel/preset-env +@babel/preset-typescript +chartjs-adapter-date-fns +@compodoc/compodoc +csv2geojson +geojsontoosm +install +install\ +@jest/globals +nord +npm +npm@10.8.1 +@nuxtjs/auth-next +@nuxtjs/auth-nuxt +@nuxtjs/axios +osm-and-geojson +osmtogeojson +@pnpm/exe +remixicon +sass +sass\ +sass-migrator +@storybook/nextjs +ts-jest +@types/jest +@types/vue-shepherd +vsce +vue-cool-select +vue-shepherd +yarn + +Search complete.