comparison moefetch.sh @ 152:67df02877319

added quickfetch for skipping file checking
author edhoprima
date Sat, 25 Apr 2009 15:57:29 +0000
parents 3d6b2152f4a3
children 7b07448e46f1
comparison
equal deleted inserted replaced
151:3d6b2152f4a3 152:67df02877319
94 fi 94 fi
95 echo "$totalerr file(s) removed" 95 echo "$totalerr file(s) removed"
96 echo "`echo \`ls | wc -l\`` file(s) available locally" 96 echo "`echo \`ls | wc -l\`` file(s) available locally"
97 cd .. 97 cd ..
98 else 98 else
99 echo "Empty local repository" 99 if [ $ISQUICK -eq 1 ]; then
100 echo "quick mode selected. Skipping check"
101 else
102 echo "Empty local repository"
103 fi
100 cat "$outdir-list" > "$outdir-newlist" 104 cat "$outdir-list" > "$outdir-newlist"
101 fi 105 fi
102 } 106 }
103 107
104 FETCH() 108 FETCH()
107 then 111 then
108 echo "No new file" 112 echo "No new file"
109 else 113 else
110 echo "Starting wget" 114 echo "Starting wget"
111 cd "../$outdir" 115 cd "../$outdir"
112 wget -bi "../temp/$outdir-newlist" -o "../temp/$outdir.log" 116 wget -bi -e continue=on "../temp/$outdir-newlist" -o "../temp/$outdir.log"
113 fi 117 fi
114 } 118 }
115 119
116 120
117 # path initialization 121 # path initialization
144 148
145 # all green (part 1)! let's go (until we check the tag) 149 # all green (part 1)! let's go (until we check the tag)
146 150
147 # initialization 151 # initialization
148 # are we really doing it? 152 # are we really doing it?
153 HELP="Usage: moefetch (quick)fetch|status <tags>"
154
149 if [ $# -lt 2 ]; then 155 if [ $# -lt 2 ]; then
150 echo "Usage: moefetch status|fetch|update <tags>" 156 echo "$HELP"
151 exit 1 157 exit 1
152 fi 158 fi
153 159
154 case "$1" in 160 case "$1" in
155 status|get|update) 161 status|fetch|quickfetch)
156 echo "Starting..." 162 echo "Starting..."
157 ;; 163 ;;
158 *) 164 *)
159 echo "Usage: moefetch status|fetch|update <tags>" 165 echo "$HELP"
160 exit 1 166 exit 1
161 ;; 167 ;;
162 esac 168 esac
163 169
164 # we did it indeed 170 # we did it indeed
167 # do we own the files 173 # do we own the files
168 tags=`echo "$@" | cut -d ' ' -f 2- -` 174 tags=`echo "$@" | cut -d ' ' -f 2- -`
169 echo "Tags: $tags" 175 echo "Tags: $tags"
170 # slash do not want 176 # slash do not want
171 outdir=`echo "$tags" | sed -e 's/\//_/g'` 177 outdir=`echo "$tags" | sed -e 's/\//_/g'`
178 ISNEW=0
172 if [ -O "$basedir" ]; then 179 if [ -O "$basedir" ]; then
173 if [ ! -d "$basedir/$outdir" ]; then 180 if [ ! -d "$basedir/$outdir" ]; then
174 ISNEW=1 181 ISNEW=1
175 mkdir "$basedir/$outdir" 182 mkdir "$basedir/$outdir"
176 fi 183 fi
199 touch "$outdir-list" 206 touch "$outdir-list"
200 touch "$outdir-newlist" 207 touch "$outdir-newlist"
201 # 208 #
202 209
203 # let's do the job! 210 # let's do the job!
211 ISQUICK=0
204 case "$1" in 212 case "$1" in
205 status) 213 status)
206 GENERATE 214 GENERATE
207 CHECK 215 CHECK
208 ;; 216 ;;
209 get) 217 fetch)
210 GENERATE 218 GENERATE
211 CHECK 219 CHECK
212 FETCH 220 FETCH
213 ;; 221 ;;
214 update) 222 quickfetch)
223 GENERATE
224 ISNEW=1
225 ISQUICK=1
226 CHECK
215 FETCH 227 FETCH
216 ;;
217 esac 228 esac