Commit 9ce32477 authored by Joanne Hugé's avatar Joanne Hugé

Update SIM card script

parent 1ae3b03d
#!/bin/bash #!/bin/bash
if [ "$#" -ne 2 ]; then #set -xv
echo "Usage: ./write-sim-card ORS_NUMBER SIM_NUMBER"; exit SOURCE="${BASH_SOURCE[0]:-$0}"
if [ -z "$1" ]; then
echo "Usage: ./write-sim-card ORS_NUMBER [SIM_NUMBER_START]";
exit;
fi fi
N_ORS=$1 while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
N_SIM=$2 TARGET="$(readlink "$SOURCE")"
sudo ./program_uicc --adm 12345678 --iccid 8986006110000000000$N_SIM --imsi 00101000000000$N_SIM --isdn 060000000$N_SIM --acc 0001 --key 00112233445566778899AABBCCDDEEFF --opc 000102030405060708090A0B0C0D0E0F --spn "RS-ORS$N_ORS-00$N_SIM" --authenticate if [[ $TARGET == /* ]]; then
echo "SOURCE '$SOURCE' is an absolute symlink to '$TARGET'"
SOURCE="$TARGET"
else
DIR="$( dirname "$SOURCE" )"
echo "SOURCE '$SOURCE' is a relative symlink to '$TARGET' (relative to '$DIR')"
SOURCE="$DIR/$TARGET" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
fi
done
export OCP_DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
adm="12345678"
if [ -z "$2" ]; then
imsioffset=1
else
imsioffset=$2
fi
let imsinum=$1*10+$imsioffset
j=y
while read j ; do
[[ $j = "q" ]] && exit
i=$(printf "%03d" $imsinum)
echo programming imsi: $i
sudo $OCP_DIR/program_uicc --adm ${adm} --iccid 89860061100000000$i --imsi 001010000000$i --isdn 0600000$i --acc 0001 --key 00112233445566778899AABBCCDDEEFF --opc 000102030405060708090A0B0C0D0E0F -spn "RS-ORS$1-0$i" --authenticate --noreadafter
let imsinum=$imsinum+1
done
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment