From 456c2593a4a6c202d746497263dfb0cf652f2e93 Mon Sep 17 00:00:00 2001 From: Jason Hilder Date: Thu, 21 May 2026 11:35:44 +0200 Subject: [PATCH] added php installs. --- install.sh | 204 +++++++++++++++++++++++++++-------------------------- 1 file changed, 103 insertions(+), 101 deletions(-) diff --git a/install.sh b/install.sh index 4586741..35ac955 100755 --- a/install.sh +++ b/install.sh @@ -13,143 +13,145 @@ DO_INSTALL=false CONFIRM_MODE=true # only true when no args are passed usage() { - echo "Usage: $0 [-l] [-i]" - echo " -l Only create symlinks (no confirmation)" - echo " -i Only install system packages (no confirmation)" - echo " (no args = do both, with confirmation)" - exit 1 + echo "Usage: $0 [-l] [-i]" + echo " -l Only create symlinks (no confirmation)" + echo " -i Only install system packages (no confirmation)" + echo " (no args = do both, with confirmation)" + exit 1 } if [ $# -eq 0 ]; then - DO_LINKS=true - DO_INSTALL=true - CONFIRM_MODE=true + DO_LINKS=true + DO_INSTALL=true + CONFIRM_MODE=true else - CONFIRM_MODE=false - while getopts ":lih" opt; do - case $opt in - l) DO_LINKS=true ;; - i) DO_INSTALL=true ;; - h) usage ;; - *) usage ;; - esac - done + CONFIRM_MODE=false + while getopts ":lih" opt; do + case $opt in + l) DO_LINKS=true ;; + i) DO_INSTALL=true ;; + h) usage ;; + *) usage ;; + esac + done fi # --------------------------------------------------------------------------------- ## Helper function for linking # --------------------------------------------------------------------------------- link_file() { - local src="$1" - local dest="$2" + local src="$1" + local dest="$2" - if [ -L "$dest" ]; then - if [ "$(readlink "$dest")" == "$src" ]; then - echo "โœ… Symlink already correct: $dest โ†’ $src" - ((SKIPPED++)) - else - echo "โš ๏ธ $dest is a symlink but points to the wrong target." - echo " Replacing with correct symlink..." - rm "$dest" - ln -s "$src" "$dest" - echo "๐Ÿ” Fixed: $dest โ†’ $src" - ((CREATED++)) - fi - elif [ -e "$dest" ]; then - echo "โš ๏ธ $dest exists but is not a symlink. Skipping." - ((SKIPPED++)) - else - mkdir -p "$(dirname "$dest")" - ln -s "$src" "$dest" - echo "โœ… Linked: $dest โ†’ $src" - ((CREATED++)) - fi + if [ -L "$dest" ]; then + if [ "$(readlink "$dest")" == "$src" ]; then + echo "โœ… Symlink already correct: $dest โ†’ $src" + ((SKIPPED++)) + else + echo "โš ๏ธ $dest is a symlink but points to the wrong target." + echo " Replacing with correct symlink..." + rm "$dest" + ln -s "$src" "$dest" + echo "๐Ÿ” Fixed: $dest โ†’ $src" + ((CREATED++)) + fi + elif [ -e "$dest" ]; then + echo "โš ๏ธ $dest exists but is not a symlink. Skipping." + ((SKIPPED++)) + else + mkdir -p "$(dirname "$dest")" + ln -s "$src" "$dest" + echo "โœ… Linked: $dest โ†’ $src" + ((CREATED++)) + fi } # --------------------------------------------------------------------------------- ## LINK SYMLINKS # --------------------------------------------------------------------------------- if [ "$DO_LINKS" = true ]; then - if [ "$CONFIRM_MODE" = true ]; then - read -p "โ“ Do you want to create symlinks for your dotfiles? [y/N] " confirm - case "$confirm" in - [Yy]*) ;; # continue below - *) DO_LINKS=false ;; - esac - fi + if [ "$CONFIRM_MODE" = true ]; then + read -p "โ“ Do you want to create symlinks for your dotfiles? [y/N] " confirm + case "$confirm" in + [Yy]*) ;; # continue below + *) DO_LINKS=false ;; + esac + fi fi if [ "$DO_LINKS" = true ]; then - echo "๐Ÿ”— Checking and creating symlinks..." - CREATED=0 - SKIPPED=0 + echo "๐Ÿ”— Checking and creating symlinks..." + CREATED=0 + SKIPPED=0 - link_file "$DOTFILES_DIR/config/tmux" "$HOME/.config/tmux" - link_file "$DOTFILES_DIR/config/kanata" "$HOME/.config/kanata" - link_file "$DOTFILES_DIR/config/fish" "$HOME/.config/fish" - link_file "$DOTFILES_DIR/config/alacritty" "$HOME/.config/alacritty" - link_file "$DOTFILES_DIR/config/nvim" "$HOME/.config/nvim" - link_file "$DOTFILES_DIR/config/gitu" "$HOME/.config/gitu" - link_file "$DOTFILES_DIR/config/lf" "$HOME/.config/lf" + link_file "$DOTFILES_DIR/config/tmux" "$HOME/.config/tmux" + link_file "$DOTFILES_DIR/config/kanata" "$HOME/.config/kanata" + link_file "$DOTFILES_DIR/config/fish" "$HOME/.config/fish" + link_file "$DOTFILES_DIR/config/alacritty" "$HOME/.config/alacritty" + link_file "$DOTFILES_DIR/config/nvim" "$HOME/.config/nvim" + link_file "$DOTFILES_DIR/config/gitu" "$HOME/.config/gitu" + link_file "$DOTFILES_DIR/config/lf" "$HOME/.config/lf" - echo "" - echo "๐Ÿงพ Summary: $CREATED symlink(s) created or fixed, $SKIPPED skipped." - echo "" + echo "" + echo "๐Ÿงพ Summary: $CREATED symlink(s) created or fixed, $SKIPPED skipped." + echo "" - echo "โœ… Symlink setup complete." - echo "" + echo "โœ… Symlink setup complete." + echo "" fi # --------------------------------------------------------------------------------- ## INSTALL SYSTEM PACKAGES # --------------------------------------------------------------------------------- if [ "$DO_INSTALL" = true ]; then - if [ "$CONFIRM_MODE" = true ]; then - read -p "โ“ Do you want to install system packages? [y/N] " confirm - case "$confirm" in - [Yy]*) ;; # continue below - *) DO_INSTALL=false ;; - esac - fi + if [ "$CONFIRM_MODE" = true ]; then + read -p "โ“ Do you want to install system packages? [y/N] " confirm + case "$confirm" in + [Yy]*) ;; # continue below + *) DO_INSTALL=false ;; + esac + fi fi if [ "$DO_INSTALL" = true ]; then - REQUIRED_PACKAGES=( - # system essentials - wget curl git unzip lf jq alacritty fzf - fd-find direnv ripgrep tree bat syncthing - build-essential make bear valgrind fish - tmux ca-certificates gnupg libfuse2 - fonts-symbola fonts-noto fonts-noto-color-emoji - ) + REQUIRED_PACKAGES=( + # system essentials + wget curl git unzip lf jq alacritty fzf + fd-find direnv ripgrep tree bat syncthing + build-essential make bear valgrind fish + tmux ca-certificates gnupg libfuse2 + fonts-symbola fonts-noto fonts-noto-color-emoji + # php + php-cli php-mysql php-curl php-mbstring php-zip + ) - MISSING_PACKAGES=() + MISSING_PACKAGES=() - echo "๐Ÿ” Checking for missing packages..." - echo "" + echo "๐Ÿ” Checking for missing packages..." + echo "" - # Check which packages are missing using dpkg - for pkg in "${REQUIRED_PACKAGES[@]}"; do - # dpkg-query checks for the installed status. - # We check for a non-zero exit status which indicates the package is NOT installed. - if ! dpkg-query -W -f='${Status}' "$pkg" 2>/dev/null | grep -q "install ok installed"; then - MISSING_PACKAGES+=("$pkg") - fi - done + # Check which packages are missing using dpkg + for pkg in "${REQUIRED_PACKAGES[@]}"; do + # dpkg-query checks for the installed status. + # We check for a non-zero exit status which indicates the package is NOT installed. + if ! dpkg-query -W -f='${Status}' "$pkg" 2>/dev/null | grep -q "install ok installed"; then + MISSING_PACKAGES+=("$pkg") + fi + done - if [ ${#MISSING_PACKAGES[@]} -eq 0 ]; then - echo "โœ… All required packages are already installed." - else - echo "๐Ÿ“ฆ Updating package lists..." - # Update package lists before installing - sudo apt update + if [ ${#MISSING_PACKAGES[@]} -eq 0 ]; then + echo "โœ… All required packages are already installed." + else + echo "๐Ÿ“ฆ Updating package lists..." + # Update package lists before installing + sudo apt update - echo "๐Ÿ“ฆ Installing missing packages: ${MISSING_PACKAGES[*]}" - # Use sudo apt install for installing on Debian - sudo apt install "${MISSING_PACKAGES[@]}" - fi + echo "๐Ÿ“ฆ Installing missing packages: ${MISSING_PACKAGES[*]}" + # Use sudo apt install for installing on Debian + sudo apt install "${MISSING_PACKAGES[@]}" + fi - echo "" - echo "โœ… Package setup complete." - echo "" + echo "" + echo "โœ… Package setup complete." + echo "" fi