-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrerpm
executable file
·74 lines (63 loc) · 1.97 KB
/
rerpm
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
name=`cat debian/changelog | head -1 | grep -o ^[^\ ]*`
arch=`cat debian/control | grep ^Architecture | cut -d ' ' -f2`
if [ "${arch}" = "amd64" ]; then
arch=x86_64
elif [ "${arch}" = "all" ]; then
arch=noarch
fi
version=`cat debian/changelog | head -1 | grep -Poe "[^\(]*(?=\))"`
file=${name}-${version}.${arch}.rpm
#if [ ! -e "./${file}" ]; then
id=$(gh run list --workflow=rpm.yml -b $(git rev-parse --abbrev-ref HEAD) | cut -f7 | head -1)
repo_at_gh=`cat debian/control | grep "^Homepage" | grep -o [^/]*$`
#fi
startdir=`pwd`
cd /tmp
if [ ! -e "./${file}" ]; then
url=`gh api -H "Accept: application/vnd.github.v3+json" /repos/colin-i/${repo_at_gh}/actions/runs/${id}/artifacts | jq ".artifacts[0].archive_download_url"`
url=${url:1:-1}
curl -H "Authorization: token `cat ~/n/pat`" -L -o arh.zip ${url}
#not ok on kinetic curl --netrc-file ~/n/pat2 -L -o arh.zip ${url}
unzip arh.zip
rpm2cpio ${file} | cpio -idmv
fi
dir=${HOME}/rpmbuild/BUILDROOT/`echo ${file} | grep -Poe ".*(?=\.)"`
#sudo docker run -ti fedora
#exit
#sudo docker ps -a
#sudo docker start ${contid}
#sudo docker attach ${contid}
# yum install rpmrebuild
contid=`sudo docker ps -a -f ancestor=fedora -q`
#specific steps
#if [ -e "${startdir}/arh/re" ]; then
#${startdir}/arh/re
#if [ "$?" != 0 ]; then
#exit
#fi
#fi
#echo edor text
#echo -n rpmrebuild -s text ./${file} | xclip -selection clipboard
#sudo docker container exec -it 5a2c45e95410 bash && \
sudo docker container start ${contid} && \
sudo docker container cp ./${file} ${contid}:/ && \
\
sudo docker exec ${contid} rpmrebuild -s text ./${file} && \
\
sudo docker container cp ${contid}:/text text && \
\
if [ -e "${startdir}/arh/re" ]; then
cp text text_cmp && \
${startdir}/arh/re ${startdir} && \
cat text && \
diff text text_cmp || \
rm text_cmp
fi && \
mkdir -p ${dir} && \
mv usr ${dir}/ && \
rpmbuild -bb --target ${arch} text && \
sudo docker exec ${contid} rm -rf /text && \
sudo rm text && \
rm arh.zip && \
rm ${file}
sudo docker container stop ${contid}