<commit_before>#!/usr/bin/env bash
#
# Use the Vagrant virtual machine to convert the IBM Tivoli backup client
# software from RPM files to DEB files for installing on Ubuntu-based systems.
#

# define some constants
GITHUB_ISSUE_URL="http://www.github.com/paulrentschler"
IBM_CLIENT_DOWNLOAD_URL="http://www-01.ibm.com/support/docview.wss?uid=swg21239415"
TSM_VERSION_ID_STRING="TIVsm-API64-"
GSK_VERSION_ID_STRING="gskcrypt64-"

# define values for the DEBIAN/control files
MAINTAINER="<NAME> <<EMAIL>"
TIV_API_DESC="the API - IBM Tivoli Storage Manager API"
TIV_BA_DESC="the Backup Archive client - IBM Tivoli Storage Manager Client"
GSK_CRYPT_DESC="IBM GSKit Cryptography Runtime"
GSK_SSL_DESC="IBM GSKit SSL Runtime With Acme Toolkit"




# install the Alien package for converting RPM packages to DEB format
sudo apt-get update > /dev/null 2&>1
sudo apt-get install -y alien > /dev/null 2&>1

# determine the filename of the RPM-based tar file
cd /vagrant
for filename in *.tar; do
    if [[ ! -e "$filename" ]]; then continue; fi
    rpm_tar_file=$filename
    break
done

# error if no RPM-based tar file could be found
if [ -z ${rpm_tar_file+x} ]; then
    echo "+--------------------------------------------------------------"
    echo "| ERROR:"
    echo "| No tar file with the RPM installation files could be found!"
    echo "|"
    echo "| You can fix this by:"
    echo "|   1. destroying the virtual machine by typing:"
    echo "|        vagrant destroy"
    echo "|   2. downloading the RPM-based client install files from:"
    echo "|        $IBM_CLIENT_DOWNLOAD_URL"
    echo "|   3. putting the downloaded tar file in this directory"
    echo "|   4. starting the process again by typing:"
    echo "|        vagrant provision"
    echo "+--------------------------------------------------------------"
    exit
fi

# indicate the tar file with the RPM files being used
echo "Converting RPMs in '$rpm_tar_file' to DEB format."

# create a place to work
sudo mkdir /usr/local/src/tivoli
sudo chown vagrant:vagrant /usr/local/src/tivoli
cd /usr/local/src/tivoli

# untar the RPM files
cp /vagrant/$rpm_tar_file ./
tar -xvf $rpm_tar_file

# use Alien to unpack the RPM files<commit_msg>added a step to clean up the working directory if trying again after a failure<commit_after>#!/usr/bin/env bash
#
# Use the Vagrant virtual machine to convert the IBM Tivoli backup client
# software from RPM files to DEB files for installing on Ubuntu-based systems.
#

# define some constants
GITHUB_ISSUE_URL="http://www.github.com/paulrentschler"
IBM_CLIENT_DOWNLOAD_URL="http://www-01.ibm.com/support/docview.wss?uid=swg21239415"
TSM_VERSION_ID_STRING="TIVsm-API64-"
GSK_VERSION_ID_STRING="gskcrypt64-"

# define values for the DEBIAN/control files
MAINTAINER="<NAME> <<EMAIL>"
TIV_API_DESC="the API - IBM Tivoli Storage Manager API"
TIV_BA_DESC="the Backup Archive client - IBM Tivoli Storage Manager Client"
GSK_CRYPT_DESC="IBM GSKit Cryptography Runtime"
GSK_SSL_DESC="IBM GSKit SSL Runtime With Acme Toolkit"




# install the Alien package for converting RPM packages to DEB format
sudo apt-get update > /dev/null 2&>1
sudo apt-get install -y alien > /dev/null 2&>1

# determine the filename of the RPM-based tar file
cd /vagrant
for filename in *.tar; do
    if [[ ! -e "$filename" ]]; then continue; fi
    rpm_tar_file=$filename
    break
done

# error if no RPM-based tar file could be found
if [ -z ${rpm_tar_file+x} ]; then
    echo "+--------------------------------------------------------------"
    echo "| ERROR:"
    echo "| No tar file with the RPM installation files could be found!"
    echo "|"
    echo "| You can fix this by:"
    echo "|   1. destroying the virtual machine by typing:"
    echo "|        vagrant destroy"
    echo "|   2. downloading the RPM-based client install files from:"
    echo "|        $IBM_CLIENT_DOWNLOAD_URL"
    echo "|   3. putting the downloaded tar file in this directory"
    echo "|   4. starting the process again by typing:"
    echo "|        vagrant provision"
    echo "+--------------------------------------------------------------"
    exit
fi

# indicate the tar file with the RPM files being used
echo "Converting RPMs in '$rpm_tar_file' to DEB format."

# clean up a previous attempt before starting
if [[ -e /usr/local/src/tivoli ]]; then
    sudo rm -rf /usr/local/src/tivoli
done

# create a place to work
sudo mkdir /usr/local/src/tivoli
sudo chown vagrant:vagrant /usr/local/src/tivoli
cd /usr/local/src/tivoli

# untar the RPM files
cp /vagrant/$rpm_tar_file ./
tar -xvf $rpm_tar_file

# use Alien to unpack the RPM files
{'fraction_non_alphanumeric': 0.14195789016713697, 'fraction_numerical': 0.00955068374213154, 'mean_word_length': 2.862531433361274, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2913303', 'n_tokens_mistral': 1540, 'n_tokens_neox': 1444, 'n_words': 517}