diff --git a/dist/apt.sh b/dist/apt.sh new file mode 100755 index 0000000..97b33d6 --- /dev/null +++ b/dist/apt.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +PACKEGES_FILE="dist/packages.txt" + +if [ ! -f "$PACKEGES_FILE" ]; then + echo "Packages file not found: $PACKEGES_FILE" + exit 1 +else + mapfile -t packages < "$PACKEGES_FILE" + sudo apt update + sudo apt install -y "${packages[@]}" +fi + + diff --git a/dist/arch/packages.txt b/dist/arch/packages.txt new file mode 100644 index 0000000..40e80ec --- /dev/null +++ b/dist/arch/packages.txt @@ -0,0 +1,2 @@ +git +base-devel diff --git a/dist/arch/paru.txt b/dist/arch/paru.txt new file mode 100644 index 0000000..e69de29 diff --git a/dist/packages.txt b/dist/packages.txt new file mode 100644 index 0000000..e69de29 diff --git a/dist/pacman.sh b/dist/pacman.sh new file mode 100755 index 0000000..96fd062 --- /dev/null +++ b/dist/pacman.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Read the dist/packages.txt and install packages using pacman + +PACKAGES_FILE="dist/packages.txt" + +if [ ! -f "$PACKAGES_FILE" ]; then + echo "Packages file not found: $PACKAGES_FILE" + exit 1 +else + mapfile -t packages < "$PACKAGES_FILE" + pacman -Syu --noconfirm "${packages[@]}" +fi + + +ARCH_PACKAGE_FILE="dist/arch/packages.txt" + +if [ ! -f "$ARCH_PACKAGE_FILE" ]; then + echo "Arch-specific packages file not found: $ARCH_PACKAGE_FILE" + exit 1 +else + mapfile -t arch_packages < "$ARCH_PACKAGE_FILE" + pacman -Syu --noconfirm "${arch_packages[@]}" +fi + +if command -v paru &> /dev/null; then + echo "paru is already installed. Reinstalling..." +else + git clone https://aur.archlinux.org/paru.git + cd paru + makepkg -si --noconfirm + cd .. + rm -rf paru +fi + diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..c677cc3 --- /dev/null +++ b/setup.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Detect the distribution and run the appropriate package installation script either for pacman or apt + +if [ -f /etc/os-release ]; then + . /etc/os-release + DISTRO=$ID +else + echo "Cannot detect the distribution." + exit 1 +fi + +case "$DISTRO" in + arch|manjaro) + echo "Detected Arch-based distribution. Running pacman setup..." + bash dist/pacman.sh + ;; + ubuntu|debian) + echo "Detected Debian-based distribution. Running apt setup..." + bash dist/apt.sh + ;; + *) + echo "Unsupported distribution: $DISTRO" + exit 1 + ;; +esac + +echo "Setup completed." + +