#!/bin/bash FUCKMAN_DIR="$HOME/.fuckman" REPO_LIST="$FUCKMAN_DIR/mirror-list.txt" PKG_LIST="$FUCKMAN_DIR/packages" INSTALLED_LIST="$FUCKMAN_DIR/installed.txt" CACHE_DIR="$FUCKMAN_DIR/cache" # Opsi otomatisasi AUTO_CONFIRM="yes" # Default: Yes while getopts "ynd" opt; do case $opt in y) AUTO_CONFIRM="yes" ;; n) AUTO_CONFIRM="no" ;; d) AUTO_CONFIRM="yes" ;; # Default Yes *) echo "Invalid option"; exit 1 ;; esac done # Fungsi konfirmasi otomatis confirm() { if [[ "$AUTO_CONFIRM" == "yes" ]]; then return 0 # Langsung lanjut elif [[ "$AUTO_CONFIRM" == "no" ]]; then return 1 # Langsung batal else read -p "$1 (y/n): " choice [[ "$choice" == "y" ]] || [[ "$choice" == "Y" ]] fi } # Update daftar paket fuckman_update() { echo "[*] Updating package list..." for repo in $(cat "$REPO_LIST"); do wget -q -O "$PKG_LIST" "$repo/packages.txt" done echo "[✔] Update completed!" } # Upgrade semua paket fuckman_upgrade() { echo "[*] Upgrading installed packages..." while read -r pkg; do fuckman_install "$pkg" done < "$INSTALLED_LIST" echo "[✔] Upgrade completed!" } # Install paket fuckman_install() { local pkg="$1" if grep -q "^$pkg$" "$INSTALLED_LIST"; then echo "[!] $pkg is already installed." return fi echo "[*] Installing $pkg..." confirm "Proceed with installation?" || return wget -q -O "$CACHE_DIR/$pkg.tar.gz" "https://repo.example.com/$pkg.tar.gz" tar -xzf "$CACHE_DIR/$pkg.tar.gz" -C /usr/local/bin/ echo "$pkg" >> "$INSTALLED_LIST" echo "[✔] Installed $pkg!" } # Reinstall paket fuckman_reinstall() { local pkg="$1" fuckman_del "$pkg" fuckman_install "$pkg" } # Hapus paket fuckman_del() { local pkg="$1" if ! grep -q "^$pkg$" "$INSTALLED_LIST"; then echo "[!] $pkg is not installed." return fi echo "[*] Removing $pkg..." confirm "Are you sure?" || return rm -rf "/usr/local/bin/$pkg" sed -i "/^$pkg$/d" "$INSTALLED_LIST" echo "[✔] Removed $pkg!" } # Tampilkan daftar paket fuckman_list() { cat "$PKG_LIST" } # Tampilkan daftar paket yang terinstall fuckman_list_installed() { cat "$INSTALLED_LIST" } # Cari paket fuckman_search() { grep -i "$1" "$PKG_LIST" } # Tambah repository fuckman_addrepo() { echo "$1" >> "$REPO_LIST" echo "[✔] Repository added: $1" } # Hapus repository fuckman_delrepo() { sed -i "/$1/d" "$REPO_LIST" echo "[✔] Repository removed: $1" } # Bersihkan cache fuckman_clean() { rm -rf "$CACHE_DIR/*" echo "[✔] Cache cleaned!" } # Menjalankan perintah berdasarkan argumen case "$1" in update) fuckman_update ;; upgrade) fuckman_upgrade ;; install) fuckman_install "$2" ;; reinstall) fuckman_reinstall "$2" ;; del) fuckman_del "$2" ;; list) fuckman_list ;; list-installed) fuckman_list_installed ;; search) fuckman_search "$2" ;; addrepo) fuckman_addrepo "$2" ;; delrepo) fuckman_delrepo "$2" ;; clean) fuckman_clean ;; *) echo "FUCKMAN - Android Package Manager" echo "Usage: fuckman [options]" echo "Commands:" echo " update Update package list" echo " upgrade Upgrade all installed packages" echo " install Install a package" echo " reinstall Reinstall a package" echo " del Remove a package" echo " list List available packages" echo " list-installed List installed packages" echo " search Search for a package" echo " addrepo Add a new repository" echo " delrepo Remove a repository" echo " clean Clear package cache" echo "Options:" echo " -y Auto-confirm (yes)" echo " -n Auto-decline (no)" echo " -d Default to yes" ;; esac