From 5f3b1b6d2c28f846b40b5b784b599ebc6271c55a Mon Sep 17 00:00:00 2001 From: ericbsd Date: Wed, 17 Apr 2019 22:41:20 -0300 Subject: [PATCH] updating install.py from gbi --- src/install.py | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/install.py b/src/install.py index e2970ea..9520b0c 100644 --- a/src/install.py +++ b/src/install.py @@ -13,17 +13,22 @@ from gi.repository import Gtk, GLib import threading # import locale import os -from subprocess import Popen, PIPE, call +from subprocess import Popen, PIPE, STDOUT, call from time import sleep -from db_partition import rDeleteParttion, destroyParttion, makingParttion +from partition_handler import rDeleteParttion, destroyParttion, makingParttion +from create_cfg import gbsd_cfg from slides import gbsdSlides # from slides import dbsdSlides import sys -installer = "/usr/local/lib/gbinstall/" +installer = "/usr/local/lib/gbi/" sys.path.append(installer) tmp = "/tmp/.gbi/" +gbi_path = "/usr/local/lib/gbi/" sysinstall = "/usr/local/sbin/pc-sysinstall" -logo = "/usr/local/lib/gbinstall/logo.png" +rcconfgbsd = "/etc/rc.conf.ghostbsd" +rcconfdbsd = "/etc/rc.conf.desktopbsd" +default_site = "/usr/local/lib/gbi/slides/welcome.html" +logo = "/usr/local/lib/gbi/logo.png" def update_progess(probar, bartext): @@ -33,12 +38,13 @@ def update_progess(probar, bartext): def read_output(command, probar): - GLib.idle_add(update_progess, probar, "Stoping hald service") call('service hald stop', shell=True) - sleep(1) - GLib.idle_add(update_progess, probar, "Umount /media/GhostBSD") + GLib.idle_add(update_progess, probar, "Creating pcinstall.cfg") + + # If rc.conf.ghostbsd exists run gbsd_cfg + gbsd_cfg() call('umount /media/GhostBSD', shell=True) - sleep(1) + sleep(2) if os.path.exists(tmp + 'delete'): GLib.idle_add(update_progess, probar, "Deleting partition") rDeleteParttion() @@ -53,15 +59,10 @@ def read_output(command, probar): GLib.idle_add(update_progess, probar, "Creating new partitions") makingParttion() sleep(1) - process = Popen( - command, - shell=True, - stdout=PIPE, - close_fds=True, - universal_newlines=True - ) + p = Popen(command, shell=True, stdin=PIPE, stdout=PIPE, + stderr=STDOUT, close_fds=True, universal_newlines=True) while True: - line = process.stdout.readline() + line = p.stdout.readline() if not line: break bartext = line.rstrip() @@ -73,11 +74,11 @@ def read_output(command, probar): print(bartext) call('service hald start', shell=True) if bartext.rstrip() == "Installation finished!": - Popen(f'python3.6 {installer}end.py', shell=True, close_fds=True) + Popen('python2.7 %send.py' % gbi_path, shell=True, close_fds=True) call("rm -rf /tmp/.gbi/", shell=True, close_fds=True) Gtk.main_quit() else: - Popen(f'python3.6 {installer}error.py', shell=True, close_fds=True) + Popen('python2.7 %serror.py' % gbi_path, shell=True, close_fds=True) Gtk.main_quit() @@ -93,7 +94,10 @@ class installSlide(): self.mainVbox = Gtk.VBox(False, 0) self.mainVbox.show() self.mainHbox.pack_start(self.mainVbox, True, True, 0) + # if os.path.exists(rcconfgbsd): slide = gbsdSlides() + # elif os.path.exists(rcconfdbsd): + # slide = dbsdSlides() getSlides = slide.get_slide() self.mainVbox.pack_start(getSlides, True, True, 0) @@ -111,7 +115,7 @@ class installProgress(): # args=(command, self.pbar)) # thr.setDaemon(True) # thr.start() - # self.pbar.show() + self.pbar.show() def getProgressBar(self): return self.pbar