ishare2-cli
ishare2-cli copied to clipboard
Relicense Functionality is calling Unversioned Python
The re-licensing feature is calling python without a 2 or 3 version at the end, so it believes Ubuntu does not have python installed. This is causing the process to fail continuously. This is bad practice when calling python on Linux since very often modules use different versions of python, so both can/are installed simultaneously in most distros.
The issue appears to be located in this function in the bash script:
# Function to generate a new iourc license
generate_iourc_license() {
BIN_PATH="/opt/unetlab/addons/iol/bin/"
PYTHON_FILE=$BIN_PATH"CiscoIOUKeygen.py"
PERL_FILE=$BIN_PATH"keepalive.pl"
# Check if python2 is installed
if ! command -v python &>/dev/null; then
echo -e "${RED}[-] Python is not installed${NO_COLOR}"
logger error "Python is not installed"
# Ask the user if they want to install python
read -p "[?] Do you want to install python? (y/n): " -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
install_package python
else
echo -e "${RED}[-] Python2 is required to generate the iourc license${NO_COLOR}"
exit 1
fi
fi
The function should be corrected to something like the following:
# Function to generate a new iourc license
generate_iourc_license() {
BIN_PATH="/opt/unetlab/addons/iol/bin/"
PYTHON_FILE=$BIN_PATH"CiscoIOUKeygen.py"
PERL_FILE=$BIN_PATH"keepalive.pl"
# Check if python2 is installed
if ! command -v python2 &>/dev/null; then
echo -e "${RED}[-] Python is not installed${NO_COLOR}"
logger error "Python is not installed"
# Ask the user if they want to install python
read -p "[?] Do you want to install python? (y/n): " -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
install_package python2
else
echo -e "${RED}[-] Python2 is required to generate the iourc license${NO_COLOR}"
exit 1
fi
fi
I attempted to get around this issue by creating the following .bashrc alias, but it was unsuccessful.
alias python=python2
I still get the following response when running the re-license functionality:
Here is proof of the alias working
Hi @Laminad thanks for the feedback, I'll change this to specify python2 instead of just python. This used to work on older versions of Ubuntu, but you can have this issue on the latest versions. I'll fix this on coming releases.