File: syncfromlist.sh

package info (click to toggle)
dhewm3 1.5.1~pre%2Bgit20200905%2Bdfsg-1
  • links: PTS, VCS
  • area: contrib
  • in suites: bullseye
  • size: 21,664 kB
  • sloc: cpp: 408,868; ansic: 1,188; objc: 1,034; python: 330; sh: 94; makefile: 11
file content (42 lines) | stat: -rw-r--r-- 1,046 bytes parent folder | download | duplicates (5)
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
38
39
40
41
42
#!/bin/sh
base=/home/doom-grp/Doom/base
host=timo@idnet.ua-corp.com
srvscript=/var/local/builds/misc/packup.sh

maindir=$(pwd)
cd $(dirname $1)
source=$(pwd)/$(basename $1)
outdir=$(pwd)
cd $maindir

echo "list of files : $source"
echo "base          : $base"
echo "host          : $host"
echo "server script : $srvscript"
echo "press enter"
read

flip -u $source

(
cd $base
cat $source | while read i ; do find . -ipath "./$i" | cut -b 3- ; done | tee $outdir/matched.cased.log
)

# find the no match, not even case sensitive
diff -ui $source $outdir/matched.cased.log | grep ^- | cut -b 2- | tee $outdir/missing.log

scp $outdir/missing.log $host:/home/timo/missing.log
ssh $host $srvscript /home/timo/dl.zip /home/timo/missing.log
rm $outdir/dl.zip
scp $host:/home/timo/dl.zip $outdir
scp $host:/home/timo/cased.log $outdir/missing.cased.log
(
cd $base
unzip $outdir/dl.zip

# merge both lists into a single thing
rm $outdir/dl.zip
cat $outdir/missing.cased.log | zip $outdir/dl.zip -@
cat $outdir/matched.cased.log | zip $outdir/dl.zip -@
)