FUCK 1: Fundation (v0.1 - initial build)

This commit is contained in:
syn 2025-02-12 02:05:00 +07:00
parent bf356a638e
commit 1d97b6c206
5 changed files with 152 additions and 0 deletions

0
docs/docs.md Normal file
View File

View File

@ -0,0 +1,152 @@
#!/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 <command> [options]"
echo "Commands:"
echo " update Update package list"
echo " upgrade Upgrade all installed packages"
echo " install <pkg> Install a package"
echo " reinstall <pkg> Reinstall a package"
echo " del <pkg> Remove a package"
echo " list List available packages"
echo " list-installed List installed packages"
echo " search <pkg> Search for a package"
echo " addrepo <url> Add a new repository"
echo " delrepo <name> 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

View File

View File

0
tests/.log Normal file
View File