updating install.py from gbi

This commit is contained in:
ericbsd
2019-04-17 22:41:20 -03:00
parent 539b1d490c
commit 5f3b1b6d2c
+23 -19
View File
@@ -13,17 +13,22 @@ from gi.repository import Gtk, GLib
import threading import threading
# import locale # import locale
import os import os
from subprocess import Popen, PIPE, call from subprocess import Popen, PIPE, STDOUT, call
from time import sleep 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 gbsdSlides
# from slides import dbsdSlides # from slides import dbsdSlides
import sys import sys
installer = "/usr/local/lib/gbinstall/" installer = "/usr/local/lib/gbi/"
sys.path.append(installer) sys.path.append(installer)
tmp = "/tmp/.gbi/" tmp = "/tmp/.gbi/"
gbi_path = "/usr/local/lib/gbi/"
sysinstall = "/usr/local/sbin/pc-sysinstall" 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): def update_progess(probar, bartext):
@@ -33,12 +38,13 @@ def update_progess(probar, bartext):
def read_output(command, probar): def read_output(command, probar):
GLib.idle_add(update_progess, probar, "Stoping hald service")
call('service hald stop', shell=True) call('service hald stop', shell=True)
sleep(1) GLib.idle_add(update_progess, probar, "Creating pcinstall.cfg")
GLib.idle_add(update_progess, probar, "Umount /media/GhostBSD")
# If rc.conf.ghostbsd exists run gbsd_cfg
gbsd_cfg()
call('umount /media/GhostBSD', shell=True) call('umount /media/GhostBSD', shell=True)
sleep(1) sleep(2)
if os.path.exists(tmp + 'delete'): if os.path.exists(tmp + 'delete'):
GLib.idle_add(update_progess, probar, "Deleting partition") GLib.idle_add(update_progess, probar, "Deleting partition")
rDeleteParttion() rDeleteParttion()
@@ -53,15 +59,10 @@ def read_output(command, probar):
GLib.idle_add(update_progess, probar, "Creating new partitions") GLib.idle_add(update_progess, probar, "Creating new partitions")
makingParttion() makingParttion()
sleep(1) sleep(1)
process = Popen( p = Popen(command, shell=True, stdin=PIPE, stdout=PIPE,
command, stderr=STDOUT, close_fds=True, universal_newlines=True)
shell=True,
stdout=PIPE,
close_fds=True,
universal_newlines=True
)
while True: while True:
line = process.stdout.readline() line = p.stdout.readline()
if not line: if not line:
break break
bartext = line.rstrip() bartext = line.rstrip()
@@ -73,11 +74,11 @@ def read_output(command, probar):
print(bartext) print(bartext)
call('service hald start', shell=True) call('service hald start', shell=True)
if bartext.rstrip() == "Installation finished!": 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) call("rm -rf /tmp/.gbi/", shell=True, close_fds=True)
Gtk.main_quit() Gtk.main_quit()
else: 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() Gtk.main_quit()
@@ -93,7 +94,10 @@ class installSlide():
self.mainVbox = Gtk.VBox(False, 0) self.mainVbox = Gtk.VBox(False, 0)
self.mainVbox.show() self.mainVbox.show()
self.mainHbox.pack_start(self.mainVbox, True, True, 0) self.mainHbox.pack_start(self.mainVbox, True, True, 0)
# if os.path.exists(rcconfgbsd):
slide = gbsdSlides() slide = gbsdSlides()
# elif os.path.exists(rcconfdbsd):
# slide = dbsdSlides()
getSlides = slide.get_slide() getSlides = slide.get_slide()
self.mainVbox.pack_start(getSlides, True, True, 0) self.mainVbox.pack_start(getSlides, True, True, 0)
@@ -111,7 +115,7 @@ class installProgress():
# args=(command, self.pbar)) # args=(command, self.pbar))
# thr.setDaemon(True) # thr.setDaemon(True)
# thr.start() # thr.start()
# self.pbar.show() self.pbar.show()
def getProgressBar(self): def getProgressBar(self):
return self.pbar return self.pbar