<commit_before>#!/bin/bash

set -e
URL="${1}"

if [ -z "${1}" ]; then
    echo "usage: $(basename ${0}) <url>"
    echo ""
    echo "examples:"
    echo "  - $(basename ${0}) http://test-images.fr-1.storage.online.net/scw-distrib-ubuntu-trusty.tar"
    echo "  - VOLUME_SIZE=50GB $(basename ${0}) http://test-images.fr-1.storage.online.net/scw-distrib-ubuntu-trusty.tar"
    exit 1
fi


NAME=$(basename "${URL}")
SNAPSHOT_NAME=${NAME%.*}-$(date +%Y-%m-%d_%H:%M)
IMAGE_NAME=${IMAGE_NAME:-$SNAPSHOT_NAME}
IMAGE_BOOTSCRIPT=${IMAGE_BOOTSCRIPT:stable}
SCW_COMMERCIAL_TYPE=${SCW_COMMERCIAL_TYPE:-VC1}
VOLUME_SIZE=${VOLUME_SIZE:-50GB}
SCW_TARGET_ARCH=x86_64
if [ "$SCW_COMMERCIAL_TYPE" = "C1" ]; then
    SCW_TARGET_ARCH=arm
fi
KEY=$(cat ~/.ssh/id_rsa.pub | awk '{ print $1" "$2 }' | tr ' ' '_')

echo "[+] URL of the tarball: ${URL}"
echo "[+] Target name: ${NAME}"


echo "[+] Creating new server in rescue mode with a secondary volume..."
SERVER=$(SCW_TARGET_ARCH="$SCW_TARGET_ARCH" SCW_COMMERCIAL_TYPE="$SCW_COMMERCIAL_TYPE" scw run -d --env="AUTHORIZED_KEY=${KEY} boot=none INITRD_DROPBEAR=1" --name="image-writer-${NAME}" "${VOLUME_SIZE}")
echo "[+] Server created: ${SERVER}"


echo "[+] Booting..."
scw exec -w "${SERVER}" 'uname -a'
echo "[+] Server is booted"

<commit_msg>Add optional INITRD_HTTP_PROXY<commit_after>#!/bin/bash

set -e
URL="${1}"

if [ -z "${1}" ]; then
    echo "usage: $(basename ${0}) <url>"
    echo ""
    echo "examples:"
    echo "  - $(basename ${0}) http://test-images.fr-1.storage.online.net/scw-distrib-ubuntu-trusty.tar"
    echo "  - VOLUME_SIZE=50GB $(basename ${0}) http://test-images.fr-1.storage.online.net/scw-distrib-ubuntu-trusty.tar"
    exit 1
fi


NAME=$(basename "${URL}")
SNAPSHOT_NAME=${NAME%.*}-$(date +%Y-%m-%d_%H:%M)
IMAGE_NAME=${IMAGE_NAME:-$SNAPSHOT_NAME}
IMAGE_BOOTSCRIPT=${IMAGE_BOOTSCRIPT:stable}
SCW_COMMERCIAL_TYPE=${SCW_COMMERCIAL_TYPE:-VC1}
VOLUME_SIZE=${VOLUME_SIZE:-50GB}
SCW_TARGET_ARCH=x86_64
if [ "$SCW_COMMERCIAL_TYPE" = "C1" ]; then
    SCW_TARGET_ARCH=arm
fi
KEY=$(cat ~/.ssh/id_rsa.pub | awk '{ print $1" "$2 }' | tr ' ' '_')

echo "[+] URL of the tarball: ${URL}"
echo "[+] Target name: ${NAME}"


echo "[+] Creating new server in rescue mode with a secondary volume..."
SERVER=$(SCW_TARGET_ARCH="$SCW_TARGET_ARCH" SCW_COMMERCIAL_TYPE="$SCW_COMMERCIAL_TYPE" scw run -d --env="AUTHORIZED_KEY=${KEY} boot=none INITRD_DROPBEAR=1 INITRD_HTTP_PROXY=${SCW_GATEWAY_HTTP_PROXY}" --name="image-writer-${NAME}" "${VOLUME_SIZE}")
echo "[+] Server created: ${SERVER}"


echo "[+] Booting..."
scw exec -w "${SERVER}" 'uname -a'
echo "[+] Server is booted"


{'fraction_non_alphanumeric': 0.20742441637964026, 'fraction_numerical': 0.016073478760045924, 'mean_word_length': 4.9409090909090905, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '2471829', 'n_tokens_mistral': 1096, 'n_tokens_neox': 1064, 'n_words': 197}