<commit_before>#!/usr/bin/env bash


lpwd=$(pwd)
mobile3g_conf='mobile3g.conf'


echo
echo -n "Plug in your HSPA USB Stick. When you are done, press any key..."
read ahead
echo

sleep 3

echo -n "Enter the USB Stick vendor (ZTE): "
read modem_vendor
[[ -z "$modem_vendor" ]] && modem_vendor="ZTE"

usb_id=$(lsusb | grep -i "$modem_vendor" | awk '{ print $6 }')
if [[ -z "$usb_id" ]]; then
  echo "USB Stick from vendor ${modem_vendor} not found. Check your device information and try again."
  sleep 3
  exit -1
fi

echo -n "Enter the USB interface to use. If unsure press <Enter> (0): "
read usb_iface
[[ -z "$usb_iface" ]] && usb_iface="0"

echo -n "Enter the PIN number of the USB Stick SIM card (0000): "
read sim_pin
[[ -z "$sim_pin" ]] && sim_pin="0000"

echo -n "Enter operator AP Name (ac.vodafone.es): "
read apn
if [[ -z "$apn" ]]; then
  echo "Invalid APN. AP Name is mandatory. Check your operator mobile broadband information and try again."
  sleep 3
  exit -1
fi

echo -n "Enter operator AP User (user): "
read apn_user
[[ -z "$apn_user" ]] && apn_user="user"

echo -n "Enter operator AP Password (pass): "
read apn_pass
[[ -z "$apn_pass" ]] && apn_pass="<PASSWORD>"

echo
echo "Configuring Mobile Broadband parameters..." 
echo

cat "${lpwd}/${mobile3g_conf}" \
  | sed "s/@@USB_ID@@/${usb_id}/g" \
  | sed "s/@@USB_IFACE@@/${usb_iface}/g" \
  | sed "s/@@SIM_PIN@@/${sim_pin}/g" \
  | sed "s/@@APN@@/${apn}/g" \
  | sed "s/@@APN_USER@@/${apn_user}/g" \<commit_msg>update 'mobile3g-setup.sh' file from cookbook 'mobile'<commit_after>#!/usr/bin/env bash


lpwd=$(pwd)
mobile3g_conf='mobile3g.conf'


echo
echo -n "Plug in your HSPA USB Stick. When you are done, press any key..."
read ahead
echo

sleep 3

echo -n "Enter the USB Stick vendor [ZTE]: "
read modem_vendor
[[ -z "$modem_vendor" ]] && modem_vendor="ZTE"

usb_id=$(lsusb | grep -i "$modem_vendor" | awk '{ print $6 }')
if [[ -z "$usb_id" ]]; then
  echo "USB Stick from vendor ${modem_vendor} not found. Check your device information and try again."
  sleep 3
  exit -1
fi

echo -n "Enter the USB interface to use. If unsure press <Enter> [0]: "
read usb_iface
[[ -z "$usb_iface" ]] && usb_iface="0"

echo -n "Enter the PIN number of the USB Stick SIM card [0000]: "
read sim_pin
[[ -z "$sim_pin" ]] && sim_pin="0000"

echo -n "Enter operator AP Name [ac.vodafone.es]: "
read apn
if [[ -z "$apn" ]]; then
  echo "Invalid APN. AP Name is mandatory. Check your operator mobile broadband information and try again."
  sleep 3
  exit -1
fi

echo -n "Enter operator AP User [user]: "
read apn_user
[[ -z "$apn_user" ]] && apn_user="user"

echo -n "Enter operator AP Password [pass]: "
read apn_pass
[[ -z "$apn_pass" ]] && apn_pass="<PASSWORD>"

echo
echo "Configuring Mobile Broadband parameters..." 
echo

cat "${lpwd}/${mobile3g_conf}" \
  | sed "s/@@USB_ID@@/${usb_id}/g" \
  | sed "s/@@USB_IFACE@@/${usb_iface}/g" \
  | sed "s/@@SIM_PIN@@/${sim_pin}/g" \
  | sed "s/@@APN@@/${apn}/g" \
  | sed "s/@@APN_USER@@/${apn_user}/g" \
{'fraction_non_alphanumeric': 0.17794068643785405, 'fraction_numerical': 0.01299566811062979, 'mean_word_length': 3.690625, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7659285', 'n_tokens_mistral': 1193, 'n_tokens_neox': 1155, 'n_words': 369}