1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 03:08:14 +00:00

Update install and welcome to support running it

This commit is contained in:
Xatrekak 2023-02-11 19:57:54 -05:00
parent 2eca92e34d
commit bf5970b904
2 changed files with 35 additions and 1 deletions

View File

@ -26,6 +26,7 @@ function help {
echo "--with-openvpn: Install OpenVPN" >&2 echo "--with-openvpn: Install OpenVPN" >&2
echo "--with-iou: Install IOU" >&2 echo "--with-iou: Install IOU" >&2
echo "--with-i386-repository: Add the i386 repositories required by IOU if they are not already available on the system. Warning: this will replace your source.list in order to use the official Ubuntu mirror" >&2 echo "--with-i386-repository: Add the i386 repositories required by IOU if they are not already available on the system. Warning: this will replace your source.list in order to use the official Ubuntu mirror" >&2
echo "--with-welcome: Install GNS3-VM welcome.py script" >&2
echo "--without-kvm: Disable KVM, required if system do not support it (limitation in some hypervisors and cloud providers). Warning: only disable KVM if strictly necessary as this will degrade performance" >&2 echo "--without-kvm: Disable KVM, required if system do not support it (limitation in some hypervisors and cloud providers). Warning: only disable KVM if strictly necessary as this will degrade performance" >&2
echo "--unstable: Use the GNS3 unstable repository" echo "--unstable: Use the GNS3 unstable repository"
echo "--help: This help" >&2 echo "--help: This help" >&2
@ -49,7 +50,7 @@ I386_REPO=0
DISABLE_KVM=0 DISABLE_KVM=0
UNSTABLE=0 UNSTABLE=0
TEMP=`getopt -o h --long with-openvpn,with-iou,with-i386-repository,without-kvm,unstable,help -n 'gns3-remote-install.sh' -- "$@"` TEMP=`getopt -o h --long with-openvpn,with-iou,with-i386-repository,with-welcome,without-kvm,unstable,help -n 'gns3-remote-install.sh' -- "$@"`
if [ $? != 0 ] if [ $? != 0 ]
then then
help help
@ -72,6 +73,10 @@ while true ; do
I386_REPO=1 I386_REPO=1
shift shift
;; ;;
--with-welcome)
WELCOME_SETUP=1
shift
;;
--without-kvm) --without-kvm)
DISABLE_KVM=1 DISABLE_KVM=1
shift shift
@ -296,6 +301,29 @@ fi
log "GNS3 installed with success" log "GNS3 installed with success"
if [ $WELCOME_SETUP == 1 ]
then
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
curl https://raw.githubusercontent.com/Xatrekak/gns3-server/master/scripts/welcome.py > /usr/local/bin/welcome.sh
mkdir /etc/systemd/system/getty@tty1.service.d
cat <<EOFI > /etc/systemd/system/getty@tty1.service.d/override.conf
[Service]
ExecStart=
ExecStart=-/sbin/agetty -a gns3 --noclear %I \$TERM
EOFI
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 welcome.py" >> /opt/gns3/.bashrc
fi
if [ $USE_VPN == 1 ] if [ $USE_VPN == 1 ]
then then
log "Setup VPN" log "Setup VPN"

View File

@ -57,6 +57,10 @@ def get_ip():
return ip_addr return ip_addr
def repair_remote_install():
ip_addr = get_ip()
subprocess.run(["sed", "-i", f"'s/host = 0.0.0.0/host = {ip_addr}/'", "/etc/gns3/gns3_server.conf"],capture_output=False)
def get_config(): def get_config():
""" """
@ -449,5 +453,7 @@ try:
edit_proxy() edit_proxy()
elif tag == "Shrink": elif tag == "Shrink":
shrink_disk() shrink_disk()
elif tag == "Repair":
repair_remote_install()
except KeyboardInterrupt: except KeyboardInterrupt:
sys.exit(0) sys.exit(0)