Update install and welcome to support running it

pull/2185/head
Xatrekak 1 year ago
parent 2eca92e34d
commit bf5970b904

@ -26,6 +26,7 @@ function help {
echo "--with-openvpn: Install OpenVPN" >&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-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 "--unstable: Use the GNS3 unstable repository"
echo "--help: This help" >&2
@ -49,7 +50,7 @@ I386_REPO=0
DISABLE_KVM=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 ]
then
help
@ -72,6 +73,10 @@ while true ; do
I386_REPO=1
shift
;;
--with-welcome)
WELCOME_SETUP=1
shift
;;
--without-kvm)
DISABLE_KVM=1
shift
@ -296,6 +301,29 @@ fi
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 ]
then
log "Setup VPN"

@ -57,6 +57,10 @@ def get_ip():
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():
"""
@ -449,5 +453,7 @@ try:
edit_proxy()
elif tag == "Shrink":
shrink_disk()
elif tag == "Repair":
repair_remote_install()
except KeyboardInterrupt:
sys.exit(0)
Loading…
Cancel
Save