uninstall command is done

This commit is contained in:
2026-01-19 07:03:51 +11:00
parent dd204788e3
commit 28b56e71ab
5 changed files with 69 additions and 11 deletions

View File

@@ -6,21 +6,16 @@ import tarfile
from rich.console import Console
from rich.progress import SpinnerColumn
from util import check_ground_libs_path, check_sudo
console = Console()
def install(args):
# check if we are sudo
if os.getuid() != 0:
console.print("[b red]digpkg: the install command requires sudo to run[/]")
sys.exit(1)
# ensure the GROUND_LIBS var is set
if not os.getenv("GROUND_LIBS"):
console.print("digpkg: the [i]GROUND_LIBS[/] environment variable is not set, defaulting to /usr/lib/ground/")
os.environ["GROUND_LIBS"] = "/usr/lib/ground/"
check_sudo()
check_ground_libs_path()
# figure out which version to install
package_name = args.name
@@ -81,5 +76,10 @@ def install(args):
console.print(f"[d][:white_check_mark:] Extracted to {extract_dir}.")
console.status("Finishing up...")
os.symlink(os.path.join(extract_dir, package_name, "main.so"), os.path.join(extract_dir, f"{package_name}.so"))
# create a symlink from the main.so file to the ground libs folder so ground can find it
symlink_path = os.path.join(extract_dir, f"{package_name}.so") # the path where the symlink is
if not os.path.isfile(symlink_path):
os.symlink(os.path.join(extract_dir, package_name, "main.so"), symlink_path)
console.print("[:white_check_mark:] Done!")