This repository has been archived by the owner on Nov 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
do-combine-portable-linux.sh
executable file
·118 lines (102 loc) · 4.28 KB
/
do-combine-portable-linux.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
#!/usr/bin/env bash
set -o xtrace
version="${1}"
# Static variables
repo_dir="/srv/jellyfin"
metapackages_dir="${repo_dir}/projects/server/jellyfin-metapackages"
plugins_dir="${repo_dir}/projects/plugin/"
linux_static_arches=(
"amd64"
"amd64-musl"
"arm64"
"armhf"
)
docker_arches=(
"amd64"
"arm64"
"armhf"
)
releases_debian=( $( grep Codename /srv/repository/debian/conf/distributions | awk '{ print $NF }' ) )
releases_ubuntu=( $( grep Codename /srv/repository/ubuntu/conf/distributions | awk '{ print $NF }' ) )
# Portable Linux (multi-arch) combination function
# Static due to the requirement to do 4 architectures
do_combine_portable_linux() {
platform="linux"
case ${servertype} in
server)
partnertype="web"
filedir="/srv/repository/releases/server/${platform}"
;;
web)
partnertype="server"
filedir="/srv/repository/releases/server/${platform}"
;;
esac
filetype="tar.gz"
if [[ -n ${is_unstable} ]]; then
stability="unstable"
pkgend="-unstable"
elif [[ -n ${is_rc} ]]; then
stability="stable-rc"
pkgend=""
else
stability="stable"
pkgend=""
fi
releasedir="versions/${stability}/${servertype}"
partnerreleasedir="versions/${stability}/${partnertype}"
linkdir="${stability}/combined"
# We must work through all 4 types in linux_static_arches[@]
for arch in ${linux_static_arches[@]}; do
case ${servertype} in
server)
server_archive="$( find ${filedir}/${releasedir}/${version} -type f -name "jellyfin-${servertype}*${arch}.${filetype}" | head -1 )"
if [[ -z ${is_unstable} ]]; then
web_archive="$( find ${filedir}/${partnerreleasedir} -type f -name "*${version}*.${filetype}" -printf "%T@ %Tc %p\n" | sort -rn | head -1 | awk '{ print $NF }' )"
else
web_archive="$( find ${filedir}/${partnerreleasedir} -type f -name "*.${filetype}" -printf "%T@ %Tc %p\n" | sort -rn | head -1 | awk '{ print $NF }' )"
fi
if [[ ! -f ${web_archive} ]]; then
continue
fi
;;
web)
web_archive="$( find ${filedir}/${releasedir}/${version} -type f -name "jellyfin-${servertype}*.${filetype}" | head -1 )"
if [[ -z ${is_unstable} ]]; then
server_archive="$( find ${filedir}/${partnerreleasedir} -type f -name "*${version}*${arch}.${filetype}" -printf "%T@ %Tc %p\n" | sort -rn | head -1 | awk '{ print $NF }' )"
else
server_archive="$( find ${filedir}/${partnerreleasedir} -type f -name "*${arch}.${filetype}" -printf "%T@ %Tc %p\n" | sort -rn | head -1 | awk '{ print $NF }' )"
fi
if [[ ! -f ${server_archive} ]]; then
continue
fi
;;
esac
tempdir=$( mktemp -d )
echo "Unarchiving server archive"
tar -xzf ${server_archive} -C ${tempdir}/
echo "Correcting root directory naming"
pushd ${tempdir} 1>&2
server_dir="$( find . -maxdepth 1 -type d -name "jellyfin-server_*" | head -1 )"
mv ${server_dir} ./jellyfin_${version}
popd 1>&2
echo "Unarchiving web archive"
tar -xzf ${web_archive} -C ${tempdir}/jellyfin_${version}/
echo "Correcting web directory naming"
pushd ${tempdir}/jellyfin_${version}/ 1>&2
web_dir="$( find . -maxdepth 1 -type d -name "jellyfin-web_*" | head -1 )"
mv ${web_dir} jellyfin-web
popd 1>&2
echo "Creating combined tar archive"
pushd ${tempdir} 1>&2
chown -R root:root ./
mkdir -p ${filedir}/versions/${stability}/combined/${version}/
tar -czf ${filedir}/versions/${stability}/combined/${version}/jellyfin_${version}${pkgend}_${arch}.tar.gz ./
echo "Creating sha256sums"
sha256sum ${filedir}/versions/${stability}/combined/${version}/jellyfin_${version}${pkgend}_${arch}.tar.gz | sed 's, .*/, ,' > ${filedir}/versions/${stability}/combined/${version}/jellyfin_${version}${pkgend}_${arch}.tar.gz.sha256sum
popd 1>&2
rm -rf ${tempdir}
done
}
servertype=server
do_combine_portable_linux