File: movelib.sh

package info (click to toggle)
basic256 1.1.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 24,460 kB
  • sloc: cpp: 10,148; yacc: 3,023; java: 1,091; lex: 1,051; sh: 117; xml: 33; makefile: 15
file content (78 lines) | stat: -rw-r--r-- 1,811 bytes parent folder | download | duplicates (2)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
# movelib.sh - move the lib files needed from the wiki folder
#
# modification history
# programmer... date.... description...
# j.m.reneau    20140806 r
#
# tested and designed for docuwiki site running 2013-12-18 "Blinky"
# will need to change DEF_DEPTH to 1 and test with future versions (2 is default)
# 

DOWNLOAD="wiki"
PREFIX="help"
 
echo
echo "moving image files and renaming"
mkdir ${PREFIX}/lib
mkdir ${PREFIX}/lib/exe

for i in ${DOWNLOAD}/lib/exe/fetch.php*;
do
   newi="`echo $i | sed "s/fetch\.php.*media=//g" | sed "s/%3A/_/g" | sed "s/^${DOWNLOAD}/${PREFIX}/"`"
    cmp $i $newi > /dev/null
    if [ $? -eq 0 ]; then
        echo "unchanged $i"
	     rm "$i"
    else
        echo "updated move $i to $newi"
        rm -f "$newi"
        mv "$i" "$newi";
    fi
done

echo
echo "renaming css files to get rid of php crap"
for i in ${DOWNLOAD}/lib/exe/css.php*;
do
   newi="`echo $i | sed "s/css\.php.*tseed=/css/g" | sed "s/^${DOWNLOAD}/${PREFIX}/"`"
    cmp $i $newi > /dev/null
    if [ $? -eq 0 ]; then
        echo "unchanged $i"
	     rm "$i"
    else
        echo "updated move $i to $newi"
        rm -f "$newi"
        mv "$i" "$newi";
    fi
done

exit

echo
echo "now remove all unreferenced html files"
for i in ${PREFIX}/*.html
do
    name=`echo $i | sed -e "s/${PREFIX}\///"`
    if ! grep -q "$name" ./${PREFIX}/*; then
        echo "$i is not referenced - deleted"
        rm -rf $i
    fi
done


echo
echo "now remove all downloaded but unused lib files (not .svn stuff)"
for i in `find ${PREFIX}/lib`
do
    echo "$i" | grep "\.svn" > /dev/null
    if [ $? -eq 1 ]; then
        name=`echo $i | sed -e "s/${PREFIX}\///"`
        if ! grep -q "$name" ./${PREFIX}/*; then
            echo "$i is not referenced - deleted"
            rm -rf $i
        fi
    fi
done