Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6546abc42 | ||
|
|
2fb6cd534d | ||
|
|
a97f3fee59 | ||
|
|
b36474aca9 | ||
|
|
6cd98dfb9b | ||
|
|
98b7d04a48 | ||
|
|
6d69a62109 | ||
|
|
ab582418d5 | ||
|
|
66f9a76e92 | ||
|
|
a0cd572e1b | ||
|
|
3a7ab5c2af | ||
|
|
2cd63c44a2 | ||
|
|
b2c1c5f554 | ||
|
|
640d4d776d | ||
|
|
5e07400e5c | ||
|
|
76d95d9bd0 | ||
|
|
aa8769b7dd | ||
|
|
7b73156b1c | ||
|
|
e5da554158 | ||
|
|
e7492cbf67 | ||
|
|
6d9f45b56b | ||
|
|
89b8e808ed | ||
|
|
c61e8398e4 | ||
|
|
27a7e2de7b | ||
|
|
c76b832ac6 | ||
|
|
bfd2377c8a | ||
|
|
3064fdcab2 | ||
|
|
3503add54c | ||
|
|
cab7df20ff | ||
|
|
1b30909d0b | ||
|
|
71e9cae4fa | ||
|
|
dbe22ff781 | ||
|
|
95ef408d04 | ||
|
|
2c81ae0673 | ||
|
|
d5c5869aa8 | ||
|
|
2fdd1ce655 | ||
|
|
7bd23fb5db | ||
|
|
142144bf2e | ||
|
|
d21fff1c08 | ||
|
|
820ddfe905 | ||
|
|
c517e64850 | ||
|
|
646a913ccb | ||
|
|
ff3e77b47b | ||
|
|
06e0a62a51 | ||
|
|
04980423d3 | ||
|
|
612bfbabfb | ||
|
|
65d40b1b15 | ||
|
|
d40caaf705 | ||
|
|
890c44303e | ||
|
|
bf585fa7f7 | ||
|
|
6e142e9244 | ||
|
|
bc6463681b | ||
|
|
7921908fd8 | ||
|
|
4f0752c59c | ||
|
|
62fb888cd5 |
51
CHANGELOG.md
51
CHANGELOG.md
@@ -1,5 +1,54 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file. You can upgrade ishare2 to the latest version using `ishare2 upgrade`
|
||||
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.2] - 2023-Jan-22
|
||||
|
||||
1) Modified: Some strings were modified when using this option: `ishare2 upgrade` > `option 2`. Now, it looks better for users
|
||||
|
||||
## [v1.5.1] - 2023-Jan-22
|
||||
|
||||
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.8 (Not possible for this case: 6.x to 5.2.8)
|
||||
|
||||
## [v1.5.0] - 2023-Jan-22
|
||||
|
||||
1) Added: Some code has been added to ishare2 to support PNETLab upgrade to v5.2.8 (Same as v5.2.7 fix: AMD and Intel folders at html/templates/). PNETLab users from v4.2.10 should not have any problem
|
||||
|
||||
## [v1.4.9] - 2023-Jan-19
|
||||
|
||||
1) Added: This version adds support to PNETLab 6.x related to yml template location (AMD and Intel folders)
|
||||
|
||||
## [v1.4.8] - 2023-Jan-17
|
||||
|
||||
1) Added: A menu was added into the `ishare2 upgrade` command. This menu allows users to upgrade ishare2 and PNETLab to their latest versions
|
||||
|
||||
## [v1.4.7] - 2023-Jan-16
|
||||
|
||||
1) Added: A function called set_url_constants() was added to the code and to the main() execution. This function contains all of the URL needed in the project.
|
||||
2) Modified: Function called set_color_variables() was renamed to set_color_constants()
|
||||
|
||||
## [v1.4.6] - 2023-Jan-16
|
||||
|
||||
1) Modified: Minor changes in code: A function called set_color_variables() was created to define all color variables in there. Added to main() execution
|
||||
2) Deleted: Minor changes in code: Every definition of those variables was removed to get a cleaner code
|
||||
|
||||
Note: This update does not change how the code works in any way
|
||||
|
||||
## [v1.4.5] - 2023-Jan-13
|
||||
|
||||
1) Modified: Minor changes in code: A line was changed from: ls -lh -R /opt/unetlab/addons/iol/bin to: ls -lh -R /opt/unetlab/addons/iol/bin/
|
||||
2) Deleted: Minor changes in code: A comment stating "# Main code" was deleted from the code
|
||||
|
||||
Note: This update does not change how the code works in any way
|
||||
|
||||
## [v1.4.4] - 2023-Jan-11
|
||||
|
||||
1) Modified: ishare2 code has been modified to better readability using a main() function
|
||||
2) Modified: Some functions were put together for better understanding: msg_available_options_for_ishare2_search() and msg_incorrect_argument_or_no_arg_for_ishare2_pull()
|
||||
3) Modified: ishare2 content help function was indented
|
||||
4) Modified: get_initial_info() renamed to get_initial_information()
|
||||
5) Modified: check_version_file_exists() renamed to check_ishare2_version_file_exists()
|
||||
6) Added: - ishare2 search palo and - ishare2 search Licensed were added like examples to the ishare2 message when explaining ishare2 search
|
||||
7) Added: selector() function was created in order to use a main() function
|
||||
|
||||
## [v1.4.3] - 2023-Jan-04
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ Apply this command using the terminal
|
||||
wget -O /usr/sbin/ishare2 https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/ishare2 > /dev/null 2>&1 && chmod +x /usr/sbin/ishare2 && ishare2
|
||||
```
|
||||
|
||||
Note: There is no need to be in the same directory where *ishare2* file is installed in order to execute it
|
||||
`Note: There is no need to be in the same directory where ishare2 file is installed in order to execute it`
|
||||
|
||||
## ✅ Syntax
|
||||
|
||||
@@ -31,7 +31,7 @@ Note: There is no need to be in the same directory where *ishare2* file is insta
|
||||
labs : Show labs on server and download images for those labs
|
||||
mylabs : Same as labs command but using a customized path to labs
|
||||
relicense : Generate a new iourc license for bin images
|
||||
upgrade : Upgrade ishare2 code to the latest version
|
||||
upgrade : Retrieves a menu that allows users to upgrade ishare2 and PNETLab VM
|
||||
changelog : Show the latest changes made to ishare2
|
||||
help : Show useful information
|
||||
|
||||
@@ -104,7 +104,7 @@ Note: There is no need to be in the same directory where *ishare2* file is insta
|
||||
|
||||
* For problems, use our Telegram Channel describing your problem and sending a screenshot and/or a video
|
||||
* For new files to be uploaded, you can also use our Telegram Channel: In this case, you can send or ask for new images to be uploaded
|
||||
* Using ishare2 upgrade will result in upgrading this utility (ishare2). It will not upgrade your PNETLab Ubuntu VM version
|
||||
* Using ishare2 upgrade will display a menu that allows users to upgrade ishare2 and PNETLab.
|
||||
* If CiscoIOUKeygen.py, iourc and/or keepalive.pl files in /opt/unetlab/addons/iol/bin/ are deleted, you can recover them by using ishare2 relicense. This will not affect images in there
|
||||
|
||||
Also, this command when used, will generate a new license file called "iourc", needed for bin files
|
||||
@@ -122,6 +122,9 @@ Note: There is no need to be in the same directory where *ishare2* file is insta
|
||||
- Upgrade from v4.2.10 to v5.0.1: [Instructions](https://github.com/pnetlabrepo/ishare2/tree/main/upgrades/from_4.2.10_to_5.0.1)
|
||||
- Upgrade from v4.2.10 to v5.2.7: [Instructions](https://github.com/pnetlabrepo/ishare2/tree/main/upgrades/from_4.2.10_to_5.2.7)
|
||||
- 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)
|
||||
|
||||
Note: You can also upgrade PNETLab using `ishare2 upgrade`, then using the `option 2` and finally selecting an option from the displayed list
|
||||
|
||||
## Known limitations
|
||||
|
||||
|
||||
1
id_list
1
id_list
@@ -2,4 +2,3 @@ GOOGLE=2PACX-1vR-RCxKCkhzzW2ZDDQOUIAxq2QTPwcCJZXuFyGD0hvXDC60TMU0_Yx1fx02S1_H9h7
|
||||
BIN=0
|
||||
QEMU=647866092
|
||||
DYNAMIPS=1118397071
|
||||
CREDENTIALS=1957719637
|
||||
|
||||
639
ishare2
639
ishare2
@@ -1,20 +1,40 @@
|
||||
#!/bin/bash
|
||||
#October, 2022
|
||||
|
||||
function set_color_constants() {
|
||||
RED='\033[31m'
|
||||
YELLOW='\033[1;33m'
|
||||
GREEN='\033[32m'
|
||||
NO_COLOR='\033[0m'
|
||||
}
|
||||
|
||||
function set_url_constants() {
|
||||
URL_ID_LIST=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/id_list
|
||||
URL_VERSION=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/version
|
||||
URL_ISHARE2=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/ishare2
|
||||
URL_CHANGELOG_MD=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/CHANGELOG.md
|
||||
URL_CISCO_IOU_KEYGEN_PY=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/iol/bin/CiscoIOUKeygen.py
|
||||
URL_KEEPALIVE_PL=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/iol/bin/keepalive.pl
|
||||
URL_I86BI_LINUX_L2_YML=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/templates/i86bi_linux_l2/i86bi_linux_l2.yml
|
||||
URL_I86BI_LINUX_L3_YML=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/templates/i86bi_linux_l3/i86bi_linux_l3.yml
|
||||
URL_C2600_YML=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/templates/cisco/c2600.yml
|
||||
URL_C1760_YML=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/templates/cisco/c1760.yml
|
||||
URL_UPGRADE_PNETLAB_FROM_4_2_10_TO_5_0_1=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/upgrades/from_4.2.10_to_5.0.1/upgrade.sh
|
||||
URL_UPGRADE_PNETLAB_FROM_4_2_10_TO_5_2_7=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/upgrades/from_4.2.10_to_5.2.7/upgrade.sh
|
||||
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
|
||||
}
|
||||
|
||||
function check_user_is_root() {
|
||||
user=$(whoami)
|
||||
|
||||
RED='\033[31m'
|
||||
NO_COLOR='\033[0m'
|
||||
|
||||
if [[ "$user" != "root" ]]; then
|
||||
echo -e "${RED}[!] Current user ($user) is not root, please change user as root to execute this script${NO_COLOR}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function get_initial_info() {
|
||||
ID_LIST="$(curl -s https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/id_list)"
|
||||
function get_initial_information() {
|
||||
ID_LIST="$(curl -s $URL_ID_LIST)"
|
||||
|
||||
GOOGLE_SHEETS_ID=$( echo "$ID_LIST" | awk -F= '/^GOOGLE/ { print $2 }' )
|
||||
BIN_GID=$( echo "$ID_LIST" | awk -F= '/^BIN/ { print $2 }' )
|
||||
@@ -29,6 +49,16 @@ function get_initial_info() {
|
||||
DYNAMIPS_URL=$URL_PREFIX$DYNAMIPS_GID$URL_POSTFIX
|
||||
}
|
||||
|
||||
function get_server_platform() {
|
||||
grep -q vmx /proc/cpuinfo && echo -n vmx > /opt/unetlab/platform
|
||||
grep -q svm /proc/cpuinfo && echo -n svm > /opt/unetlab/platform
|
||||
|
||||
platform=$(cat /opt/unetlab/platform)
|
||||
|
||||
if [[ $platform == "vmx" ]]; then YML_DIR="/opt/unetlab/html/templates/intel/" ; fi
|
||||
if [[ $platform == "svm" ]]; then YML_DIR="/opt/unetlab/html/templates/amd/" ; fi
|
||||
}
|
||||
|
||||
function set_yml_template_folder_location() {
|
||||
data=$(mysql -uroot -ppnetlab -D pnetlab_db -e "SELECT control_value FROM control WHERE control_value>1;" 2>/dev/null)
|
||||
data_array=($data)
|
||||
@@ -36,21 +66,15 @@ function set_yml_template_folder_location() {
|
||||
|
||||
if [[ $pnetlab_version == "4.2.10" ]]; then YML_DIR="/opt/unetlab/html/templates/" ; fi
|
||||
|
||||
if [[ $pnetlab_version == "5.2.5" ]] || [[ $pnetlab_version == "5.2.6" ]] || [[ $pnetlab_version == "5.2.7" ]]; then
|
||||
grep -q vmx /proc/cpuinfo && echo -n vmx > /opt/unetlab/platform
|
||||
grep -q svm /proc/cpuinfo && echo -n svm > /opt/unetlab/platform
|
||||
|
||||
platform=$(cat /opt/unetlab/platform)
|
||||
|
||||
if [[ $platform == "vmx" ]]; then YML_DIR="/opt/unetlab/html/templates/intel/" ; fi
|
||||
if [[ $platform == "svm" ]]; then YML_DIR="/opt/unetlab/html/templates/amd/" ; fi
|
||||
if [[ $pnetlab_version == "5.2.5" ]] || [[ $pnetlab_version == "5.2.6" ]] || [[ $pnetlab_version == "5.2.7" ]] || [[ $pnetlab_version == "5.2.8" ]]; then
|
||||
get_server_platform
|
||||
fi
|
||||
|
||||
if [[ $pnetlab_version == *6.* ]]; then
|
||||
get_server_platform
|
||||
fi
|
||||
}
|
||||
|
||||
check_user_is_root
|
||||
get_initial_info
|
||||
set_yml_template_folder_location
|
||||
|
||||
function mylabs_get_lab_list_just_for_only_readable_labs() {
|
||||
LABS_DIR=$1
|
||||
|
||||
@@ -165,13 +189,9 @@ function mylabs_install_lab_images_just_for_only_readable_labs() {
|
||||
if [[ $NUMBER -gt $counter_for_readable_labs || $NUMBER -le 0 ]]; then
|
||||
if [[ $counter_for_readable_labs -eq 1 ]]; then
|
||||
STR="Last parameter must be 1 because you have only one lab"
|
||||
YELLOW='\033[1;33m'
|
||||
NO_COLOR='\033[0m'
|
||||
echo -e "${YELLOW}$STR${NO_COLOR}"
|
||||
else
|
||||
STR="Last parameter must be a number between 1 and $counter_for_readable_labs"
|
||||
YELLOW='\033[1;33m'
|
||||
NO_COLOR='\033[0m'
|
||||
echo -e "${YELLOW}$STR${NO_COLOR}"
|
||||
fi
|
||||
|
||||
@@ -221,9 +241,6 @@ function mylabs_install_lab_images_just_for_only_readable_labs() {
|
||||
|
||||
echo -e "\nImages found on lab\n"
|
||||
|
||||
GREEN='\033[32m'
|
||||
NO_COLOR='\033[0m'
|
||||
|
||||
echo -e "${GREEN}--- bin images ---${NO_COLOR}"
|
||||
if [[ BIN_FLAG -eq 1 ]]; then
|
||||
echo No bin images found
|
||||
@@ -463,13 +480,9 @@ function install_lab_images_just_for_only_readable_labs() {
|
||||
if [[ $NUMBER -gt $counter_for_readable_labs || $NUMBER -le 0 ]]; then
|
||||
if [[ $counter_for_readable_labs -eq 1 ]]; then
|
||||
STR="Last parameter must be 1 because you have only one lab"
|
||||
YELLOW='\033[1;33m'
|
||||
NO_COLOR='\033[0m'
|
||||
echo -e "${YELLOW}$STR${NO_COLOR}"
|
||||
else
|
||||
STR="Last parameter must be a number between 1 and $counter_for_readable_labs"
|
||||
YELLOW='\033[1;33m'
|
||||
NO_COLOR='\033[0m'
|
||||
echo -e "${YELLOW}$STR${NO_COLOR}"
|
||||
fi
|
||||
|
||||
@@ -519,9 +532,6 @@ function install_lab_images_just_for_only_readable_labs() {
|
||||
|
||||
echo -e "\nImages found on lab"
|
||||
|
||||
GREEN='\033[32m'
|
||||
NO_COLOR='\033[0m'
|
||||
|
||||
echo -e "${GREEN}--- bin images ---${NO_COLOR}"
|
||||
if [[ BIN_FLAG -eq 1 ]]; then
|
||||
echo No bin images found
|
||||
@@ -728,8 +738,6 @@ function download_lab_iol_images() {
|
||||
|
||||
if [[ $FLAG -eq 0 ]]; then
|
||||
STR="(BIN) WARNING: Image $BIN_NAME has not been found"
|
||||
YELLOW='\033[1;33m'
|
||||
NO_COLOR='\033[0m'
|
||||
echo -e "${YELLOW}$STR${NO_COLOR}"
|
||||
fi
|
||||
done < $filename1
|
||||
@@ -765,8 +773,6 @@ function download_lab_dynamips_images() {
|
||||
|
||||
if [[ $FLAG -eq 0 ]]; then
|
||||
STR="(DYNAMIPS) WARNING: Image $DYNAMIPS_NAME has not been found"
|
||||
YELLOW='\033[1;33m'
|
||||
NO_COLOR='\033[0m'
|
||||
echo -e "${YELLOW}$STR${NO_COLOR}"
|
||||
fi
|
||||
done < $filename1
|
||||
@@ -806,8 +812,6 @@ function download_lab_qemu_images() {
|
||||
|
||||
if [[ $FLAG -eq 0 ]]; then
|
||||
STR="(QEMU) WARNING: Image $QEMU_NAME has not been found"
|
||||
YELLOW='\033[1;33m'
|
||||
NO_COLOR='\033[0m'
|
||||
echo -e "${YELLOW}$STR${NO_COLOR}"
|
||||
fi
|
||||
done < $filename1
|
||||
@@ -815,10 +819,6 @@ function download_lab_qemu_images() {
|
||||
}
|
||||
|
||||
function check_docker_service_status() {
|
||||
RED='\033[31m'
|
||||
GREEN='\033[32m'
|
||||
NO_COLOR='\033[0m'
|
||||
|
||||
if service docker status | grep -q "active (running)"; then
|
||||
return 0 # 0 means "no failures"
|
||||
fi
|
||||
@@ -928,17 +928,15 @@ function download_lab_docker_images() {
|
||||
count_dockers
|
||||
}
|
||||
|
||||
function check_version_file_exists() {
|
||||
function check_ishare2_version_file_exists() {
|
||||
if ! [[ -e /usr/sbin/ishare2_version ]]; then
|
||||
echo -n "$(curl -s https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/version)" >> /usr/sbin/ishare2_version
|
||||
echo -n "$(curl -s $URL_VERSION)" >> /usr/sbin/ishare2_version
|
||||
fi
|
||||
}
|
||||
|
||||
check_version_file_exists
|
||||
|
||||
function upgrade_ishare2() {
|
||||
LOCAL_VALUE=$(cat /usr/sbin/ishare2_version)
|
||||
REMOTE_VALUE=$(curl -s https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/version)
|
||||
REMOTE_VALUE=$(curl -s $URL_VERSION)
|
||||
|
||||
if [[ $LOCAL_VALUE == "$REMOTE_VALUE" ]]; then
|
||||
echo "ishare2 $REMOTE_VALUE is currently the newest version available"
|
||||
@@ -946,7 +944,7 @@ function upgrade_ishare2() {
|
||||
fi
|
||||
|
||||
rm /usr/sbin/ishare2
|
||||
wget -O /usr/sbin/ishare2 https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/ishare2 > /dev/null 2>&1
|
||||
wget -O /usr/sbin/ishare2 $URL_ISHARE2 > /dev/null 2>&1
|
||||
chmod +x /usr/sbin/ishare2
|
||||
|
||||
echo "ishare2 was upgraded from $LOCAL_VALUE to $REMOTE_VALUE"
|
||||
@@ -954,12 +952,89 @@ function upgrade_ishare2() {
|
||||
echo "$REMOTE_VALUE" >> /usr/sbin/ishare2_version
|
||||
}
|
||||
|
||||
function menu_ishare2_upgrade_pnetlab() {
|
||||
prompt="Please, select an option: "
|
||||
options=(
|
||||
"Upgrade PNETLab: from 4.2.10 to 5.0.1"
|
||||
"Upgrade PNETLab: from 4.2.10 to 5.2.7"
|
||||
"Upgrade PNETLab: from 5.0.1 to 5.2.7"
|
||||
"Upgrade PNETLab: from any version to 5.2.8"
|
||||
)
|
||||
|
||||
PS3="$prompt"
|
||||
select opt in "${options[@]}" "Exit"; do
|
||||
case "$REPLY" in
|
||||
1)
|
||||
wget -O upgrade.sh $URL_UPGRADE_PNETLAB_FROM_4_2_10_TO_5_0_1 > /dev/null 2>&1
|
||||
chmod +x upgrade.sh
|
||||
bash upgrade.sh
|
||||
break
|
||||
;;
|
||||
2)
|
||||
wget -O upgrade.sh $URL_UPGRADE_PNETLAB_FROM_4_2_10_TO_5_2_7 > /dev/null 2>&1
|
||||
chmod +x upgrade.sh
|
||||
bash upgrade.sh
|
||||
break
|
||||
;;
|
||||
3)
|
||||
wget -O upgrade.sh $URL_UPGRADE_PNETLAB_FROM_5_0_1_TO_5_2_7 > /dev/null 2>&1
|
||||
chmod +x upgrade.sh
|
||||
bash upgrade.sh
|
||||
break
|
||||
;;
|
||||
4)
|
||||
wget -O upgrade.sh $URL_UPGRADE_PNETLAB_FROM_any_TO_5_2_8 > /dev/null 2>&1
|
||||
chmod +x upgrade.sh
|
||||
bash upgrade.sh
|
||||
break
|
||||
;;
|
||||
$((${#options[@]}+1)))
|
||||
break
|
||||
;;
|
||||
*)
|
||||
STR="Invalid option: Select a number from 1 to 5"
|
||||
echo -e "${RED}$STR${NO_COLOR}"
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function menu_ishare2_upgrade() {
|
||||
prompt="Please, select an option: "
|
||||
options=(
|
||||
"Upgrade ishare2"
|
||||
"Upgrade PNETLab"
|
||||
)
|
||||
|
||||
PS3="$prompt"
|
||||
select opt in "${options[@]}" "Exit"; do
|
||||
case "$REPLY" in
|
||||
1)
|
||||
upgrade_ishare2
|
||||
break
|
||||
;;
|
||||
2)
|
||||
menu_ishare2_upgrade_pnetlab
|
||||
break
|
||||
;;
|
||||
$((${#options[@]}+1)))
|
||||
break
|
||||
;;
|
||||
*)
|
||||
STR="Invalid option: Select a number from 1 to 3"
|
||||
echo -e "${RED}$STR${NO_COLOR}"
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function show_changelog() {
|
||||
FILE=/root/CHANGELOG.md
|
||||
if [[ -e $FILE ]]; then rm $FILE ; fi
|
||||
|
||||
CHANGELOG_URL=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/CHANGELOG.md
|
||||
DATA="$(wget -q $CHANGELOG_URL -P /root)"
|
||||
DATA="$(wget -q $URL_CHANGELOG_MD -P /root)"
|
||||
head -n 15 $FILE
|
||||
rm $FILE
|
||||
}
|
||||
@@ -990,11 +1065,11 @@ function generate_a_new_license() {
|
||||
|
||||
if [[ -e $PYTHON_FILE ]]; then rm $PYTHON_FILE ; fi
|
||||
|
||||
wget -O $PYTHON_FILE https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/iol/bin/CiscoIOUKeygen.py > /dev/null 2>&1
|
||||
wget -O $PYTHON_FILE $URL_CISCO_IOU_KEYGEN_PY > /dev/null 2>&1
|
||||
python $PYTHON_FILE > /dev/null 2>&1
|
||||
|
||||
if ! [[ -e $PERL_FILE ]]; then
|
||||
wget -O $PERL_FILE https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/iol/bin/keepalive.pl > /dev/null 2>&1
|
||||
wget -O $PERL_FILE $URL_KEEPALIVE_PL > /dev/null 2>&1
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
@@ -1242,13 +1317,10 @@ function pull_bin() {
|
||||
}
|
||||
|
||||
function show_help_info() {
|
||||
YELLOW='\033[1;33m'
|
||||
NO_COLOR='\033[0m'
|
||||
|
||||
echo -e "1) For problems, use our Telegram Channel describing your problem and sending a screenshot and/or a video"
|
||||
echo -e "\n2) For new files to be uploaded, you can use our Telegram Channel too"
|
||||
echo -e "In this case, you can send or ask for new images to be uploaded"
|
||||
echo -e "\n3) Using \033[32mishare2 upgrade\033[0m will result in upgrading this utility (ishare2). It will \033[31mnot\033[0m upgrade your PNETLab Ubuntu VM version"
|
||||
echo -e "\n3) Using \033[32mishare2 upgrade\033[0m will display a menu that allows users to upgrade ishare2 and PNETLab."
|
||||
echo -e "\n4) If CiscoIOUKeygen.py, iourc and/or keepalive.pl files in /opt/unetlab/addons/iol/bin/ are deleted, you can recover them by using \033[32mishare2 relicense\033[0m. This will not affect images in there."
|
||||
echo -e "Also, this command when used, will generate a new license file called iourc, needed for bin files"
|
||||
echo -e "\n5) Don't cancell a download. In case you do it, you will have to remove incomplete files or folders manually"
|
||||
@@ -1260,12 +1332,9 @@ function show_ishare2_usage() {
|
||||
# For ishare2
|
||||
ISHARE2_VERSION_USAGE=$(cat /usr/sbin/ishare2_version)
|
||||
|
||||
YELLOW='\033[1;33m'
|
||||
NO_COLOR='\033[0m'
|
||||
|
||||
STR=""
|
||||
LOCAL_VALUE=$ISHARE2_VERSION_USAGE
|
||||
REMOTE_VALUE=$(curl -s https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/version)
|
||||
REMOTE_VALUE=$(curl -s $URL_VERSION)
|
||||
|
||||
if ! [[ $LOCAL_VALUE == "$REMOTE_VALUE" ]]; then
|
||||
STR="New ishare2 version available: $REMOTE_VALUE"
|
||||
@@ -1280,34 +1349,36 @@ function show_ishare2_usage() {
|
||||
|
||||
# Message displayed when using ishare2 command
|
||||
echo "
|
||||
Usage ishare2 [action] [param1] [param2]
|
||||
Syntax
|
||||
|
||||
action:
|
||||
search : Search for images by type
|
||||
pull : Download an image by type and number
|
||||
installed : Show installed images on server
|
||||
labs : Show labs on server and download images for those labs
|
||||
mylabs : Same as labs command but using a customized path to labs
|
||||
relicense : Generate a new iourc license for bin images
|
||||
upgrade : Upgrade ishare2 code to the latest version
|
||||
changelog : Show the latest changes made to ishare2
|
||||
help : Show useful information
|
||||
ishare2 [action] [param1] [param2]
|
||||
|
||||
param1:
|
||||
type = all, bin, qemu, dynamips, docker or name
|
||||
action:
|
||||
search : Search for images by type
|
||||
pull : Download an image by type and number
|
||||
installed : Show installed images on server
|
||||
labs : Show labs on server and download images for those labs
|
||||
mylabs : Same as labs command but using a customized path to labs
|
||||
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
|
||||
help : Show useful information
|
||||
|
||||
param2:
|
||||
number = This number can be obtained using ishare2 search <type>
|
||||
param1:
|
||||
type = all, bin, qemu, dynamips, docker or name
|
||||
|
||||
Examples:
|
||||
param2:
|
||||
number = This number can be obtained using ishare2 search <type>
|
||||
|
||||
- ishare2 search <type>
|
||||
- ishare2 search all
|
||||
- ishare2 search bin
|
||||
- ishare2 search qemu
|
||||
- ishare2 search dynamips
|
||||
- ishare2 search <name>
|
||||
Examples:
|
||||
Examples:
|
||||
|
||||
- ishare2 search <type>
|
||||
- ishare2 search all
|
||||
- ishare2 search bin
|
||||
- ishare2 search qemu
|
||||
- ishare2 search dynamips
|
||||
- ishare2 search <name>
|
||||
Examples:
|
||||
- ishare2 search vios
|
||||
- ishare2 search win-
|
||||
- ishare2 search winserver
|
||||
@@ -1317,38 +1388,68 @@ function show_ishare2_usage() {
|
||||
- ishare2 search nxos
|
||||
- ishare2 search vmx
|
||||
- ishare2 search esxi
|
||||
- ishare2 search palo
|
||||
- ishare2 search Licensed
|
||||
- More <name> options using ishare2 search all
|
||||
|
||||
- ishare2 pull bin <number>
|
||||
- ishare2 pull qemu <number>
|
||||
- ishare2 pull dynamips <number>
|
||||
- ishare2 pull bin <number>
|
||||
- ishare2 pull qemu <number>
|
||||
- ishare2 pull dynamips <number>
|
||||
|
||||
- ishare2 pull bin all
|
||||
- ishare2 pull qemu all (Unavailable for qemu type)
|
||||
- ishare2 pull dynamips all
|
||||
- ishare2 pull bin all
|
||||
- ishare2 pull qemu all (Not available for qemu type due to its large size)
|
||||
- ishare2 pull dynamips all
|
||||
|
||||
- ishare2 installed all
|
||||
- ishare2 installed bin
|
||||
- ishare2 installed qemu
|
||||
- ishare2 installed dynamips
|
||||
- ishare2 installed docker
|
||||
- ishare2 installed all
|
||||
- ishare2 installed bin
|
||||
- ishare2 installed qemu
|
||||
- ishare2 installed dynamips
|
||||
- ishare2 installed docker
|
||||
|
||||
- ishare2 labs
|
||||
- ishare2 labs <number>
|
||||
- ishare2 labs all
|
||||
- ishare2 labs
|
||||
- ishare2 labs <number>
|
||||
- ishare2 labs all
|
||||
|
||||
- ishare2 mylabs <path>
|
||||
- ishare2 mylabs <path> <number>
|
||||
- ishare2 mylabs <path> all
|
||||
- ishare2 mylabs <path>
|
||||
- ishare2 mylabs <path> <number>
|
||||
- ishare2 mylabs <path> all
|
||||
|
||||
- ishare2 relicense
|
||||
- ishare2 upgrade
|
||||
- ishare2 changelog
|
||||
- ishare2 help
|
||||
- ishare2 relicense
|
||||
- ishare2 upgrade
|
||||
- ishare2 changelog
|
||||
- ishare2 help
|
||||
|
||||
ishare2: $ISHARE2_VERSION_USAGE$NEW_VERSION_RESULT
|
||||
pnetlab: v$PNETLAB_VERSION_USAGE
|
||||
"
|
||||
ishare2: $ISHARE2_VERSION_USAGE$NEW_VERSION_RESULT
|
||||
pnetlab: v$PNETLAB_VERSION_USAGE
|
||||
"
|
||||
}
|
||||
|
||||
function msg_available_options_for_ishare2_search() {
|
||||
echo -e "Available options\n"
|
||||
echo "- ishare2 search all"
|
||||
echo "- ishare2 search qemu"
|
||||
echo "- ishare2 search dynamips"
|
||||
echo "- ishare2 search bin"
|
||||
echo "- ishare2 search <name>"
|
||||
echo " - ishare2 search vios"
|
||||
echo " - ishare2 search win-"
|
||||
echo " - ishare2 search winserver"
|
||||
echo " - ishare2 search kali"
|
||||
echo " - ishare2 search mikro"
|
||||
echo " - ishare2 search forti"
|
||||
echo " - ishare2 search nxos"
|
||||
echo " - ishare2 search vmx"
|
||||
echo " - ishare2 search esxi"
|
||||
echo " - More <name> options using ishare2 search all"
|
||||
}
|
||||
|
||||
function msg_incorrect_argument_or_no_arg_for_ishare2_pull() {
|
||||
echo -e "Syntax:\nishare2 pull <type> <number>\n"
|
||||
echo "type: bin, qemu or dynamips"
|
||||
echo -e "number: ishare2 search <type>\n"
|
||||
echo "Example: ishare2 pull qemu 4"
|
||||
echo "Example: ishare2 pull dynamips 5"
|
||||
echo -e "Example: ishare2 pull bin 6"
|
||||
}
|
||||
|
||||
function tgz_files_function() {
|
||||
@@ -1595,7 +1696,7 @@ function corrections_for_iol_images() {
|
||||
|
||||
FILE="$YML_DIR"i86bi_linux_l2.yml
|
||||
if ! [[ -e $FILE ]]; then
|
||||
wget -O $FILE https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/templates/i86bi_linux_l2/i86bi_linux_l2.yml > /dev/null 2>&1
|
||||
wget -O $FILE $URL_I86BI_LINUX_L2_YML > /dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1604,7 +1705,7 @@ function corrections_for_iol_images() {
|
||||
|
||||
FILE="$YML_DIR"i86bi_linux_l3.yml
|
||||
if ! [[ -e $FILE ]]; then
|
||||
wget -O $FILE https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/templates/i86bi_linux_l3/i86bi_linux_l3.yml > /dev/null 2>&1
|
||||
wget -O $FILE $URL_I86BI_LINUX_L3_YML > /dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -1673,13 +1774,13 @@ function corrections_for_dynamips_images() {
|
||||
SUBSTRING="c2600"
|
||||
if [[ "$NAME" == *"$SUBSTRING"* ]]; then
|
||||
FILE="$YML_DIR"c2600.yml
|
||||
wget -O $FILE https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/templates/cisco/c2600.yml > /dev/null 2>&1
|
||||
wget -O $FILE $URL_C2600_YML > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
SUBSTRING="c1760"
|
||||
if [[ "$NAME" == *"$SUBSTRING"* ]]; then
|
||||
FILE="$YML_DIR"c1760.yml
|
||||
wget -O $FILE https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/templates/cisco/c1760.yml > /dev/null 2>&1
|
||||
wget -O $FILE $URL_C1760_YML > /dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1917,186 +2018,154 @@ function filter_qemu() {
|
||||
rm "$(pwd)"/new.csv > /dev/null 2>&1
|
||||
}
|
||||
|
||||
# Main code
|
||||
|
||||
if [[ "$1" = "search" ]]; then # ishare2 search
|
||||
if [[ "$2" = "all" ]]; then # ishare2 search all
|
||||
ishare2 search qemu
|
||||
ishare2 search dynamips
|
||||
ishare2 search bin
|
||||
echo " "
|
||||
elif [[ "$2" = "qemu" ]]; then # ishare2 search qemu
|
||||
FILENAME=QEMU_URL.csv
|
||||
general_available_list QEMU "$FILENAME" "$QEMU_URL"
|
||||
rm "$(pwd)"/$FILENAME > /dev/null 2>&1
|
||||
elif [[ "$2" = "dynamips" ]]; then # ishare2 search dynamips
|
||||
FILENAME=DYNAMIPS_URL.csv
|
||||
general_available_list DYNAMIPS "$FILENAME" "$DYNAMIPS_URL"
|
||||
rm "$(pwd)"/$FILENAME > /dev/null 2>&1
|
||||
elif [[ "$2" = "bin" ]]; then # ishare2 search bin
|
||||
FILENAME=BIN_URL.csv
|
||||
general_available_list BIN "$FILENAME" "$BIN_URL"
|
||||
rm "$(pwd)"/$FILENAME > /dev/null 2>&1
|
||||
else # 1) ishare2 search 2) ishare2 search <number> 3) ishare2 search <string>
|
||||
if [[ $2 ]]; then
|
||||
filter_bin "$2"
|
||||
filter_dynamips "$2"
|
||||
filter_qemu "$2"
|
||||
else
|
||||
echo -e "Available options\n"
|
||||
echo "- ishare2 search all"
|
||||
echo "- ishare2 search qemu"
|
||||
echo "- ishare2 search dynamips"
|
||||
echo "- ishare2 search bin"
|
||||
echo "- ishare2 search <name>"
|
||||
echo " - ishare2 search vios"
|
||||
echo " - ishare2 search win-"
|
||||
echo " - ishare2 search winserver"
|
||||
echo " - ishare2 search kali"
|
||||
echo " - ishare2 search mikro"
|
||||
echo " - ishare2 search forti"
|
||||
echo " - ishare2 search nxos"
|
||||
echo " - ishare2 search vmx"
|
||||
echo " - ishare2 search esxi"
|
||||
echo " - More <name> options using ishare2 search all"
|
||||
fi
|
||||
fi
|
||||
elif [[ "$1" = "pull" ]]; then # ishare2 pull
|
||||
if [[ "$2" ]]; then # check if exists an arg to ishare2 pull x
|
||||
if [[ "$2" = "qemu" ]]; then # ishare2 pull qemu
|
||||
if [[ "$3" ]]; then # check if exists an arg to ishare2 pull qemu
|
||||
pull_qemu "$3"
|
||||
function selector() {
|
||||
if [[ "$1" = "search" ]]; then # ishare2 search
|
||||
if [[ "$2" = "all" ]]; then # ishare2 search all
|
||||
ishare2 search qemu
|
||||
ishare2 search dynamips
|
||||
ishare2 search bin
|
||||
echo " "
|
||||
elif [[ "$2" = "qemu" ]]; then # ishare2 search qemu
|
||||
FILENAME=QEMU_URL.csv
|
||||
general_available_list QEMU "$FILENAME" "$QEMU_URL"
|
||||
rm "$(pwd)"/$FILENAME > /dev/null 2>&1
|
||||
elif [[ "$2" = "dynamips" ]]; then # ishare2 search dynamips
|
||||
FILENAME=DYNAMIPS_URL.csv
|
||||
general_available_list DYNAMIPS "$FILENAME" "$DYNAMIPS_URL"
|
||||
rm "$(pwd)"/$FILENAME > /dev/null 2>&1
|
||||
elif [[ "$2" = "bin" ]]; then # ishare2 search bin
|
||||
FILENAME=BIN_URL.csv
|
||||
general_available_list BIN "$FILENAME" "$BIN_URL"
|
||||
rm "$(pwd)"/$FILENAME > /dev/null 2>&1
|
||||
else # 1) ishare2 search 2) ishare2 search <number> 3) ishare2 search <string>
|
||||
if [[ $2 ]]; then
|
||||
filter_bin "$2"
|
||||
filter_dynamips "$2"
|
||||
filter_qemu "$2"
|
||||
else
|
||||
STR="Last parameter not detected"
|
||||
RED='\033[31m'
|
||||
YELLOW='\033[1;33m'
|
||||
NO_COLOR='\033[0m'
|
||||
echo -e "${RED}$STR${NO_COLOR}"
|
||||
echo -e "Syntax: ishare2 pull qemu ${YELLOW}<number>${NO_COLOR}"
|
||||
msg_available_options_for_ishare2_search
|
||||
fi
|
||||
elif [[ "$2" = "dynamips" ]]; then # ishare2 pull dynamips
|
||||
if [[ "$3" ]]; then
|
||||
pull_dynamips "$3"
|
||||
else
|
||||
STR="Last parameter not detected"
|
||||
RED='\033[31m'
|
||||
YELLOW='\033[1;33m'
|
||||
NO_COLOR='\033[0m'
|
||||
echo -e "${RED}$STR${NO_COLOR}"
|
||||
echo -e "Syntax: ishare2 pull dynamips ${YELLOW}<number>${NO_COLOR}"
|
||||
fi
|
||||
elif [[ "$2" = "bin" ]]; then # ishare2 pull bin
|
||||
if [[ "$3" ]]; then
|
||||
pull_bin "$3"
|
||||
else
|
||||
STR="Last parameter not detected"
|
||||
RED='\033[31m'
|
||||
YELLOW='\033[1;33m'
|
||||
NO_COLOR='\033[0m'
|
||||
echo -e "${RED}$STR${NO_COLOR}"
|
||||
echo -e "Syntax: ishare2 pull bin ${YELLOW}<number>${NO_COLOR}"
|
||||
fi
|
||||
else # ishare2 pull gets an incorrect argument for type (nor dynamips nor bin nor qemu)
|
||||
echo -e "Syntax:\nishare2 pull <type> <number>\n"
|
||||
echo "type: bin, qemu or dynamips"
|
||||
echo -e "number: ishare2 search <type>\n"
|
||||
echo "Example: ishare2 pull qemu 4"
|
||||
echo "Example: ishare2 pull dynamips 5"
|
||||
echo -e "Example: ishare2 pull bin 6"
|
||||
fi
|
||||
else # when there is not an arg to ishare2 pull
|
||||
echo -e "Syntax:\nishare2 pull <type> <number>\n"
|
||||
echo "type: bin, qemu or dynamips"
|
||||
echo -e "number: ishare2 search <type>\n"
|
||||
echo "Example: ishare2 pull qemu 4"
|
||||
echo "Example: ishare2 pull dynamips 5"
|
||||
echo -e "Example: ishare2 pull bin 6"
|
||||
fi
|
||||
elif [[ "$1" = "installed" ]]; then # ishare2 installed
|
||||
if [[ "$2" ]]; then
|
||||
if [[ "$2" = "all" ]]; then
|
||||
GREEN='\033[32m'
|
||||
NO_COLOR='\033[0m'
|
||||
|
||||
echo -e "${GREEN}----- QEMU -----${NO_COLOR}"
|
||||
ishare2 installed qemu
|
||||
echo -e "${GREEN}----- DYNAMIPS -----${NO_COLOR}"
|
||||
ishare2 installed dynamips
|
||||
echo -e "${GREEN}----- BIN -----${NO_COLOR}"
|
||||
ishare2 installed bin
|
||||
echo -e "${GREEN}----- DOCKER -----${NO_COLOR}"
|
||||
ishare2 installed docker
|
||||
elif [[ "$2" = "qemu" ]]; then
|
||||
echo -e
|
||||
ls -lh -R /opt/unetlab/addons/qemu/
|
||||
echo -e
|
||||
elif [[ "$2" = "dynamips" ]]; then
|
||||
echo -e
|
||||
ls -lh -R /opt/unetlab/addons/dynamips/
|
||||
echo -e
|
||||
elif [[ "$2" = "bin" ]]; then
|
||||
echo -e
|
||||
ls -lh -R /opt/unetlab/addons/iol/bin
|
||||
echo -e
|
||||
elif [[ "$2" = "docker" ]]; then
|
||||
list_dockers
|
||||
count_dockers
|
||||
else
|
||||
YELLOW='\033[1;33m'
|
||||
NO_COLOR='\033[0m'
|
||||
echo -e "Syntax:\n\nishare2 installed <type>"
|
||||
echo -e "${YELLOW}type: all, bin, qemu, dynamips or docker${NO_COLOR}"
|
||||
fi
|
||||
else
|
||||
YELLOW='\033[1;33m'
|
||||
NO_COLOR='\033[0m'
|
||||
echo -e "Syntax:\n\nishare2 installed ${YELLOW}<type>${NO_COLOR}"
|
||||
echo -e "type: all, bin, qemu, dynamips or docker"
|
||||
fi
|
||||
elif [[ "$1" = "labs" ]]; then # ishare2 labs
|
||||
if [[ "$2" ]]; then # ishare2 labs x (x could be "all" or a number)
|
||||
if [[ "$2" = "all" ]]; then # ishare2 labs all
|
||||
install_lab_images_just_for_only_readable_labs_ALL
|
||||
exit 0
|
||||
else # ishare2 labs <number>
|
||||
install_lab_images_just_for_only_readable_labs "$2"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
get_lab_list_just_for_only_readable_labs
|
||||
elif [[ $1 == "mylabs" ]]; then # ishare2 mylabs
|
||||
if [[ "$2" ]]; then
|
||||
if [[ "$3" ]]; then
|
||||
if [[ "$3" == "all" ]]; then # ishare2 mylabs <path> all
|
||||
mylabs_install_lab_images_just_for_only_readable_labs_ALL $2 all
|
||||
else
|
||||
if ! [[ -z "${3##*[!0-9]*}" ]]; then # ishare2 mylabs <path> <number>
|
||||
mylabs_install_lab_images_just_for_only_readable_labs $2 $3
|
||||
elif [[ "$1" = "pull" ]]; then # ishare2 pull
|
||||
if [[ "$2" ]]; then # check if exists an arg to ishare2 pull x
|
||||
if [[ "$2" = "qemu" ]]; then # ishare2 pull qemu
|
||||
if [[ "$3" ]]; then # check if exists an arg to ishare2 pull qemu
|
||||
pull_qemu "$3"
|
||||
else
|
||||
STR="The last parameter must be a number"
|
||||
RED='\033[31m'
|
||||
YELLOW='\033[1;33m'
|
||||
NO_COLOR='\033[0m'
|
||||
STR="Last parameter not detected"
|
||||
echo -e "${RED}$STR${NO_COLOR}"
|
||||
echo -e "ishare2 mylabs <path> ${YELLOW}<number>${NO_COLOR}"
|
||||
echo -e "Syntax: ishare2 pull qemu ${YELLOW}<number>${NO_COLOR}"
|
||||
fi
|
||||
elif [[ "$2" = "dynamips" ]]; then # ishare2 pull dynamips
|
||||
if [[ "$3" ]]; then
|
||||
pull_dynamips "$3"
|
||||
else
|
||||
STR="Last parameter not detected"
|
||||
echo -e "${RED}$STR${NO_COLOR}"
|
||||
echo -e "Syntax: ishare2 pull dynamips ${YELLOW}<number>${NO_COLOR}"
|
||||
fi
|
||||
elif [[ "$2" = "bin" ]]; then # ishare2 pull bin
|
||||
if [[ "$3" ]]; then
|
||||
pull_bin "$3"
|
||||
else
|
||||
STR="Last parameter not detected"
|
||||
echo -e "${RED}$STR${NO_COLOR}"
|
||||
echo -e "Syntax: ishare2 pull bin ${YELLOW}<number>${NO_COLOR}"
|
||||
fi
|
||||
else # ishare2 pull gets an incorrect argument for type (nor dynamips nor bin nor qemu)
|
||||
msg_incorrect_argument_or_no_arg_for_ishare2_pull
|
||||
fi
|
||||
else # ishare2 mylabs <path>
|
||||
mylabs_get_lab_list_just_for_only_readable_labs $2
|
||||
else # when there is not an arg to ishare2 pull
|
||||
msg_incorrect_argument_or_no_arg_for_ishare2_pull
|
||||
fi
|
||||
else
|
||||
echo -e "Syntax:\n\nishare2 mylabs <path>"
|
||||
echo "ishare2 mylabs <path> <number>"
|
||||
echo -e "ishare2 mylabs <path> all"
|
||||
elif [[ "$1" = "installed" ]]; then # ishare2 installed
|
||||
if [[ "$2" ]]; then
|
||||
if [[ "$2" = "all" ]]; then
|
||||
echo -e "${GREEN}----- QEMU -----${NO_COLOR}"
|
||||
ishare2 installed qemu
|
||||
echo -e "${GREEN}----- DYNAMIPS -----${NO_COLOR}"
|
||||
ishare2 installed dynamips
|
||||
echo -e "${GREEN}----- BIN -----${NO_COLOR}"
|
||||
ishare2 installed bin
|
||||
echo -e "${GREEN}----- DOCKER -----${NO_COLOR}"
|
||||
ishare2 installed docker
|
||||
elif [[ "$2" = "qemu" ]]; then
|
||||
echo -e
|
||||
ls -lh -R /opt/unetlab/addons/qemu/
|
||||
echo -e
|
||||
elif [[ "$2" = "dynamips" ]]; then
|
||||
echo -e
|
||||
ls -lh -R /opt/unetlab/addons/dynamips/
|
||||
echo -e
|
||||
elif [[ "$2" = "bin" ]]; then
|
||||
echo -e
|
||||
ls -lh -R /opt/unetlab/addons/iol/bin/
|
||||
echo -e
|
||||
elif [[ "$2" = "docker" ]]; then
|
||||
list_dockers
|
||||
count_dockers
|
||||
else
|
||||
echo -e "Syntax:\n\nishare2 installed <type>"
|
||||
echo -e "${YELLOW}type: all, bin, qemu, dynamips or docker${NO_COLOR}"
|
||||
fi
|
||||
else
|
||||
echo -e "Syntax:\n\nishare2 installed ${YELLOW}<type>${NO_COLOR}"
|
||||
echo -e "type: all, bin, qemu, dynamips or docker"
|
||||
fi
|
||||
elif [[ "$1" = "labs" ]]; then # ishare2 labs
|
||||
if [[ "$2" ]]; then # ishare2 labs x (x could be "all" or a number)
|
||||
if [[ "$2" = "all" ]]; then # ishare2 labs all
|
||||
install_lab_images_just_for_only_readable_labs_ALL
|
||||
exit 0
|
||||
else # ishare2 labs <number>
|
||||
install_lab_images_just_for_only_readable_labs "$2"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
get_lab_list_just_for_only_readable_labs
|
||||
elif [[ $1 == "mylabs" ]]; then # ishare2 mylabs
|
||||
if [[ "$2" ]]; then
|
||||
if [[ "$3" ]]; then
|
||||
if [[ "$3" == "all" ]]; then # ishare2 mylabs <path> all
|
||||
mylabs_install_lab_images_just_for_only_readable_labs_ALL $2 all
|
||||
else
|
||||
if ! [[ -z "${3##*[!0-9]*}" ]]; then # ishare2 mylabs <path> <number>
|
||||
mylabs_install_lab_images_just_for_only_readable_labs $2 $3
|
||||
else
|
||||
STR="The last parameter must be a number"
|
||||
echo -e "${RED}$STR${NO_COLOR}"
|
||||
echo -e "ishare2 mylabs <path> ${YELLOW}<number>${NO_COLOR}"
|
||||
fi
|
||||
fi
|
||||
else # ishare2 mylabs <path>
|
||||
mylabs_get_lab_list_just_for_only_readable_labs $2
|
||||
fi
|
||||
else
|
||||
echo -e "Syntax:\n\nishare2 mylabs <path>"
|
||||
echo "ishare2 mylabs <path> <number>"
|
||||
echo -e "ishare2 mylabs <path> all"
|
||||
fi
|
||||
elif [[ "$1" = "relicense" ]]; then # ishare2 relicense
|
||||
generate_a_new_license
|
||||
elif [[ "$1" = "upgrade" ]]; then # ishare2 upgrade
|
||||
menu_ishare2_upgrade
|
||||
elif [[ "$1" = "changelog" ]]; then # ishare2 changelog
|
||||
show_changelog
|
||||
elif [[ "$1" = "help" ]]; then # ishare2 help
|
||||
show_help_info
|
||||
else # when no args are passed to ishare2
|
||||
show_ishare2_usage
|
||||
fi
|
||||
elif [[ "$1" = "relicense" ]]; then # ishare2 relicense
|
||||
generate_a_new_license
|
||||
elif [[ "$1" = "upgrade" ]]; then # ishare2 upgrade
|
||||
upgrade_ishare2
|
||||
elif [[ "$1" = "changelog" ]]; then # ishare2 changelog
|
||||
show_changelog
|
||||
elif [[ "$1" = "help" ]]; then # ishare2 help
|
||||
show_help_info
|
||||
else # when no args are passed to ishare2
|
||||
show_ishare2_usage
|
||||
fi
|
||||
}
|
||||
|
||||
function main(){
|
||||
set_color_constants
|
||||
set_url_constants
|
||||
check_user_is_root
|
||||
get_initial_information
|
||||
set_yml_template_folder_location
|
||||
check_ishare2_version_file_exists
|
||||
selector $1 $2 $3
|
||||
}
|
||||
|
||||
main $@
|
||||
|
||||
41
templates/android/android.yml
Normal file
41
templates/android/android.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
# Copyright (c) 2016, Andrea Dainese
|
||||
# Copyright (c) 2018, Alain Degreffe
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the UNetLab Ltd nor the name of EVE-NG Ltd nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---
|
||||
type: qemu
|
||||
description: Android VM
|
||||
name: Tablet
|
||||
cpulimit: 1
|
||||
icon: Tablet.png
|
||||
cpu: 2
|
||||
ram: 4096
|
||||
ethernet: 1
|
||||
console: vnc
|
||||
shutdown: 1
|
||||
qemu_arch: x86_64
|
||||
qemu_version: 2.4.0
|
||||
qemu_nic: e1000
|
||||
qemu_options: -machine type=pc,accel=kvm -vga std -usbdevice tablet -boot order=cd
|
||||
...
|
||||
41
templates/winserver/winserver.yml
Normal file
41
templates/winserver/winserver.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
# Copyright (c) 2016, Andrea Dainese
|
||||
# Copyright (c) 2018, Alain Degreffe
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the UNetLab Ltd nor the name of EVE-NG Ltd nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---
|
||||
type: qemu
|
||||
name: Winserver
|
||||
description: Windows Server
|
||||
cpulimit: 1
|
||||
icon: Server.png
|
||||
cpu: 1
|
||||
ram: 4096
|
||||
ethernet: 1
|
||||
console: vnc
|
||||
shutdown: 1
|
||||
qemu_arch: x86_64
|
||||
qemu_version: 2.0.2
|
||||
qemu_options: -machine type=pc-1.0,accel=kvm -cpu qemu64,+fsgsbase -vga std -usbdevice
|
||||
tablet -boot order=dc -drive file=/opt/qemu/share/qemu/virtio-win-drivers.img,index=1,if=floppy,readonly
|
||||
...
|
||||
@@ -4,6 +4,12 @@
|
||||
# Requirement: Having PNETLab 4.2.10 installed for being able to upgrade it to 5.0.1
|
||||
# This script avoids to make this upgrade process twice
|
||||
|
||||
# CONSTANTS
|
||||
GREEN='\033[32m'
|
||||
NO_COLOR='\033[0m'
|
||||
URL_ZIP_FILE=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/upgrades/from_4.2.10_to_5.0.1/5.0.1.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]}
|
||||
@@ -18,13 +24,22 @@ if ! [[ $pnetlab_version == "4.2.10" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Upgrading to v5.0.1"
|
||||
wget -O /tmp/5.0.1.zip https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/upgrades/from_4.2.10_to_5.0.1/5.0.1.zip > /dev/null 2>&1
|
||||
cd /tmp
|
||||
rm -rf upgrade
|
||||
echo -e "${GREEN}Downloading 5.0.1.zip file...${NO_COLOR}"
|
||||
wget -O /tmp/5.0.1.zip $URL_ZIP_FILE > /dev/null 2>&1
|
||||
echo -e "${GREEN}Zip file has been downloaded successfully${NO_COLOR}"
|
||||
|
||||
cd /tmp && rm -rf upgrade
|
||||
|
||||
echo -e "${GREEN}Unzipping zip file...${NO_COLOR}"
|
||||
unzip 5.0.1.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 v5.0.1...${NO_COLOR}"
|
||||
./upgrade/upgrade
|
||||
echo -e "${GREEN}Upgrade to v5.0.1 has been done successfully${NO_COLOR}"
|
||||
|
||||
rm -rf upgrade
|
||||
rm 5.0.1.zip
|
||||
|
||||
@@ -4,8 +4,13 @@
|
||||
# Requirement: Having PNETLab 4.2.10 installed for being able to upgrade it to NEW_PNETLAB_VERSION
|
||||
# This script avoids to make this upgrade process twice
|
||||
|
||||
# CONSTANTS
|
||||
NEW_PNETLAB_VERSION=5.2.7
|
||||
GREEN='\033[32m'
|
||||
NO_COLOR='\033[0m'
|
||||
URL_ZIP_FILE=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/upgrades/from_4.2.10_to_$NEW_PNETLAB_VERSION/$NEW_PNETLAB_VERSION.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]}
|
||||
@@ -19,22 +24,27 @@ if ! [[ $pnetlab_version == "4.2.10" ]]; then
|
||||
echo "You need to have the v4.2.10 to upgrade to the v$NEW_PNETLAB_VERSION"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
GREEN='\033[32m'
|
||||
NO_COLOR='\033[0m'
|
||||
|
||||
echo -e "${GREEN}Downloading $NEW_PNETLAB_VERSION zip file...${NO_COLOR}"
|
||||
wget -q --show-progress -O /root/$NEW_PNETLAB_VERSION.zip https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/upgrades/from_4.2.10_to_$NEW_PNETLAB_VERSION/$NEW_PNETLAB_VERSION.zip
|
||||
wget -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
|
||||
|
||||
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 now${NO_COLOR}"
|
||||
|
||||
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
|
||||
|
||||
@@ -4,8 +4,13 @@
|
||||
# Requirement: Having PNETLab 5.0.1 installed for being able to upgrade it to NEW_PNETLAB_VERSION
|
||||
# This script avoids to make this upgrade process twice
|
||||
|
||||
# CONSTANTS
|
||||
NEW_PNETLAB_VERSION=5.2.7
|
||||
GREEN='\033[32m'
|
||||
NO_COLOR='\033[0m'
|
||||
URL_ZIP_FILE=https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/upgrades/from_5.0.1_to_$NEW_PNETLAB_VERSION/$NEW_PNETLAB_VERSION.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]}
|
||||
@@ -19,22 +24,27 @@ if ! [[ $pnetlab_version == "5.0.1" ]]; then
|
||||
echo "You need to have the v5.0.1 to upgrade to the v$NEW_PNETLAB_VERSION"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
GREEN='\033[32m'
|
||||
NO_COLOR='\033[0m'
|
||||
|
||||
echo -e "${GREEN}Downloading $NEW_PNETLAB_VERSION zip file...${NO_COLOR}"
|
||||
wget -q --show-progress -O /root/$NEW_PNETLAB_VERSION.zip https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/upgrades/from_5.0.1_to_$NEW_PNETLAB_VERSION/$NEW_PNETLAB_VERSION.zip
|
||||
wget -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
|
||||
|
||||
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 now${NO_COLOR}"
|
||||
|
||||
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
|
||||
|
||||
27
upgrades/from_any_to_5.2.8/README.md
Normal file
27
upgrades/from_any_to_5.2.8/README.md
Normal file
@@ -0,0 +1,27 @@
|
||||
```linux
|
||||
This script allows to upgrade PNETLab from almost any version to v5.2.8
|
||||
It cannot be used when version is 6.x
|
||||
|
||||
File 5.2.8.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.2.8 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.2.8/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.2.8/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.2.8/upgrade.sh
Normal file
50
upgrades/from_any_to_5.2.8/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.2.8
|
||||
GREEN='\033[32m'
|
||||
NO_COLOR='\033[0m'
|
||||
URL_ZIP_FILE=https://unetlab.cloud/0:/upgrades_pnetlab/from_any_to_5.2.8/5.2.8.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 -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