summaryrefslogtreecommitdiff
path: root/src/backend/setbranch.py
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-04-15 10:34:53 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-04-15 10:34:53 +0100
commitece66a4e9e5d46baa0376bd972f2d4e718b91062 (patch)
tree1c9e73f1e5cc4a78c36dcfe414cbceb63a4e2187 /src/backend/setbranch.py
parent44f62d1aba2751d2d2909cc6eec5cb659a8ecde4 (diff)
check for internet connectivity, and stop execution if there is none
Diffstat (limited to 'src/backend/setbranch.py')
-rw-r--r--src/backend/setbranch.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/backend/setbranch.py b/src/backend/setbranch.py
index ca349f9..7ebd6f7 100644
--- a/src/backend/setbranch.py
+++ b/src/backend/setbranch.py
@@ -101,15 +101,22 @@ def brch_s_warn(branch, remote):
def start(branch, remote):
+ is_online = sisyphus.checkenv.connectivity()
+
if sisyphus.checkenv.root():
- sisyphus.purgeenv.branch()
- sisyphus.purgeenv.metadata()
- ins_g_repo(branch, remote)
- ins_r_repo(branch, remote)
- ins_p_cfg_repo(branch, remote)
- sisyphus.setjobs.start()
- sisyphus.setprofile.start()
- brch_s_warn(branch, remote)
+ if is_online == 1:
+ sisyphus.purgeenv.branch()
+ sisyphus.purgeenv.metadata()
+ ins_g_repo(branch, remote)
+ ins_r_repo(branch, remote)
+ ins_p_cfg_repo(branch, remote)
+ sisyphus.setjobs.start()
+ sisyphus.setprofile.start()
+ brch_s_warn(branch, remote)
+ else:
+ print(sisyphus.getcolor.brigt_red +
+ "\nNo internet connection; Aborting!\n" + sisyphus.getcolor.reset)
+ sys.exit()
else:
print(sisyphus.getcolor.bright_red +
"\nYou need root permissions to do this!\n" + sisyphus.getcolor.reset)