Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d87b347db | ||
|
|
934e4a3b6f | ||
|
|
f0e44eac89 | ||
|
|
33a005a668 | ||
|
|
34e3e04b28 | ||
|
|
0842c81b1f | ||
|
|
027998440a | ||
|
|
d19f216c96 | ||
|
|
059a95ef96 | ||
|
|
f2a5162a71 | ||
|
|
2cae70f6d3 | ||
|
|
6616343ebb | ||
|
|
c38c7d518b | ||
|
|
ae2e4a3a1b | ||
|
|
e644c77731 | ||
|
|
6d55a60719 | ||
|
|
3a50933fb9 | ||
|
|
697415da91 | ||
|
|
46eee30a56 |
@@ -1,6 +1,13 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file. You can upgrade ishare2 to the latest version using `ishare2 upgrade` and then selecting `option 1`
|
||||
|
||||
## [v1.5.7] - 2023-Jan-27
|
||||
1) Added: A new feature has been added to ishare2: It is a web app to use ishare2 in browser and it is called `ishare2 GUI`. You can download it by using `ishare2 gui download` and then start it with `ishare2 gui start`. Open your web browser using http://localhost:5000, http://127.0.01:5000 or http://pnetlab_ip_address:5000 to access. Also, it can be stopped by using `ishare2 gui stop` and restarted with `ishare2 gui restart`
|
||||
|
||||
## [v1.5.6] - 2023-Jan-25
|
||||
|
||||
1) Added: A new option was added to `ishare2 upgrade` > `option 2`: Now, it is possible to upgrade PNETLab from almost any version to v5.3.0 (Not possible for this case: 6.x to 5.3.0)
|
||||
|
||||
## [v1.5.5] - 2023-Jan-23
|
||||
|
||||
1) Added: A new option was added to `ishare2 upgrade` > `option 2`: Now, it is possible to upgrade PNETLab from almost any version to v5.2.9 (Not possible for this case: 6.x to 5.2.9)
|
||||
|
||||
@@ -33,6 +33,7 @@ wget -O /usr/sbin/ishare2 https://raw.githubusercontent.com/pnetlabrepo/ishare2/
|
||||
relicense : Generate a new iourc license for bin images
|
||||
upgrade : Retrieves a menu that allows users to upgrade ishare2 and PNETLab VM
|
||||
changelog : Show the latest changes made to ishare2
|
||||
gui : Web app to use ishare2 in browser
|
||||
help : Show useful information
|
||||
|
||||
param1:
|
||||
@@ -94,6 +95,12 @@ wget -O /usr/sbin/ishare2 https://raw.githubusercontent.com/pnetlabrepo/ishare2/
|
||||
- ishare2 mylabs <path> <number>
|
||||
- ishare2 mylabs <path> all
|
||||
|
||||
## 💎 GUI
|
||||
- ishare2 gui download
|
||||
- ishare2 gui start
|
||||
- ishare2 gui stop
|
||||
- ishare2 gui restart
|
||||
|
||||
## 💎 Extras
|
||||
- ishare2 relicense
|
||||
- ishare2 upgrade
|
||||
@@ -124,6 +131,7 @@ wget -O /usr/sbin/ishare2 https://raw.githubusercontent.com/pnetlabrepo/ishare2/
|
||||
- Upgrade from v5.0.1 to v5.2.7: [Instructions](https://github.com/pnetlabrepo/ishare2/tree/main/upgrades/from_5.0.1_to_5.2.7)
|
||||
- Upgrade from any to v5.2.8: [Instructions](https://github.com/pnetlabrepo/ishare2/tree/main/upgrades/from_any_to_5.2.8)
|
||||
- Upgrade from any to v5.2.9: [Instructions](https://github.com/pnetlabrepo/ishare2/tree/main/upgrades/from_any_to_5.2.9)
|
||||
- Upgrade from any to v5.3.0: [Instructions](https://github.com/pnetlabrepo/ishare2/tree/main/upgrades/from_any_to_5.3.0)
|
||||
|
||||
Note: You can also upgrade PNETLab using `ishare2 upgrade`, then using the `option 2` and finally selecting an option from the displayed list
|
||||
|
||||
|
||||
1
gui/README.md
Normal file
1
gui/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Complete this README.md
|
||||
BIN
gui/app.zip
Normal file
BIN
gui/app.zip
Normal file
Binary file not shown.
63
gui/requirements.txt
Normal file
63
gui/requirements.txt
Normal file
@@ -0,0 +1,63 @@
|
||||
anyio==3.6.2
|
||||
asgiref==3.4.1
|
||||
blinker==1.4
|
||||
certifi==2018.1.18
|
||||
chardet==3.0.4
|
||||
click==8.0.4
|
||||
cloud-init==20.2
|
||||
colorama==0.3.7
|
||||
command-not-found==0.3
|
||||
configobj==5.0.6
|
||||
constantly==15.1.0
|
||||
contextlib2==21.6.0
|
||||
contextvars==2.4
|
||||
cryptography==2.1.4
|
||||
dataclasses==0.8
|
||||
distro-info===0.18ubuntu0.18.04.1
|
||||
fastapi==0.83.0
|
||||
h11==0.13.0
|
||||
httplib2==0.9.2
|
||||
hyperlink==17.3.1
|
||||
idna==3.4
|
||||
immutables==0.19
|
||||
importlib-metadata==4.8.3
|
||||
incremental==16.10.1
|
||||
Jinja2==2.10
|
||||
jsonpatch==1.16
|
||||
jsonpointer==1.10
|
||||
jsonschema==2.6.0
|
||||
language-selector==0.1
|
||||
MarkupSafe==1.0
|
||||
netifaces==0.10.4
|
||||
oauthlib==2.0.6
|
||||
PAM==0.4.2
|
||||
pexpect==4.2.1
|
||||
pyasn1==0.4.2
|
||||
pyasn1-modules==0.2.1
|
||||
pydantic==1.9.2
|
||||
PyGObject==3.26.1
|
||||
PyJWT==1.5.3
|
||||
pyOpenSSL==17.5.0
|
||||
pyserial==3.4
|
||||
python-apt==1.6.5+ubuntu0.5
|
||||
python-debian==0.1.32
|
||||
PyYAML==3.12
|
||||
requests==2.18.4
|
||||
requests-unixsocket==0.1.5
|
||||
service-identity==16.0.0
|
||||
six==1.11.0
|
||||
sniffio==1.2.0
|
||||
ssh-import-id==5.7
|
||||
starlette==0.19.1
|
||||
systemd-python==234
|
||||
Twisted==17.9.0
|
||||
typing_extensions==4.1.1
|
||||
ufw==0.36
|
||||
unattended-upgrades==0.1
|
||||
urllib3==1.22
|
||||
uvicorn==0.16.0
|
||||
uvloop==0.14.0
|
||||
watchgod==0.7
|
||||
websockets==9.1
|
||||
zipp==3.6.0
|
||||
zope.interface==4.3.2
|
||||
86
ishare2
86
ishare2
@@ -24,6 +24,9 @@ function set_url_constants() {
|
||||
URL_UPGRADE_PNETLAB_FROM_5_0_1_TO_5_2_7=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/upgrades/from_5.0.1_to_5.2.7/upgrade.sh
|
||||
URL_UPGRADE_PNETLAB_FROM_any_TO_5_2_8=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/upgrades/from_any_to_5.2.8/upgrade.sh
|
||||
URL_UPGRADE_PNETLAB_FROM_any_TO_5_2_9=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/upgrades/from_any_to_5.2.9/upgrade.sh
|
||||
URL_UPGRADE_PNETLAB_FROM_any_TO_5_3_0=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/upgrades/from_any_to_5.3.0/upgrade.sh
|
||||
URL_GUI_APP_ZIP=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/gui/app.zip
|
||||
URL_REQUIREMENTS_GUI_APP=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/gui/requirements.txt
|
||||
}
|
||||
|
||||
function check_user_is_root() {
|
||||
@@ -959,6 +962,7 @@ function menu_ishare2_upgrade_pnetlab() {
|
||||
"Upgrade PNETLab: from 5.0.1 to 5.2.7"
|
||||
"Upgrade PNETLab: from any version to 5.2.8"
|
||||
"Upgrade PNETLab: from any version to 5.2.9"
|
||||
"Upgrade PNETLab: from any version to 5.3.0"
|
||||
)
|
||||
|
||||
PS3="$prompt"
|
||||
@@ -994,11 +998,17 @@ function menu_ishare2_upgrade_pnetlab() {
|
||||
bash upgrade.sh
|
||||
break
|
||||
;;
|
||||
6)
|
||||
wget -O upgrade.sh $URL_UPGRADE_PNETLAB_FROM_any_TO_5_3_0 > /dev/null 2>&1
|
||||
chmod +x upgrade.sh
|
||||
bash upgrade.sh
|
||||
break
|
||||
;;
|
||||
$((${#options[@]}+1)))
|
||||
break
|
||||
;;
|
||||
*)
|
||||
STR="Invalid option: Select a number from 1 to 6"
|
||||
STR="Invalid option: Select a number from 1 to 7"
|
||||
echo -e "${RED}$STR${NO_COLOR}"
|
||||
continue
|
||||
;;
|
||||
@@ -1045,6 +1055,49 @@ function show_changelog() {
|
||||
rm $FILE
|
||||
}
|
||||
|
||||
function ishare2_gui_download() {
|
||||
rm -rf /root/app
|
||||
|
||||
wget -q $URL_GUI_APP_ZIP -P /root
|
||||
unzip /root/app.zip -d /root > /dev/null 2>&1
|
||||
rm /root/app.zip
|
||||
|
||||
curl https://bootstrap.pypa.io/pip/3.6/get-pip.py -o /root/get-pip.py > /dev/null 2>&1
|
||||
python3 /root/get-pip.py > /dev/null 2>&1
|
||||
rm /root/get-pip.py
|
||||
|
||||
wget -q $URL_REQUIREMENTS_GUI_APP -P /root
|
||||
pip install -r /root/requirements.txt > /dev/null 2>&1
|
||||
rm /root/requirements.txt
|
||||
|
||||
echo -e "${GREEN}GUI has been downloaded and installed. Now, you can start it by using: ishare2 gui start${NO_COLOR}"
|
||||
}
|
||||
|
||||
function ishare2_gui_start() {
|
||||
DIR="/root/app/"
|
||||
if ! [[ -d "$DIR" ]]; then
|
||||
ishare2 gui download
|
||||
fi
|
||||
|
||||
ip_address="$(ip route get 1.2.3.4 | awk '{print $7}')"
|
||||
echo -e "Use http://$ip_address:5000\n"
|
||||
cd /root/app && python3 /root/app/main.py &
|
||||
}
|
||||
|
||||
function ishare2_gui_stop() {
|
||||
array_of_pids="$(ps -a | grep python3 | awk '{ print $1 }')"
|
||||
|
||||
for i in "${array_of_pids[@]}"
|
||||
do
|
||||
kill -9 $i > /dev/null 2>&1
|
||||
done
|
||||
}
|
||||
|
||||
function ishare2_gui_restart() {
|
||||
ishare2 gui stop
|
||||
ishare2 gui start
|
||||
}
|
||||
|
||||
function general_available_list() {
|
||||
TYPE=$1
|
||||
FILENAME=$2
|
||||
@@ -1368,6 +1421,7 @@ action:
|
||||
relicense : Generate a new iourc license for bin images
|
||||
upgrade : Retrieves a menu that allows users to upgrade ishare2 and PNETLab VM
|
||||
changelog : Show the latest changes made to ishare2
|
||||
gui : Web app to use ishare2 in browser
|
||||
help : Show useful information
|
||||
|
||||
param1:
|
||||
@@ -1420,6 +1474,11 @@ Examples:
|
||||
- ishare2 mylabs <path> <number>
|
||||
- ishare2 mylabs <path> all
|
||||
|
||||
- ishare2 gui download
|
||||
- ishare2 gui start
|
||||
- ishare2 gui stop
|
||||
- ishare2 gui restart
|
||||
|
||||
- ishare2 relicense
|
||||
- ishare2 upgrade
|
||||
- ishare2 changelog
|
||||
@@ -2157,6 +2216,31 @@ function selector() {
|
||||
menu_ishare2_upgrade
|
||||
elif [[ "$1" = "changelog" ]]; then # ishare2 changelog
|
||||
show_changelog
|
||||
elif [[ "$1" = "gui" ]]; then # ishare2 gui
|
||||
if [[ "$2" ]]; then
|
||||
if [[ "$2" == "download" ]]; then # ishare2 gui download
|
||||
ishare2_gui_download
|
||||
elif [[ "$2" == "start" ]]; then # ishare2 gui start
|
||||
ishare2_gui_start
|
||||
elif [[ "$2" == "stop" ]]; then # ishare2 gui stop
|
||||
ishare2_gui_stop
|
||||
elif [[ "$2" == "restart" ]]; then # ishare2 gui restart
|
||||
ishare2_gui_restart
|
||||
else
|
||||
echo -e "${RED}Bad last argument${NO_COLOR}"
|
||||
echo -e "Syntax:\n\nishare2 gui <option>\n"
|
||||
echo "ishare2 gui download"
|
||||
echo -e "ishare2 gui start"
|
||||
echo -e "ishare2 gui stop"
|
||||
echo -e "ishare2 gui restart"
|
||||
fi
|
||||
else
|
||||
echo -e "Syntax:\n\nishare2 gui <option>\n"
|
||||
echo "ishare2 gui download"
|
||||
echo -e "ishare2 gui start"
|
||||
echo -e "ishare2 gui stop"
|
||||
echo -e "ishare2 gui restart"
|
||||
fi
|
||||
elif [[ "$1" = "help" ]]; then # ishare2 help
|
||||
show_help_info
|
||||
else # when no args are passed to ishare2
|
||||
|
||||
27
upgrades/from_any_to_5.3.0/README.md
Normal file
27
upgrades/from_any_to_5.3.0/README.md
Normal file
@@ -0,0 +1,27 @@
|
||||
```linux
|
||||
This script allows to upgrade PNETLab from almost any version to v5.3.0
|
||||
It cannot be used when version is 6.x
|
||||
|
||||
File 5.3.0.zip will be downloaded from unetlab.cloud
|
||||
```
|
||||
## upgrade.sh
|
||||
|
||||
`This script cannot be used in cases where PNETLab version is 6.x: An error message will be displayed and the script execution will be finished`
|
||||
|
||||
`Also, this script detects if you already have PNETLab v5.3.0 in your system and avoids to upgrade twice`
|
||||
|
||||
### Upgrade
|
||||
Apply this command using the terminal
|
||||
```linux
|
||||
wget -O upgrade.sh https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/upgrades/from_any_to_5.3.0/upgrade.sh > /dev/null 2>&1 && chmod +x upgrade.sh && bash upgrade.sh
|
||||
```
|
||||
|
||||
After a few seconds, the upgrade will be done.
|
||||
|
||||
Note: This upgrade does not use ishare2:
|
||||
|
||||
When you execute the command from above, the steps are as follows:
|
||||
|
||||
1) A file called [upgrade.sh](https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/upgrades/from_any_to_5.3.0/upgrade.sh) will be downloaded from this repository
|
||||
2) Execution permissions will be made to this file
|
||||
3) This script will be executed in order to make the upgrade
|
||||
50
upgrades/from_any_to_5.3.0/upgrade.sh
Normal file
50
upgrades/from_any_to_5.3.0/upgrade.sh
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script designed to upgrade PNETLab from almost any version to NEW_PNETLAB_VERSION version
|
||||
# Requirement: Not having PNETLab 6.x installed for being able to upgrade to NEW_PNETLAB_VERSION
|
||||
# This script avoids to make this upgrade process twice
|
||||
|
||||
# CONSTANTS
|
||||
NEW_PNETLAB_VERSION=5.3.0
|
||||
GREEN='\033[32m'
|
||||
NO_COLOR='\033[0m'
|
||||
URL_ZIP_FILE=https://unetlab.cloud/api/raw/?path=/UNETLAB%20I/upgrades_pnetlab/from_any_to_5.3.0/5.3.0.zip
|
||||
|
||||
# Getting PNETLab version from db
|
||||
data=$(mysql -uroot -ppnetlab -D pnetlab_db -e "SELECT control_value FROM control WHERE control_value>1;" 2>/dev/null)
|
||||
pnetlab_info=($data)
|
||||
pnetlab_version=${pnetlab_info[1]}
|
||||
|
||||
if [[ $pnetlab_version == $NEW_PNETLAB_VERSION ]]; then
|
||||
echo "PNETLab already upgraded to v$NEW_PNETLAB_VERSION. You can´t upgrade twice"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $pnetlab_version == *6.* ]]; then
|
||||
echo "It is not possible to upgrade to $NEW_PNETLAB_VERSION having version 6.x"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}Downloading $NEW_PNETLAB_VERSION zip file...${NO_COLOR}"
|
||||
wget --content-disposition -q --show-progress -O /root/$NEW_PNETLAB_VERSION.zip $URL_ZIP_FILE
|
||||
echo -e "${GREEN}$NEW_PNETLAB_VERSION zip file has been downloaded successfully${NO_COLOR}"
|
||||
|
||||
cd /root && rm -rf upgrade
|
||||
|
||||
echo -e "${GREEN}Unzipping zip file...${NO_COLOR}"
|
||||
unzip $NEW_PNETLAB_VERSION.zip -d ./upgrade > /dev/null 2>&1
|
||||
echo -e "${GREEN}Zip file has been unzipped successfully...${NO_COLOR}"
|
||||
|
||||
chmod 755 -R upgrade
|
||||
find upgrade -type f -print0 | xargs -0 dos2unix > /dev/null 2>&1
|
||||
|
||||
echo -e "${GREEN}Upgrading to v$NEW_PNETLAB_VERSION...${NO_COLOR}"
|
||||
./upgrade/upgrade
|
||||
echo -e "${GREEN}Upgrade to v$NEW_PNETLAB_VERSION has been done successfully${NO_COLOR}"
|
||||
|
||||
rm -rf upgrade
|
||||
#rm $NEW_PNETLAB_VERSION.zip
|
||||
|
||||
echo -e "${GREEN}PNETLab VM will be rebooted right now...${NO_COLOR}"
|
||||
echo -e "${GREEN}Try to connect again in about a minute${NO_COLOR}"
|
||||
reboot
|
||||
Reference in New Issue
Block a user