-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathmkdsm_rmcrlf.sh
93 lines (87 loc) · 2.41 KB
/
mkdsm_rmcrlf.sh
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
#
# Remove CRLF (replacing with LF) in all of the
# specified files (or directories)...
#
# Say hi...
${ECHO} ""
${ECHO} "Removing CRLF (replacing with just LF)..."
if [ "${DSMBUILDER}" != "good" ] ;then
${ECHO} " please run ./mkdsm.sh"
exit 1
fi
# We validated this, but on macOS, we're not getting
# the value of DOS2UNIX, soooooo... :(
export DOS2UNIX=dos2unix
if ! which dos2unix &> /dev/null; then
export DOS2UNIX=fromdos
if ! which fromdos &> /dev/null; then
export DOS2UNIX="perl -pi -e 's/\r\n|\n|\r/\n/g'"
if ! which perl &> /dev/null; then
echo " Please install 'dos2unix' or 'tofrodos'..."
exit 1
fi
fi
fi
# TWAIN_DSM
${ECHO} " ...fixing files in TWAIN_DSM"
pushd TWAIN_DSM &> /dev/null
if [ "${OSNAME}" == "ubuntu" ] ;then
${DOS2UNIX} -p Doxyfile twaindsm.spec *.txt
elif [ "${OSNAME}" == "kylin" ] ;then
${DOS2UNIX} -p Doxyfile twaindsm.spec *.txt
elif [ "${OSNAME}" == "debian" ] ;then
${DOS2UNIX} -p Doxyfile twaindsm.spec *.txt
elif [ "$OSNAME" == "neokylin" ] ;then
${DOS2UNIX} -q -k -o Doxyfile twaindsm.spec *.txt
elif [ "$OSNAME" == "suse" ] ;then
${DOS2UNIX} -q -k -o Doxyfile twaindsm.spec *.txt
elif [ "$OSNAME" == "macosx" ] ;then
${DOS2UNIX} Doxyfile twaindsm.spec *.txt
else
${ECHO} "unsupported os: ${OSNAME}"
exit 1
fi
popd &> /dev/null
# TWAIN_DSM/debian
${ECHO} " ...fixing files in TWAIN_DSM/debian"
pushd TWAIN_DSM/debian &> /dev/null
if [ "${OSNAME}" == "ubuntu" ] ;then
${DOS2UNIX} -p *
elif [ "${OSNAME}" == "kylin" ] ;then
${DOS2UNIX} -p *
elif [ "${OSNAME}" == "debian" ] ;then
${DOS2UNIX} -p *
elif [ "$OSNAME" == "neokylin" ] ;then
${DOS2UNIX} -q -k -o *
elif [ "$OSNAME" == "suse" ] ;then
${DOS2UNIX} -q -k -o *
elif [ "$OSNAME" == "macosx" ] ;then
${DOS2UNIX} *
else
${ECHO} "unsupported os: ${OSNAME}"
exit 1
fi
popd &> /dev/null
# TWAIN_DSM/src
${ECHO} " ...fixing files in TWAIN_DSM/src"
pushd TWAIN_DSM/src &> /dev/null
if [ "${OSNAME}" == "ubuntu" ] ;then
${DOS2UNIX} -p *
elif [ "${OSNAME}" == "kylin" ] ;then
${DOS2UNIX} -p *
elif [ "${OSNAME}" == "debian" ] ;then
${DOS2UNIX} -p *
elif [ "$OSNAME" == "neokylin" ] ;then
${DOS2UNIX} -q -k -o *
elif [ "$OSNAME" == "suse" ] ;then
${DOS2UNIX} -q -k -o *
elif [ "$OSNAME" == "macosx" ] ;then
${DOS2UNIX} *
else
${ECHO} "unsupported os: ${OSNAME}"
exit 1
fi
popd &> /dev/null
# Bye-bye
exit 0