1c2c66affSColin Finck#/bin/sh
2*7119b13aSMark Jansen
3*7119b13aSMark Jansenif [ "$#" != "3" ]; then
4*7119b13aSMark Jansen    echo "Usage: CreateCabFile.sh path/to/cabman path/to/utf16le path/to/rapps-db"
5*7119b13aSMark Jansen    exit -1
6*7119b13aSMark Jansenfi
7*7119b13aSMark Jansen
8*7119b13aSMark JansenCABMAN_CMD="$1"
9*7119b13aSMark JansenUTF16LE_CMD="$2"
10*7119b13aSMark JansenRAPPSDB_PATH="$3"
11*7119b13aSMark Jansen
12*7119b13aSMark Jansenmkdir "$RAPPSDB_PATH/utf16"
13*7119b13aSMark Jansen
14*7119b13aSMark Jansenecho Converting txt files to utf16
15*7119b13aSMark Jansenfor filename in $RAPPSDB_PATH/*.txt; do
16*7119b13aSMark Jansen    just_filename=$(basename -- "$filename")
17*7119b13aSMark Jansen    $UTF16LE_CMD "$filename" "$RAPPSDB_PATH/utf16/$just_filename"
18c2c66affSColin Finckdone
19*7119b13aSMark Jansen
20*7119b13aSMark Jansenecho Building rappmgr.cab
21*7119b13aSMark Jansen$CABMAN_CMD -M mszip -S "$RAPPSDB_PATH/rappmgr.cab" "$RAPPSDB_PATH/utf16/*.txt"
22*7119b13aSMark Jansen
23*7119b13aSMark Jansenecho Building rappmgr2.cab
24*7119b13aSMark Jansen$CABMAN_CMD -M mszip -S "$RAPPSDB_PATH/rappmgr2.cab" "$RAPPSDB_PATH/utf16/*.txt" -F icons "$RAPPSDB_PATH/icons/*.ico"
25*7119b13aSMark Jansen
26*7119b13aSMark Jansenecho Cleaning up
27*7119b13aSMark Jansenrm -r "$RAPPSDB_PATH/utf16"
28*7119b13aSMark Jansen
29*7119b13aSMark Jansenecho Done
30