zrythm builds (meta-repo used to build installers)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
3.1 KiB

#! /bin/bash
#
# Copyright (C) 2020 Alexandros Theodotou <alex at zrythm dot org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
if [ -f ~/.env ]; then
source ~/.env
fi
set -euo pipefail
if [[ "$distro" = "osx" || "$distro" = "windows10-msys" ]]; then
ssh_opts="-o StrictHostKeyChecking=no -i $id_rsa_path"
else
ssh_opts="-o StrictHostKeyChecking=no"
fi
distros="archlinux debian10 fedora32 ubuntu1804 ubuntu1910 ubuntu2004 gnu-linux"
linguas="en de fr"
rsync_cmd="rsync --rsh=\"ssh $ssh_opts\""
ssh_cmd="ssh -q $ssh_opts"
scp_cmd="scp $ssh_opts"
remote_ip="$REMOTE_IP"
remote_home="$REMOTE_HOME"
remote_packages=$remote_home/packages
zrythm_pkg_ver=$(cd zrythm && printf '%s' "$(git describe --tags | sed 's/-/\.r/' | sed 's/v//g' | sed 's/-/\./')")
gnu_linux_zip_filename="zrythm-$zrythm_pkg_ver-installer.zip"
gnu_linux_zip_trial_filename="zrythm-trial-$zrythm_pkg_ver-installer.zip"
is_tag () {
[[ "$zrythm_pkg_ver" != *r* ]]
}
distro_to_pkg_type () {
distro=$1
case "$distro" in
"archlinux")
echo "ARCH"
;;
"debian"* | "ubuntu"* )
echo "DEBIAN"
;;
"fedora32")
echo "FEDORA32"
;;
"windows10")
echo "WINDOWS"
;;
"windows10-msys")
echo "WINDOWS_MSYS"
;;
"osx"* | "macos"*)
echo "OSX"
;;
"gnu-linux")
echo "GNU_LINUX"
;;
esac
}
get_package_filename () {
distro=$1
pkg_type=$(distro_to_pkg_type $distro)
set +u
trial=$2
set -u
printf '%s' \
$(cd zrythm-installer && make pkg$trial-filename-$pkg_type)
}
# whether the package has a separate zplugins dir
package_has_zplugins_dir () {
[ "$distro" != "windows10" ] && [ "$distro" != "osx" ]
}
# returns if the file exists in the remote home dir
remote_file_exists () {
>&2 echo "checking if remote file $1 exists..."
$ssh_cmd $remote_ip [ -f "$remote_home/$1" ] > out.log 2> err.log
}
# returns if the directory exists in the remote home dir
remote_dir_exists () {
>&2 echo "checking if remote dir $1 exists..."
$ssh_cmd $remote_ip [ -d "$remote_home/$1" ] > out.log 2> err.log
}
# whether a package exists on the server
remote_pkg_exists () {
distro=$1
set +u
trial=$2
set -u
>&2 echo "checking if remote package for $distro exists..."
if remote_file_exists packages/$distro/$(get_package_filename $distro $trial) ; then
if package_has_zplugins_dir $distro ; then
remote_dir_exists packages/$distro/zplugins/ZSaw.lv2
else
true
fi
else
false
fi
}
should_skip_packaging () {
distro=$1
! is_tag && remote_pkg_exists "$distro"
}