commit | author | age
|
00a98f
|
1 |
#!/bin/bash |
C |
2 |
|
|
3 |
function newest_matching_file |
|
4 |
{ |
|
5 |
# Use ${1-} instead of $1 in case 'nounset' is set |
|
6 |
local -r glob_pattern=${1-} |
|
7 |
|
|
8 |
if (( $# != 1 )) ; then |
|
9 |
echo 'usage: newest_matching_file GLOB_PATTERN' >&2 |
|
10 |
return 1 |
|
11 |
fi |
|
12 |
|
|
13 |
# To avoid printing garbage if no files match the pattern, set |
|
14 |
# 'nullglob' if necessary |
|
15 |
local -i need_to_unset_nullglob=0 |
|
16 |
if [[ ":$BASHOPTS:" != *:nullglob:* ]] ; then |
|
17 |
shopt -s nullglob |
|
18 |
need_to_unset_nullglob=1 |
|
19 |
fi |
|
20 |
|
|
21 |
newest_file= |
|
22 |
for file in $glob_pattern ; do |
|
23 |
[[ -z $newest_file || $file -nt $newest_file ]] \ |
|
24 |
&& newest_file=$file |
|
25 |
done |
|
26 |
|
|
27 |
# To avoid unexpected behaviour elsewhere, unset nullglob if it was |
|
28 |
# set by this function |
|
29 |
(( need_to_unset_nullglob )) && shopt -u nullglob |
|
30 |
|
|
31 |
# Use printf instead of echo in case the file name begins with '-' |
|
32 |
[[ -n $newest_file ]] && printf '%s\n' "$newest_file" |
|
33 |
|
|
34 |
return 0 |
|
35 |
} |
|
36 |
|
99cd84
|
37 |
#update system |
C |
38 |
sudo pacman -Syu --noconfirm |
|
39 |
|
|
40 |
#go to build directory |
48a8a8
|
41 |
cd $(dirname "$(realpath $0)") |
99cd84
|
42 |
|
C |
43 |
#Remove old packages |
7df843
|
44 |
git rm -r x86_64/* |
C |
45 |
mkdir x86_64 |
48a8a8
|
46 |
|
7df843
|
47 |
#dependencies |
C |
48 |
cd dependencies |
01b1e0
|
49 |
for d in `find . -maxdepth 1 -not -path '*/\.*' -type d` |
00a98f
|
50 |
do |
99cd84
|
51 |
#Only do package directories |
01b1e0
|
52 |
if [ "$d" = "./x86_64" ] || [ "$d" = "." ]; then |
0969d0
|
53 |
continue |
C |
54 |
fi |
00a98f
|
55 |
cd $d |
99cd84
|
56 |
#update package to latest from AUR |
00a98f
|
57 |
git pull |
7df843
|
58 |
makepkg -si --noconfirm |
C |
59 |
latest=$(newest_matching_file '*.pkg.tar.xz') |
|
60 |
cd .. |
|
61 |
ln $d/$latest ../x86_64/$latest |
|
62 |
repo-add ../Chizi123.db.tar.xz ../x86_64/$latest |
|
63 |
done |
|
64 |
cd .. |
|
65 |
|
|
66 |
#main packages |
|
67 |
for d in `find . -maxdepth 1 -not -path '*/\.*' -type d` |
|
68 |
do |
|
69 |
#Only do package directories |
|
70 |
if [ "$d" = "./x86_64" ] || [ "$d" = "." ] || [ "$d" = "dependencies" ]; then |
|
71 |
continue |
|
72 |
fi |
|
73 |
cd $d |
|
74 |
#update package to latest from AUR |
|
75 |
git pull |
01b1e0
|
76 |
makepkg -s --noconfirm |
00a98f
|
77 |
latest=$(newest_matching_file '*.pkg.tar.xz') |
C |
78 |
cd .. |
99cd84
|
79 |
ln $d/$latest x86_64/$latest |
01b1e0
|
80 |
repo-add ./Chizi123.db.tar.xz x86_64/$latest |
00a98f
|
81 |
done |
C |
82 |
|
99cd84
|
83 |
ln Chizi123.db.tar.xz x86_64/Chizi123.db |
C |
84 |
ln Chizi123.files.tar.xz x86_64/Chizi123.files |
48a8a8
|
85 |
git add x86_64 |
C |
86 |
git commit -m "'$(date +%d/%m/%y-%H:%M)'" |
|
87 |
git push |