Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3e618759b | ||
|
|
c75ee783b6 | ||
|
|
d880061a22 | ||
|
|
0fa229324a | ||
|
|
3cdd326596 | ||
|
|
bd7a8eaf18 | ||
|
|
487446ec42 | ||
|
|
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 |
32
CHANGELOG.md
32
CHANGELOG.md
@@ -1,5 +1,35 @@
|
||||
# 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
|
||||
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.4] - 2023-Jan-23
|
||||
|
||||
1) Modified: Changes were made in set_yml_template_folder_location() function. Now, this function support the following PNETLab versions:
|
||||
|
||||
For `/opt/unetlab/html/templates/`: 4.2.10 and 5.0.1
|
||||
|
||||
For `/opt/unetlab/html/templates/intel/` or `/opt/unetlab/html/templates/amd/`: 5.2.x, 5.3.x and 6.x
|
||||
|
||||
5.3.x is not implemented yet (Change made in case it is needed in the future)
|
||||
|
||||
## [v1.5.3] - 2023-Jan-22
|
||||
|
||||
1) Modified: --content-disposition was added in order to download images from other repo
|
||||
|
||||
## [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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -122,8 +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 selecting option 2 and finally one more option from the list
|
||||
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
|
||||
|
||||
|
||||
52
ishare2
52
ishare2
@@ -22,6 +22,7 @@ function set_url_constants() {
|
||||
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() {
|
||||
@@ -48,21 +49,27 @@ function get_initial_information() {
|
||||
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)
|
||||
pnetlab_version=${data_array[1]}
|
||||
|
||||
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 == "4.2.10" ]] || [[ $pnetlab_version == "5.0.1" ]]; then
|
||||
YML_DIR="/opt/unetlab/html/templates/"
|
||||
fi
|
||||
|
||||
if [[ $pnetlab_version == *5.2* ]] || [[ $pnetlab_version == *5.3* ]] || [[ $pnetlab_version == *6.* ]]; then
|
||||
get_server_platform
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -946,9 +953,10 @@ function upgrade_ishare2() {
|
||||
function menu_ishare2_upgrade_pnetlab() {
|
||||
prompt="Please, select an option: "
|
||||
options=(
|
||||
"Upgrade PNETLab 4.2.10 to 5.0.1"
|
||||
"Upgrade PNETLab 4.2.10 to 5.2.7"
|
||||
"Upgrade PNETLab 5.0.1 to 5.2.7"
|
||||
"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"
|
||||
@@ -972,11 +980,17 @@ function menu_ishare2_upgrade_pnetlab() {
|
||||
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 4"
|
||||
STR="Invalid option: Select a number from 1 to 5"
|
||||
echo -e "${RED}$STR${NO_COLOR}"
|
||||
continue
|
||||
;;
|
||||
@@ -1073,11 +1087,11 @@ function download_1_file_bin_or_dynamips() {
|
||||
echo -e "$SIZE $UNIT\n"
|
||||
|
||||
if [[ $TYPE = "dynamips" ]]; then
|
||||
wget -q --show-progress -O /opt/unetlab/addons/dynamips/"$NAME" "$LINK"
|
||||
wget --content-disposition -q --show-progress -O /opt/unetlab/addons/dynamips/"$NAME" "$LINK"
|
||||
fi
|
||||
|
||||
if [[ $TYPE = "bin" ]]; then
|
||||
wget -q --show-progress -O /opt/unetlab/addons/iol/bin/"$NAME" "$LINK"
|
||||
wget --content-disposition -q --show-progress -O /opt/unetlab/addons/iol/bin/"$NAME" "$LINK"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1094,7 +1108,7 @@ function download_1_file_qemu() {
|
||||
echo -e "\n\033[33mFolder requested:\033[0m $FOLDERNAME (""$SIZE"" ""$UNIT"")"
|
||||
echo -e "\nFile requested:\n $NAME - $SIZE $UNIT\n"
|
||||
|
||||
wget -q --show-progress -O "$NAME" "$LINK"
|
||||
wget --content-disposition -q --show-progress -O "$NAME" "$LINK"
|
||||
}
|
||||
|
||||
function download_multiple_files_qemu() {
|
||||
@@ -1111,7 +1125,7 @@ function download_multiple_files_qemu() {
|
||||
for (( c=1; c<=FILES_COUNTER; c++ ))
|
||||
do
|
||||
echo -e "\nFile $c/$FILES_COUNTER"
|
||||
wget -q --connect-timeout 5 --show-progress -P /opt/unetlab/addons/qemu/"$FOLDERNAME" "${myArray[c-1]}"
|
||||
wget --content-disposition -q --connect-timeout 5 --show-progress -P /opt/unetlab/addons/qemu/"$FOLDERNAME" "${myArray[c-1]}"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -1304,7 +1318,7 @@ function show_help_info() {
|
||||
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"
|
||||
|
||||
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/api/raw/?path=/UNETLAB%20I/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 --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