summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/verbs/install.py20
-rw-r--r--src/verbs/sync.py17
2 files changed, 20 insertions, 17 deletions
diff --git a/src/verbs/install.py b/src/verbs/install.py
index 4c91291..671154b 100644
--- a/src/verbs/install.py
+++ b/src/verbs/install.py
@@ -6,7 +6,7 @@ import time
import requests
import hashlib
-from verbs.sync import sync
+from verbs.sync import sync, run_post_install
def get_best_source(available, sources_list="/var/lib/xipkg/sources"):
source_speeds = {}
@@ -273,7 +273,7 @@ def install_package(package_name, package_path, package_info,
# TODO loading bar here
files = util.extract_tar(package_path, root)
if post_install:
- run_post_install(config, verbose=verbose, root=root)
+ run_post_install(config, verbose=verbose, rost=root)
save_installed_info(package_name, package_info, files, repo, source_url, key, config, root=root)
return files
@@ -311,20 +311,6 @@ def save_installed_info(package_name, package_info,
file.write(files)
-def run_post_install(config, verbose=False, root="/"):
- installed_dir = util.add_path(root, config["dir"]["postinstall"])
- if os.path.exists(installed_dir):
- files = os.listdir(installed_dir)
- for file in files:
- f = util.add_path(config["dir"]["postinstall"], file)
- command = f"sh {f}"
- if root != "/":
- os.chroot(root)
- os.chdir("/")
- os.system(command)
- os.remove(f)
-
-
def install_single(package, options, config, post_install=True, verbose=False, unsafe=False):
checksum, sources, repo, size, files = find_package(package, config["repos"],
config["dir"]["packages"], config["sources"])
@@ -408,7 +394,7 @@ def install_multiple(to_install, args, options, config, terminology=("install",
(package, package_path, source, key, repo, info) = f
files = install_package(package, package_path, info,
- repo, source, key, True,
+ repo, source, key, root == "/",
config, verbose=v, root=options["r"])
extracted += len(files.split("\n"))
diff --git a/src/verbs/sync.py b/src/verbs/sync.py
index 5559fcb..f81716b 100644
--- a/src/verbs/sync.py
+++ b/src/verbs/sync.py
@@ -7,6 +7,23 @@ import sys
CACHE_DIR = "/var/cache/xipkg"
+def run_post_install(config, verbose=False, root="/"):
+ if root == "/":
+ installed_dir = util.add_path(root, config["dir"]["postinstall"])
+ if os.path.exists(installed_dir):
+ files = os.listdir(installed_dir)
+ if len(files) > 0:
+ done = 0
+ for file in files:
+ util.loading_bar(done, len(files), f"Running Postinstalls...")
+ f = util.add_path(config["dir"]["postinstall"], file)
+ command = f"sh {f}"
+ os.chdir("/")
+ os.system(command)
+ os.remove(f)
+ done += 1
+ util.loading_bar(len(files), len(files), f"Run Postinstalls")
+
# returns a dictionary, and duration:
# key: package name
# value: list of info [checksum, size]