mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-11-16 16:54:51 +02:00
Merge pull request #2321 from Xatrekak/master
Fixed updating system and GNS3 via welcome.py.
This commit is contained in:
commit
46d9ada6d8
@ -304,6 +304,11 @@ log "GNS3 installed with success"
|
|||||||
|
|
||||||
if [ $WELCOME_SETUP == 1 ]
|
if [ $WELCOME_SETUP == 1 ]
|
||||||
then
|
then
|
||||||
|
cat <<EOFI > /etc/sudoers.d/gns3
|
||||||
|
gns3 ALL = (ALL) NOPASSWD: /usr/bin/apt-key
|
||||||
|
gns3 ALL = (ALL) NOPASSWD: /usr/bin/apt-get
|
||||||
|
gns3 ALL = (ALL) NOPASSWD: /usr/sbin/reboot
|
||||||
|
EOFI
|
||||||
NEEDRESTART_MODE=a 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 apt-get install -y python3-pip
|
||||||
NEEDRESTART_MODE=a apt-get install -y dialog
|
NEEDRESTART_MODE=a apt-get install -y dialog
|
||||||
|
@ -163,19 +163,38 @@ class Welcome_dialog:
|
|||||||
|
|
||||||
def update(self, force=False):
|
def update(self, force=False):
|
||||||
if not force:
|
if not force:
|
||||||
if self.display.yesno("PLEASE SNAPSHOT THE VM BEFORE RUNNING THE UPGRADE IN CASE OF FAILURE. The server will reboot at the end of the upgrade process. Continue?") != self.display.OK:
|
if self.display.yesno("It is recommended to ensure all Nodes are shutdown before upgrading. Continue?") != self.display.OK:
|
||||||
return
|
return
|
||||||
release = self.get_release()
|
code, option = self.display.menu("Select an option",
|
||||||
if release == "2.2":
|
choices=[("Upgrade GNS3", "Upgrades only the GNS3 pakage and dependences."),
|
||||||
if self.display.yesno("It is recommended to run GNS3 version 2.2 with lastest GNS3 VM based on Ubuntu 18.04 LTS, please download this VM from our website or continue at your own risk!") != self.display.OK:
|
("Upgrade All", "Upgrades all avaiable packages"),
|
||||||
|
("Dist Upgrade", "Upgrades all avaiable packages and the Linux Kernel. Requires a reboot.")])
|
||||||
|
if code == Dialog.OK:
|
||||||
|
if option == "Upgrade GNS3":
|
||||||
|
ret = os.system(
|
||||||
|
"sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A2E3EF7B \
|
||||||
|
&& sudo apt-get update \
|
||||||
|
&& sudo apt-get install -y --only-upgrade gns3-server"
|
||||||
|
)
|
||||||
|
elif option == "Upgrade All":
|
||||||
|
ret = os.system(
|
||||||
|
'sudo apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com \
|
||||||
|
&& sudo apt-get update \
|
||||||
|
&& sudo apt-get upgrade --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"'
|
||||||
|
)
|
||||||
|
elif option == "Dist Upgrade":
|
||||||
|
ret = os.system(
|
||||||
|
'sudo apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com \
|
||||||
|
&& sudo apt-get update \
|
||||||
|
&& sudo apt-get dist-upgrade --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"'
|
||||||
|
)
|
||||||
|
if ret != 0:
|
||||||
|
print("ERROR DURING UPGRADE PROCESS PLEASE TAKE A SCREENSHOT IF YOU NEED SUPPORT")
|
||||||
|
time.sleep(15)
|
||||||
return
|
return
|
||||||
if release.endswith("dev"):
|
if option == "Dist Upgrade":
|
||||||
ret = os.system("curl -Lk https://raw.githubusercontent.com/GNS3/gns3-vm/unstable/scripts/update_{}.sh > /tmp/update.sh && bash -x /tmp/update.sh".format(release))
|
if self.display.yesno("Reboot now?") == self.display.OK:
|
||||||
else:
|
os.system("sudo reboot now")
|
||||||
ret = os.system("curl -Lk https://raw.githubusercontent.com/GNS3/gns3-vm/master/scripts/update_{}.sh > /tmp/update.sh && bash -x /tmp/update.sh".format(release))
|
|
||||||
if ret != 0:
|
|
||||||
print("ERROR DURING UPGRADE PROCESS PLEASE TAKE A SCREENSHOT IF YOU NEED SUPPORT")
|
|
||||||
time.sleep(15)
|
|
||||||
|
|
||||||
|
|
||||||
def migrate(self):
|
def migrate(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user