forked from vufa/deepin-wine-qq-arch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen.sh
executable file
·88 lines (79 loc) · 1.69 KB
/
gen.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
#!/bin/sh
PACKAGE_NAME="deepin-wine-qq"
PACKAGE_SUFFIX=(".pkg.tar.xz" ".pkg.tar.zst")
GenPatch()
{
diff -ruN reg_tmp/ reg_tmp_fixed/ > reg.patch
}
Extract()
{
rm -rf reg_tmp_fixed && \
mkdir reg_tmp_fixed && \
tar xvjf reg_files.tar.bz2 -C reg_tmp_fixed
}
GenSrcInfo()
{
makepkg --printsrcinfo > .SRCINFO
}
Clean()
{
git clean -xfd
}
Tar()
{
cd reg_tmp && \
tar -cvjSf reg_files.tar.bz2 * && \
mv reg_files.tar.bz2 ../ && \
cd ../
}
Md5()
{
for i in "${PACKAGE_SUFFIX[@]}"; do
find . -type f -name "${PACKAGE_NAME}*$i" -execdir sh -c 'md5sum "$1" > "$1.md5"' _ {} \;
done
}
HelpApp()
{
echo " Extra Commands:"
echo " -p/--patch Generate patch files between reg_tmp/ and reg_tmp_fixed/"
echo " -e/--extract Extract reg files from reg_files.tar.bz2 to dir reg_tmp_fixed/"
echo " -g/--gen Generate AUR package info to .SRCINFO"
echo " -c/--clean Clean files which not track by git"
echo " -t/--tar Package reg files"
echo " -m/--md5 Generate the md5 file of each package"
echo " -h/--help Show program help info"
}
if [ -z $1 ]; then
# Default generate AUR package info
GenSrcInfo
exit 0
fi
case $1 in
"-p" | "--patch")
GenPatch
;;
"-e" | "--extract")
Extract
;;
"-g" | "--gen")
GenSrcInfo
;;
"-c" | "--clean")
Clean
;;
"-t" | "--tar")
Tar
;;
"-m" | "--md5")
Md5
;;
"-h" | "--help")
HelpApp
;;
*)
echo -e "\033[31mgen: unrecognized option '$1' \033[0m"
echo "Use -h|--help to get help"
exit 1
;;
esac
exit 0