/
data-package-build.file
38 lines (32 loc) · 1.1 KB
/
data-package-build.file
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
### FILE data-package-build.file
## NOCOMPILER
%build
%install
DOWNLOAD_TOOL=$(basename $(which curl || which wget || echo "none"))
for FILE in $(cat ./sources); do
DEST_FILE=%{i}/${FILE}
DEST_DIR=$(dirname "${DEST_FILE}")
mkdir -p ${DEST_DIR}
case "${DOWNLOAD_TOOL}" in
curl)
# cURL does not download empty files, touch file before downloading
touch ${DEST_FILE}
curl --create-dirs -k -L -s -S -o "${DEST_FILE}" "%{base_url}/${FILE}"
;;
wget)
pushd ${DEST_DIR}
wget --no-check-certificate --no-verbose "%{base_url}/${FILE}"
popd
;;
none)
echo "Unsupported download tool. Could not locate curl or wget. Contact package maintainer."
exit 1
;;
esac
done
find %{i} -type d -exec chmod 0755 {} \;
find %{i} -type f -exec chmod 0644 {} \;
%post
%define base_tool %(echo "%{n}" | tr '[a-z-]' '[A-Z_]')
echo "%{base_tool}_ROOT='${CMS_INSTALL_PREFIX}/%{pkgrel}'" > ${RPM_INSTALL_PREFIX}/%{pkgrel}/etc/profile.d/init.sh
echo "set %{base_tool}_ROOT='${CMS_INSTALL_PREFIX}/%{pkgrel}'" > ${RPM_INSTALL_PREFIX}/%{pkgrel}/etc/profile.d/init.csh