import json
import os

db_path = "/var/lib/fempkg/db.json"

packages = [
    "Binutils-2.45-P2",
    "GCC-15.2.0-P2",
    "Linux-API-Headers-6.16.1",
    "Libstdc++-15.2.0",
    "M4-1.4.20",
    "Ncurses-6.5-20250809",
    "Bash-5.3",
    "Coreutils-9.7",
    "Diffutils-3.12",
    "File-5.46",
    "Findutils-4.10.0",
    "Gawk-5.3.2",
    "Grep-3.12",
    "Gzip-1.14",
    "Make-4.4.1",
    "Patch-2.8",
    "Sed-4.9",
    "Tar-1.35",
    "Xz-5.8.1",
    "Gettext-0.26",
    "Bison-3.8.2",
    "Perl-5.42.0",
    "Python-3.13.7",
    "Texinfo-7.2",
    "Util-linux-2.41.1",
    "fempkg-0.1",
    "man-pages-6.15",
    "iana-etc-20250807"
]

os.makedirs(os.path.dirname(db_path), exist_ok=True)

# Store None as value so fempkg list prints only the package name
installed_dict = {pkg: None for pkg in packages}

with open(db_path, "w") as f:
    json.dump({"installed": installed_dict}, f, indent=2)

for pkg in packages:
    print(f"Registered: {pkg}")

print("All packages re-registered successfully (except Glibc).")
 
