<commit_before>#!/bin/sh
# Helper script to install a specific version of Puppet
# Usage: puppet-installer.sh <Puppet version>

set -e

VERSION=$1
DISTRO=$(lsb_release -cs)
PACKAGE="puppetlabs-release-$DISTRO.deb"

CURRENT=$(apt-cache policy puppet | awk '/Installed:/ {print $2}' 2>/dev/null)
if test "$CURRENT" = "$VERSION"; then
    echo "Puppet version $VERSION already installed."
    exit 0
fi

echo "Removing any Puppet gem installations ..."
sudo gem uninstall -a -x puppet facter 2>/dev/null || true

echo "Installing Puppet version $VERSION ..."
wget -q "https://apt.puppetlabs.com/$PACKAGE"
sudo dpkg -i "$PACKAGE"<commit_msg>Pass version via -v or --version<commit_after>#!/bin/sh
#/ Helper script to install a specific version of Puppet
#/ Usage: puppet-installer.sh <Puppet version>

set -e

VERSION=

while test "$#" -ne 0; do
    case "$1" in
    -h|--h|--he|--hel|--help)
        grep '^#/' <"$0" | cut -c4-; exit 0 ;;
    -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
        VERSION=$2; shift 2 ;;
    --)
        shift; break ;;
    -|[!-]*)
        break ;;
    -*)
        echo >&2 "error: invalid option '$1'"; exit 1 ;;
    esac
done

# TODO: make version optional
test -n "$VERSION" || { echo >&2 "error: version required"; exit 1; }

DISTRO=$(lsb_release -cs)
PACKAGE="puppetlabs-release-$DISTRO.deb"

CURRENT=$(apt-cache policy puppet | awk '/Installed:/ {print $2}' 2>/dev/null)
if test "$CURRENT" = "$VERSION"; then
    echo "Puppet version $VERSION already installed."
    exit 0
fi

echo "Removing any Puppet gem installations ..."
sudo gem uninstall -a -x puppet facter 2>/dev/null || true

echo "Installing Puppet version $VERSION ..."
wget -q "https://apt.puppetlabs.com/$PACKAGE"
sudo dpkg -i "$PACKAGE"
{'fraction_non_alphanumeric': 0.17020057306590258, 'fraction_numerical': 0.012034383954154728, 'mean_word_length': 3.1870503597122304, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4359412', 'n_tokens_mistral': 659, 'n_tokens_neox': 613, 'n_words': 188}