forked from Ximi1970/systray-x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_linux_installers.sh
executable file
·156 lines (121 loc) · 2.92 KB
/
create_linux_installers.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
150
151
152
153
154
155
156
#!/bin/bash
VERSION=`git describe --long | sed "s/-.*//"`
OBS_BASE="https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons"
OBS_PACKAGE="systray-x"
OBS_RPM_ARCHS="openSUSE_Leap_15.1/x86_64 "
OBS_RPM_ARCHS="openSUSE_Leap_15.2/x86_64 "
OBS_RPM_ARCHS+="openSUSE_Tumbleweed/i586 "
OBS_RPM_ARCHS+="openSUSE_Tumbleweed/x86_64 "
OBS_RPM_ARCHS+="SLE_15/x86_64 "
OBS_RPM_ARCHS+="SLE_15_SP1/x86_64 "
OBS_DEB_ARCHS="xUbuntu_18.04/i386 "
OBS_DEB_ARCHS+="xUbuntu_18.04/amd64 "
OBS_DEB_ARCHS+="xUbuntu_19.04/amd64 "
OBS_DEB_ARCHS+="xUbuntu_19.10/amd64 "
mkdir -p bin
pushd bin > /dev/null 2>&1
#
# Create bash installers for RPM based distributions
#
for rpmdir in $OBS_RPM_ARCHS ; do
#
# Get base name
#
BASE_NAME=${rpmdir//'/'/$'-'}
PACKAGE_NAME=SysTray-X-$VERSION-$BASE_NAME
rm -rf $PACKAGE_NAME
mkdir -p $PACKAGE_NAME
pushd $PACKAGE_NAME > /dev/null 2>&1
#
# Get index.html
#
wget -q "$OBS_BASE/$rpmdir/"
#
# Find rpm
#
RPM_FILE=`grep ">systray.*<" index.html | sed -e "s/.*>\(systray-x.*rpm\)<.*/\1/"`
#
# Get rpm
#
wget -q "$OBS_BASE/$rpmdir/$RPM_FILE"
#
# Extract
#
rpm2cpio $RPM_FILE | cpio -i --to-stdout ./usr/bin/SysTray-X > SysTray-X 2>/dev/null
chmod 755 SysTray-X
#
# Get JSON
#
cp -f ../../app/config/linux/SysTray_X.json.template SysTray_X.json.template
#
# Cleanup
#
rm -f index.html
rm -f $RPM_FILE
tar cJf ../$PACKAGE_NAME.tar.xz .
popd > /dev/null 2>&1
#
# Create installer
#
cp -f ../dist/install.sh SysTray-X-$VERSION-$BASE_NAME-install.sh
cat $PACKAGE_NAME.tar.xz >> SysTray-X-$VERSION-$BASE_NAME-install.sh
chmod 755 SysTray-X-$VERSION-$BASE_NAME-install.sh
#
# Cleanup
#
rm -rf $PACKAGE_NAME
rm -f $PACKAGE_NAME.tar.xz
done
#
# Create bash installers for DEB based distributions
#
for debdir in $OBS_DEB_ARCHS ; do
#
# Get base name
#
BASE_NAME=${debdir//'/'/$'-'}
PACKAGE_NAME=SysTray-X-$VERSION-$BASE_NAME
rm -rf $PACKAGE_NAME
mkdir -p $PACKAGE_NAME
pushd $PACKAGE_NAME > /dev/null 2>&1
#
# Get index.html
#
wget -q "$OBS_BASE/$debdir/"
#
# Find deb
#
DEB_FILE=`grep ">systray.*\.deb<" index.html | sed -e "s/.*>\(systray-x.*deb\)<.*/\1/"`
#
# Get deb
#
wget -q "$OBS_BASE/$debdir/$DEB_FILE"
#
# Extract
#
dpkg --fsys-tarfile $DEB_FILE | tar xOf - ./usr/bin/SysTray-X > SysTray-X
chmod 755 SysTray-X
#
# Get JSON
#
cp -f ../../app/config/linux/SysTray_X.json.template SysTray_X.json.template
#
# Cleanup
#
rm -f index.html
rm -f $DEB_FILE
tar cJf ../$PACKAGE_NAME.tar.xz .
popd > /dev/null 2>&1
#
# Create installer
#
cp -f ../dist/install.sh SysTray-X-$VERSION-$BASE_NAME-install.sh
cat $PACKAGE_NAME.tar.xz >> SysTray-X-$VERSION-$BASE_NAME-install.sh
chmod 755 SysTray-X-$VERSION-$BASE_NAME-install.sh
#
# Cleanup
#
rm -rf $PACKAGE_NAME
rm -f $PACKAGE_NAME.tar.xz
done
popd > /dev/null 2>&1