15 Commits

Author SHA1 Message Date
pnetlabrepo
7126b540ff Update version 2023-01-24 16:59:30 -03:00
pnetlabrepo
82426a19e4 Update CHANGELOG.md 2023-01-23 07:00:49 -03:00
pnetlabrepo
b93c32b443 Update README.md 2023-01-23 06:59:25 -03:00
pnetlabrepo
05ea74636a Update ishare2 2023-01-23 06:51:34 -03:00
pnetlabrepo
9b6e235b74 Create README.md 2023-01-23 01:40:26 -03:00
pnetlabrepo
8f67c9087e Delete asdsa 2023-01-23 01:38:29 -03:00
pnetlabrepo
4b1515d762 Create upgrade.sh 2023-01-23 01:38:15 -03:00
pnetlabrepo
2651570efc Create asdsa 2023-01-23 01:32:29 -03:00
pnetlabrepo
d3e618759b Update CHANGELOG.md 2023-01-23 01:02:04 -03:00
pnetlabrepo
c75ee783b6 Update version 2023-01-23 00:56:12 -03:00
pnetlabrepo
d880061a22 Update ishare2 2023-01-23 00:55:59 -03:00
Alex
0fa229324a Fixed download link
Updated 5.2.8 update package link to new index's link
Added --content-disposition to wget since the new index's direct download link requires that to work
2023-01-22 21:06:31 -06:00
pnetlabrepo
3cdd326596 Update CHANGELOG.md 2023-01-22 18:09:19 -03:00
pnetlabrepo
bd7a8eaf18 Update version 2023-01-22 18:08:12 -03:00
pnetlabrepo
487446ec42 Update ishare2 2023-01-22 18:08:01 -03:00
7 changed files with 117 additions and 15 deletions

View File

@@ -1,6 +1,24 @@
# 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.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)
## [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

View File

@@ -121,8 +121,9 @@ wget -O /usr/sbin/ishare2 https://raw.githubusercontent.com/pnetlabrepo/ishare2/
- 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)
- 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)
Note: You can also upgrade PNETLab using `ishare2 upgrade`, then using the `option 2` and finally selecting an option from the displayed list

26
ishare2
View File

@@ -23,6 +23,7 @@ function set_url_constants() {
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
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
}
function check_user_is_root() {
@@ -64,13 +65,11 @@ function set_yml_template_folder_location() {
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" ]] || [[ $pnetlab_version == "5.2.8" ]]; then
get_server_platform
if [[ $pnetlab_version == "4.2.10" ]] || [[ $pnetlab_version == "5.0.1" ]]; then
YML_DIR="/opt/unetlab/html/templates/"
fi
if [[ $pnetlab_version == *6.* ]]; then
if [[ $pnetlab_version == *5.2* ]] || [[ $pnetlab_version == *5.3* ]] || [[ $pnetlab_version == *6.* ]]; then
get_server_platform
fi
}
@@ -959,6 +958,7 @@ function menu_ishare2_upgrade_pnetlab() {
"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"
"Upgrade PNETLab: from any version to 5.2.9"
)
PS3="$prompt"
@@ -988,11 +988,17 @@ function menu_ishare2_upgrade_pnetlab() {
bash upgrade.sh
break
;;
5)
wget -O upgrade.sh $URL_UPGRADE_PNETLAB_FROM_any_TO_5_2_9 > /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"
STR="Invalid option: Select a number from 1 to 6"
echo -e "${RED}$STR${NO_COLOR}"
continue
;;
@@ -1089,11 +1095,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
}
@@ -1110,7 +1116,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() {
@@ -1127,7 +1133,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
}

View File

@@ -8,7 +8,7 @@
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
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)
@@ -26,7 +26,7 @@ if [[ $pnetlab_version == *6.* ]]; then
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
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

View File

@@ -0,0 +1,27 @@
```linux
This script allows to upgrade PNETLab from almost any version to v5.2.9
It cannot be used when version is 6.x
File 5.2.9.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.9 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.9/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.9/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

View 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.9
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.9/5.2.9.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

View File

@@ -1 +1 @@
v1.5.2
v1.5.5