-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_patch_dir.sh
executable file
·149 lines (139 loc) · 3.73 KB
/
create_patch_dir.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/env bash
PACKNAME=""
PACKVER=""
if [[ ! $1 ]] || [[ ! $2 ]]; then
echo "Usage: <Name> <Version> [Epoch] [Revision]"
exit 1
else
PACKNAME="$1"
PACKVER="$2"
fi
PACKEPOC=""
PACKREV=""
if [[ $3 ]]; then
if [[ $3 != "-" ]]; then
PACKEPOC="$3"
fi
fi
if [[ $4 ]]; then
if [[ $4 != "-" ]]; then
PACKREV="$4"
fi
fi
APTVER="${PACKVER}"
if [[ ${PACKEPOC} != "" ]]; then
APTVER="${PACKEPOC}:${PACKVER}"
fi
if [[ ${PACKREV} != "" ]]; then
APTVER="${APTVER}-${PACKREV}"
fi
echo "Adding ${PACKNAME} ${APTVER}"
INDEXES=()
case "${PACKNAME}" in
"a"*)
INDEXES=("ansible" "apt" "apache" "ascii" "auto" "aws")
;;
"b"*)
INDEXES=("bash" "berkeley" "boost" "bin")
;;
"c"*)
INDEXES=("cargo" "closure" "cloud" "clutter" "cmake" "cpp")
;;
"d"*)
INDEXES=("daemon" "docker" "doc" "dvd")
;;
"e"*)
INDEXES=("emacs" "emoji" "erlang" "exif" "expat" "ext")
;;
"f"*)
INDEXES=("fabric" "fast" "ffmpeg" "find" "flac" "flow" "font" "forge" "free" "fs")
;;
"g"*)
INDEXES=("git" "glib" "gnu" "golang" "go" "gradle" "gst" "gtk")
;;
"h"*)
INDEXES=("hash" "hdf" "high" "html" "http" "hyper")
;;
"i"*)
INDEXES=("i386" "i586" "i686" "icon" "image" "imap" "inet" "intl" "io" "ip")
;;
"j"*)
INDEXES=("jpeg" "json" "js" "jvm")
;;
"k"*)
INDEXES=("kube")
;;
"l"*)
INDEXES=("latex" "launch"
"liba" "libb" "libc" "libd" "libe" "libf"
"libgcc" "libg"
"libh" "libi" "libj" "libk" "libl" "libm" "libn" "libo" "libp" "libq"
"libre" "libr"
"libs" "libt" "libu" "libv" "libw"
"libxfce" "libx"
"liby" "libz"
"license" "light" "link" "linux" "lite" "live" "local" "log" "lua" "lz")
;;
"m"*)
INDEXES=("macos" "mac" "magic" "mail" "make" "man" "map" "mariadb" "mark" "math" "md5" "mecab" "media" "mega" "micro" "midi" "mid" "mini" "min" "mix" "mk" "mongo" "mp3" "mp" "msg" "multi" "mysql")
;;
"n"*)
INDEXES=("nano" "neo" "net" "new" "node" "num")
;;
"o"*)
INDEXES=("oauth" "objc" "ocaml" "one" "open")
;;
"p"*)
INDEXES=("pack" "pam" "pass" "pdf" "perl" "pg" "php" "pi" "pkg" "png" "pod" "port" "post" "pre" "pro" "python2" "python3" "python" "py2" "py3" "py")
;;
"q"*)
INDEXES=("qt" "quick")
;;
"r"*)
INDEXES=("rbenv" "redis" "red" "regex" "reg" "re" "ruby" "rust")
;;
"s"*)
INDEXES=("scala" "schem" "sdl" "sha" "shell" "shm" "simple" "snap" "source" "space" "speed" "sql" "ssh" "ssl" "standard" "svg" "swift" "sys")
;;
"t"*)
INDEXES=("tag" "task" "tcp" "tel" "temp" "term" "text" "tex" "time" "tiny" "tmux" "tomcat" "ttf" "tty" "txt")
;;
"u"*)
INDEXES=("udp" "unix" "un" "usb" "utf" "util")
;;
"v"*)
INDEXES=("virt" "vulkan")
;;
"w"*)
INDEXES=("wasm" "watch" "way" "web" "word")
;;
"x"*)
INDEXES=("xcb" "xcode" "xml" "xorg" "xfce")
;;
"y"*)
INDEXES=("yaml" "yarn")
;;
"z"*)
INDEXES=("zsh")
;;
*)
;;
esac
FINALDIR=""
for index in "${INDEXES[@]}"; do
if [[ "${PACKNAME#"$index"}" != "${PACKNAME}" ]] || [[ "${PACKNAME}" == "${index}" ]]; then
# e.g. apt-dater 1.0 => a/apt/apt-dater/1.0
FINALDIR="${PACKNAME:0:1}/${index}/${PACKNAME}/${APTVER}"
break
elif [[ ${FINALDIR} == "" ]]; then
# e.g. somepack 1.0 => s/somepack/1.0
FINALDIR="${PACKNAME:0:1}/${PACKNAME}/${APTVER}"
fi
done
echo "Creating ${FINALDIR}"
# preconf/postconf: Progress before/after configure
# predest/postdest: Progress before/after destroot
# prepatch/postpatch: Progress before/after patch
# maintscript: Debian Maintainer Scripts (This should be in source packages I believe)
mkdir -p "${FINALDIR}/"{pre,post}{conf,dest,patch}
mkdir -p "${FINALDIR}/maintscript"