From 952b4e72499fd519dcbf0d71eb519e6084c5b2a0 Mon Sep 17 00:00:00 2001 From: Xatrekak Date: Sat, 11 Feb 2023 23:24:23 -0500 Subject: [PATCH] fixed some shell bugs --- scripts/remote-install.sh | 10 ++++++---- scripts/welcome.py | 7 +++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/scripts/remote-install.sh b/scripts/remote-install.sh index cab68c1c..85c16414 100644 --- a/scripts/remote-install.sh +++ b/scripts/remote-install.sh @@ -164,7 +164,7 @@ apt-get install -y gns3-server log "Create user GNS3 with /opt/gns3 as home directory" if [ ! -d "/opt/gns3/" ] then - useradd -d /opt/gns3/ -m gns3 + useradd -m -d /opt/gns3/ gns3 fi @@ -303,10 +303,11 @@ log "GNS3 installed with success" if [ $WELCOME_SETUP == 1 ] then -apt-get install -y net-tools +NEEDRESTART_MODE=a apt-get install -y net-tools NEEDRESTART_MODE=a apt-get install -y python3-pip -NEEDRESTART_MODE=a pip install --no-input --upgrade pip -NEEDRESTART_MODE=a pip install --no-input pythondialog +NEEDRESTART_MODE=a apt-get install -y dialog +pip install --no-input --upgrade pip +pip install --no-input pythondialog curl https://raw.githubusercontent.com/Xatrekak/gns3-server/remote_install_changes/scripts/welcome.py > /usr/local/bin/welcome.py @@ -324,6 +325,7 @@ chmod 755 /etc/systemd/system/getty@tty1.service.d/override.conf chown root:root /etc/systemd/system/getty@tty1.service.d/override.conf echo "python3 /usr/local/bin/welcome.py" >> /opt/gns3/.bashrc +usermod --shell /bin/bash gns3 fi diff --git a/scripts/welcome.py b/scripts/welcome.py index f69c2f5e..993bd2e5 100644 --- a/scripts/welcome.py +++ b/scripts/welcome.py @@ -107,8 +107,11 @@ def gns3vm_version(): """ Return the GNS3 VM version """ - with open('/home/gns3/.config/GNS3/gns3vm_version') as f: - return f.read().strip() + try: + with open('/home/gns3/.config/GNS3/gns3vm_version') as f: + return f.read().strip() + except FileNotFoundError: + return "Remote Install" d = Dialog(dialog="dialog", autowidgetsize=True)