53 lines
1.3 KiB
Bash
53 lines
1.3 KiB
Bash
#!/bin/bash
|
|
#
|
|
echo "Started..."
|
|
#Started...
|
|
#
|
|
# special variable $# is the number of arguments
|
|
if [ $# -lt 1 ] ; then
|
|
echo 'Call ./<script> <work dir>'
|
|
exit 1
|
|
fi
|
|
#
|
|
WORK_DIR="$1"
|
|
echo "WORK_DIR: $WORK_DIR"
|
|
dloadDir=${WORK_DIR}/gtfs
|
|
echo "dloadDir: $dloadDir"
|
|
dloadFile=${dloadDir}/gtfs.zip
|
|
echo "dloadFile: $dloadFile"
|
|
#
|
|
unzipDir=${dloadDir}/unzip
|
|
echo "unzipDir: $unzipDir"
|
|
mkdir -p $unzipDir
|
|
unzip -qq -d $unzipDir $dloadFile
|
|
#
|
|
# add file feed_info.txt if not present so that gtfs-sql-importer git repo is not complaining
|
|
#
|
|
if [ $(unzip -Z -1 "$dloadFile" | grep feed_info.txt) ];
|
|
then
|
|
echo "feed_info.txt present"
|
|
else
|
|
echo "feed_info.txt NOT present"
|
|
# (): replaces the shell without creating a new process
|
|
BASEDIR=$(dirname $0)
|
|
echo "BASEDIR: ${BASEDIR}"
|
|
(sh ./${BASEDIR}/feed_info.sh $unzipDir)
|
|
zip -jr ${dloadFile}-feed_info.zip ${unzipDir}
|
|
fi
|
|
#
|
|
# add file stops_zhv.txt if not present so that gtfs-sql-importer git repo can consider
|
|
#
|
|
if [ $(unzip -Z -1 "$dloadFile" | grep stops_zhv.txt) ];
|
|
then
|
|
echo "stops_zhv.txt present"
|
|
else
|
|
echo "stops_zhv.txt NOT present"
|
|
# (): replaces the shell without creating a new process
|
|
BASEDIR=$(dirname $0)
|
|
echo "BASEDIR: ${BASEDIR}"
|
|
(sh ./${BASEDIR}/stops_zhv.sh $WORK_DIR)
|
|
zip -jr ${dloadFile}-stops_zhv.zip ${unzipDir}
|
|
fi
|
|
echo "Done."
|
|
#done.
|