-
Notifications
You must be signed in to change notification settings - Fork 15
/
insert-compat-1416
executable file
·37 lines (35 loc) · 1.16 KB
/
insert-compat-1416
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Insert a single file as a CHK on the global queue with 1416 compatibility mode.
# This will be used by the new auto-update system.
# Uses no sensitive keys, so it's a standard insert.
FILENAME=$1
if [[ ! -e "$FILENAME" ]]; then
echo "Usage: insert-compat-1416 <filename>"
fi
SHORTNAME=$(basename "$FILENAME")
PORT=9481
TEMPFILE=`mktemp /tmp/insert.temp.XXXXXXXXXX`
echo Tempfile is $TEMPFILE
echo ClientHello > $TEMPFILE
echo "Name=Toad-update-$VERSION" >> $TEMPFILE
echo ExpectedVersion=2 >> $TEMPFILE
echo End >> $TEMPFILE
echo >> $TEMPFILE
echo ClientPut >> $TEMPFILE
echo "DontCompress=true" >> $TEMPFILE
echo "CompatibilityMode=COMPAT_1416" >> $TEMPFILE
echo "URI=CHK@" >> $TEMPFILE
echo "Identifier=Insert-$SHORTNAME" >> $TEMPFILE
echo Verbosity=1023 >> $TEMPFILE
echo MaxRetries=-1 >> $TEMPFILE
echo UploadFrom=direct >> $TEMPFILE
echo DataLength=`ls -l "$FILENAME" | cut -d " " -f 5` >> $TEMPFILE
echo Persistence=forever >> $TEMPFILE
echo PriorityClass=1 >> $TEMPFILE
echo Global=true >> $TEMPFILE
echo "TargetFilename=$SHORTNAME" >> $TEMPFILE
echo End >> $TEMPFILE
cat "$FILENAME" >> $TEMPFILE
cat $TEMPFILE | nc 127.0.0.1 $PORT
rm -Rf $KEYS
rm -Rf $TEMPFILE1