Skip to content

Commit

Permalink
Merge branch '17g-installer:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
sulincix authored Sep 17, 2023
2 parents b9cb8a4 + fb4be8d commit 2e11ee2
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 60 deletions.
2 changes: 1 addition & 1 deletion live-installer/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def package_manager(process, packages=[]):
if "{packages}" not in pm[process]:
return pm[process]
elif len(packages) == 0:
return ":"
return ":"
pkgs = ""

for p in packages:
Expand Down
1 change: 1 addition & 0 deletions live-installer/configs/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
# skip_keyboard: false
# skip_options: false
# skip_user: false
# skip_partition: false
# hide_keyboard_model: false
# allow_uppercase_hostname: true
# allow_week_password: true
Expand Down
2 changes: 1 addition & 1 deletion live-installer/frontend/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_user_list():
if uid != "1000":
users.append(user)
return users


def get_country_list():
countries = {}
Expand Down
70 changes: 36 additions & 34 deletions live-installer/frontend/gtk_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(self, fullscreen=False):
# slide gtk images
self.gtkimages = []
self.gtkpixbufs = []

# user list
validate.userlist = common.get_user_list()

Expand Down Expand Up @@ -97,7 +97,7 @@ def __init__(self, fullscreen=False):
self.builder.get_object("button_quit").connect(
"clicked", self.quit_cb)


self.builder.get_object("check_eula").connect(
"clicked", self.assign_eula)
self.builder.get_object("text_eula").get_buffer().set_text(open("./branding/eula.txt","r").read())
Expand Down Expand Up @@ -137,6 +137,7 @@ def __init__(self, fullscreen=False):

# build timezones
timezones.build_timezones(self)
self.timezone_init()

# type page
model = Gtk.ListStore(str, str)
Expand Down Expand Up @@ -322,10 +323,7 @@ def enter_event(widget=None, name=""):
# build partition list
self.should_pulse = False

# build options page
if config.get("skip_options", False):
obox.hide()


if not config.get("use_swap",False):
self.builder.get_object("check_swap").hide()

Expand All @@ -336,7 +334,7 @@ def enter_event(widget=None, name=""):
self.builder.get_object("button_back").set_sensitive(False)
self.slideshow()
self.window.set_position(Gtk.WindowPosition.CENTER)
self.window.show_all()
self.window.show()
if not fullscreen and config.get("set_alternative_ui", False):
self.builder.get_object("button_quit").hide()
if fullscreen:
Expand Down Expand Up @@ -395,7 +393,7 @@ def enter_event(widget=None, name=""):
True # dummy action
if self.setup.winroot and (
not self.setup.gptonefi or self.setup.winefi):
self.builder.get_object("box_replace_win").show_all()
self.builder.get_object("box_replace_win").show()

self.builder.get_object("label_copyright").set_label(
config.get("copyright", "17g Developer Team"))
Expand Down Expand Up @@ -424,6 +422,18 @@ def enter_event(widget=None, name=""):
if self.testmode:
self.builder.get_object("label_install_progress").set_text("text "*100)

def timezone_init(self):
lang_country_code = self.setup.language.split('_')[-1]
for value in (self.cur_timezone, # timezone guessed from IP
self.cur_country_code, # otherwise pick country from IP
lang_country_code): # otherwise use country from language selection
if not value:
continue
for row in timezones.timezones:
if value in row:
timezones.select_timezone(row)
break
break

def manually_edit_partitions(self,widget):
""" Edit only known disks, selected one first """
Expand Down Expand Up @@ -597,8 +607,8 @@ def i18n(self):
def view_password_text(self,entry, icon_pos, event):
entry.set_visibility(True)
entry.set_icon_from_icon_name(0,"view-conceal-symbolic")


def hide_password_text(self,entry, icon_pos, event):
entry.set_visibility(False)
entry.set_icon_from_icon_name(0,"view-reveal-symbolic")
Expand Down Expand Up @@ -642,11 +652,11 @@ def assign_password(self, widget):

self.week_password = (weekMessage != "")
errorFound = (password_error != None)

if errorFound:
wlabel.set_text("")
self.week_password = False

self.week_warning = weekMessage
self.assign_entry("entry_password", errorFound ,self.week_password)

Expand Down Expand Up @@ -752,7 +762,6 @@ def update_variables(self,widget=None):
self.setup.real_name = self.builder.get_object("entry_name").get_text()
self.setup.swap_size = int(self.builder.get_object("swap_size").get_text())*1024

@asynchronous
def build_lang_list(self):

self.cur_timezone = config.get('default_timezone', "Europe/London")
Expand Down Expand Up @@ -815,7 +824,6 @@ def flag(ccode):
if config.get("allow_auto_novariant", True):
self.setup.keyboard_variant = ""

@asynchronous
def build_kb_lists(self):
''' Do some xml kung-fu and load the keyboard stuffs '''
# Determine the layouts in use
Expand Down Expand Up @@ -907,7 +915,7 @@ def part_add_button_event(self,widget):
start = self.selected_partition.partition.geometry.start
end = self.selected_partition.partition.geometry.end
mbr = self.selected_partition.mbr
if QuestionDialog(_("Are you sure?"),
if QuestionDialog(_("Are you sure?"),
_("New partition will created at {}").format(mbr)):
command = "parted -s {} mkpart primary ext4 {}s {}s".format(mbr,start,end)
def update_partition_menu(pid, status):
Expand All @@ -922,7 +930,7 @@ def part_remove_button_event(self,widget):
path = self.selected_partition.path
mbr = self.selected_partition.mbr
partnum = partitioning.find_partition_number(path)
if QuestionDialog(_("Are you sure?"),
if QuestionDialog(_("Are you sure?"),
_("Partition {} will removed from {}.").format(path,mbr)):
def update_partition_menu(pid, status):
partitioning.build_partitions(self)
Expand Down Expand Up @@ -1051,7 +1059,7 @@ def assign_keyboard_variant(self, treeview):
command = "setxkbmap -layout '%s' -variant '%s'" % (
self.setup.keyboard_layout, self.setup.keyboard_variant)
os.system(command)

if config.get("keyboard_preview", True):
self.keyboardview.update(self.setup.keyboard_layout, self.setup.keyboard_variant)

Expand All @@ -1073,27 +1081,14 @@ def activate_page(self, nex=0, index=0, goback=False):
if self.testmode:
self.builder.get_object("notebook1").set_visible_child_name(str(nex))
return

if index == self.PAGE_LANGUAGE:
if goback:
True # Do nothing
elif self.setup.language is None:
WarningDialog(_("Installer"), _(
"Please choose a language"))
return
else:
self.set_language(self.setup.language)
lang_country_code = self.setup.language.split('_')[-1]
for value in (self.cur_timezone, # timezone guessed from IP
self.cur_country_code, # otherwise pick country from IP
lang_country_code): # otherwise use country from language selection
if not value:
continue
for row in timezones.timezones:
if value in row:
timezones.select_timezone(row)
break
break
elif index == self.PAGE_TIMEZONE:
if ("_" in self.setup.language):
country_code = self.setup.language.split("_")[1]
Expand Down Expand Up @@ -1258,7 +1253,7 @@ def activate_page_type(self):
row = model[active]
self.setup.disk = row[1]
self.setup.diskname = row[0]

if self.setup.disk is None:
errorFound = True
errorMessage = _("Please select a disk.")
Expand All @@ -1278,6 +1273,7 @@ def activate_page_type(self):
partitioning.build_partitions(self)
partitioning.build_grub_partitions()
if config.get("skip_user", False):
self.show_overview()
self.activate_page(self.PAGE_OVERVIEW)
else:
self.activate_page(self.PAGE_USER)
Expand Down Expand Up @@ -1340,6 +1336,8 @@ def wizard_cb(self, widget, goback, data=None):
sel = nex
if sel == self.PAGE_TIMEZONE:
nex = self.PAGE_TYPE
if config.get("skip_partition", False):
sel = nex
if sel == self.PAGE_USER:
nex = self.PAGE_OVERVIEW
if sel == self.PAGE_TYPE:
Expand All @@ -1359,13 +1357,17 @@ def wizard_cb(self, widget, goback, data=None):
nex = self.PAGE_INSTALL
self.activate_page(nex, nex)
else:

if sel == self.PAGE_OVERVIEW:
nex = self.PAGE_USER
if config.get("skip_user", False):
sel = nex
if sel == self.PAGE_PARTITIONS:
nex = self.PAGE_TYPE
if sel == self.PAGE_USER:
nex = self.PAGE_TYPE
if config.get("skip_partition", False):
sel = nex
if sel == self.PAGE_TYPE:
nex = self.PAGE_TIMEZONE
if config.get("skip_timezone", False):
Expand All @@ -1388,7 +1390,6 @@ def wizard_cb(self, widget, goback, data=None):
self.builder.get_object("button_next").set_sensitive(True)
self.activate_page(nex, sel, goback)

@asynchronous
def show_overview(self):
def bold(strvar):
return '<b>' + str(strvar) + '</b>'
Expand Down Expand Up @@ -1604,6 +1605,7 @@ def slideshow(self):
page_num = self.images.index(i)
self.slides.add_titled(im, str(page_num), str(page_num))
self.cur_slide_pos = 0
self.slides.show_all()
#GLib.timeout_add(100, self.set_slide_page)

def set_slide_page(self):
Expand Down
2 changes: 1 addition & 1 deletion live-installer/frontend/tui_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(self):
self.installer.set_progress_hook(self.progress_hook)
self.d = Dialog(dialog="dialog", autowidgetsize=True)
pages = [
self.page_welcome,
self.page_welcome,
self.page_language,
self.page_timezone,
self.page_keyboard_model,
Expand Down
27 changes: 5 additions & 22 deletions live-installer/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

NON_LATIN_KB_LAYOUTS = ['am', 'af', 'ara', 'ben', 'bd', 'bg', 'bn', 'bt', 'by', 'deva', 'et', 'ge', 'gh', 'gn', 'gr',
'guj', 'guru', 'id', 'il', 'iku', 'in', 'iq', 'ir', 'kan', 'kg', 'kh', 'kz', 'la', 'lao', 'lk',
'ma', 'mk', 'mm', 'mn', 'mv', 'mal', 'my', 'np', 'ori', 'pk', 'ru', 'rs', 'scc', 'sy', 'syr',
'ma', 'mk', 'mm', 'mn', 'mv', 'mal', 'my', 'np', 'ori', 'pk', 'ru', 'rs', 'scc', 'sy', 'syr',
'tel', 'th', 'tj', 'tam', 'tz', 'ua', 'uz']


Expand Down Expand Up @@ -93,7 +93,7 @@ def start_installation(self):
self.mount_partitions()
if os.path.isdir("/lib/live-installer"):
os.chdir("/lib/live-installer")

# Custom commands
self.do_hook_commands("pre_rsync_hook")

Expand Down Expand Up @@ -158,11 +158,11 @@ def start_installation(self):
self.our_current = min(
self.our_current + 1, self.our_total)
self.update_progress(_("Copying /%s") % line)


# Custom commands
self.do_hook_commands("post_rsync_hook")

# Steps:
self.our_total = 12
self.our_current = 0
Expand Down Expand Up @@ -303,7 +303,7 @@ def get_next():
# replae this with changeable function
partitioning.full_disk_format(disk_device,
create_boot = (self.auto_boot_partition is not None),
create_swap = (self.auto_swap_partition is not None),
create_swap = (self.auto_swap_partition is not None),
swap_size = self.setup.swap_size)

# Encrypt root partition
Expand Down Expand Up @@ -749,23 +749,6 @@ def add_locale(lang):
self.setup.keyboard_layout, self.setup.keyboard_variant))
newconsolefh.close()

# Keyboard settings (gnome)
if os.path.exists("/target/usr/share/glib-2.0/schemas/org.gnome.desktop.input-sources.gschema.xml"):
with open("/target/usr/share/glib-2.0/schemas/99_17g-gnome-keyboard-config.gschema.override", "w") as schema:
layouts, variants = self.setup.keyboard_layout.split(","), self.setup.keyboard_variant.split(",")

schema.write("[org.gnome.desktop.input-sources]\n")

output = "sources = ["
for i in range(2 if "," in self.setup.keyboard_layout else 1):
output += "('xkb', '" + layouts[i]
if variants[i]:
output += "+" + variants[i]
output += "')" + (", " if i == 0 and "," in self.setup.keyboard_layout else "")
schema.write(output + "]")
self.run("chroot||glib-compile-schemas /usr/share/glib-2.0/schemas/",vital=False)


# minimize if enabled
if self.setup.minimal_installation:
self.update_progress(_("Removing extra packages"), True)
Expand Down
2 changes: 1 addition & 1 deletion live-installer/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
config.get("live_password", "live"), config.get("live_user", "user")))
else:
os.system("passwd -d {}".format(config.get("live_user", "user")))

for i in config.get("additional_user_groups", (["audio", "video", "netdev"])):
os.system("usermod -aG \"{}\" \"{}\"".format(i, config.get("live_user", "user")))

Expand Down

0 comments on commit 2e11ee2

Please sign in to comment.