From 86eedd3ccf1ad15c98373d97e48622b36db75843 Mon Sep 17 00:00:00 2001 From: pkgdemon Date: Fri, 11 Jul 2025 10:30:51 -0500 Subject: [PATCH 1/5] Add support for detecting and doing the right thing for Gershwin users --- src/add_users.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/add_users.py b/src/add_users.py index b8dff2e..16b38a5 100644 --- a/src/add_users.py +++ b/src/add_users.py @@ -26,7 +26,11 @@ def save_selection(self): name = self.name.get_text() up = self.password.get_text() shell = self.sh - hf = '/home/%s' % self.user.get_text() + try: + open('/Users') + hf = '/Users/%s' % self.user.get_text() + except: + hf = '/home/%s' % self.user.get_text() hst = self.host.get_text() ul = [uname, name, up, shell, hf] @@ -86,7 +90,13 @@ def __init__(self, button3): self.repassword.connect("changed", self.password_verification, button3) self.label5 = Gtk.Label("Shell") shell = Gtk.ComboBoxText() - self.sh = '/usr/local/bin/fish' + try: + open('/Users') + self.sh = '/usr/local/bin/zsh' + shell_default = 7 + except: + self.sh = '/usr/local/bin/fish' + shell_default = 3 shell.append_text('sh') shell.append_text('csh') shell.append_text('tcsh') @@ -95,7 +105,7 @@ def __init__(self, button3): shell.append_text('rbash') shell.append_text('ksh') shell.append_text('zsh') - shell.set_active(3) + shell.set_active(shell_default) shell.connect("changed", self.on_shell) label = Gtk.Label('Set Hostname') label.set_use_markup(True) From 770f8418933f7a96f18f293599df16c1e5d9ee86 Mon Sep 17 00:00:00 2001 From: pkgdemon Date: Sat, 12 Jul 2025 13:15:43 -0500 Subject: [PATCH 2/5] Remove shell_default to address review --- src/add_users.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/add_users.py b/src/add_users.py index 16b38a5..6278501 100644 --- a/src/add_users.py +++ b/src/add_users.py @@ -93,10 +93,8 @@ def __init__(self, button3): try: open('/Users') self.sh = '/usr/local/bin/zsh' - shell_default = 7 except: self.sh = '/usr/local/bin/fish' - shell_default = 3 shell.append_text('sh') shell.append_text('csh') shell.append_text('tcsh') From dc2714068ae4bc499ec991013a565ff02cfd3672 Mon Sep 17 00:00:00 2001 From: pkgdemon Date: Sat, 12 Jul 2025 13:19:09 -0500 Subject: [PATCH 3/5] Remove another shell_default to address review --- src/add_users.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/add_users.py b/src/add_users.py index 6278501..80882f6 100644 --- a/src/add_users.py +++ b/src/add_users.py @@ -103,7 +103,6 @@ def __init__(self, button3): shell.append_text('rbash') shell.append_text('ksh') shell.append_text('zsh') - shell.set_active(shell_default) shell.connect("changed", self.on_shell) label = Gtk.Label('Set Hostname') label.set_use_markup(True) From e4b7a1f7920a33eeb3a5a4a4d368a8fa8adf6c79 Mon Sep 17 00:00:00 2001 From: pkgdemon Date: Sat, 12 Jul 2025 13:26:21 -0500 Subject: [PATCH 4/5] Address sourcery review for path check --- src/add_users.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/add_users.py b/src/add_users.py index 80882f6..a752017 100644 --- a/src/add_users.py +++ b/src/add_users.py @@ -2,6 +2,7 @@ from gi.repository import Gtk, Gdk import pickle +import os from gbi_common import password_strength # Directory use from the installer. @@ -26,11 +27,10 @@ def save_selection(self): name = self.name.get_text() up = self.password.get_text() shell = self.sh - try: - open('/Users') - hf = '/Users/%s' % self.user.get_text() - except: - hf = '/home/%s' % self.user.get_text() + if os.path.isdir('/Users'): + if os.path.isdir('/Users'): + if os.path.isdir('/Users'): + if os.path.isdir('/Users'): hst = self.host.get_text() ul = [uname, name, up, shell, hf] From 6873f47341c76362e5159a9a0b9f15fabd1de80d Mon Sep 17 00:00:00 2001 From: pkgdemon Date: Sat, 12 Jul 2025 14:19:08 -0500 Subject: [PATCH 5/5] Changes to fix sorcery suggested fix --- src/add_users.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/add_users.py b/src/add_users.py index a752017..57028c9 100644 --- a/src/add_users.py +++ b/src/add_users.py @@ -28,9 +28,9 @@ def save_selection(self): up = self.password.get_text() shell = self.sh if os.path.isdir('/Users'): - if os.path.isdir('/Users'): - if os.path.isdir('/Users'): - if os.path.isdir('/Users'): + hf = '/Users/%s' % self.user.get_text() + else: + hf = '/home/%s' % self.user.get_text() hst = self.host.get_text() ul = [uname, name, up, shell, hf]