[linux] fix install scripts to handle upgrade cases.

This fixes #5564.

Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
This commit is contained in:
Vitalii Koshura 2024-05-21 11:39:48 +02:00
parent 308bac62d3
commit 2981374018
No known key found for this signature in database
GPG Key ID: CE0DB1726070A5A3
3 changed files with 169 additions and 23 deletions

View File

@ -423,7 +423,7 @@ jobs:
if [ ! -d /etc/boinc-client ] ; then
mkdir -p /etc/boinc-client
fi
if [ ! -f ${BOINCDIR}/cc_config.xml ] ; then
if [ ! -e ${BOINCDIR}/cc_config.xml ] ; then
echo \"\"\"
<!--
This is a configuration file of the BOINC client.
@ -432,9 +432,11 @@ jobs:
<cc_config>
</cc_config>
\"\"\" > ${BOINCDIR}/cc_config.xml
fi
if [ ! -e /etc/boinc-client/cc_config.xml ] ; then
ln -s ${BOINCDIR}/cc_config.xml /etc/boinc-client/cc_config.xml
fi
if [ ! -f ${BOINCDIR}/global_prefs_override.xml ] ; then
if [ ! -e ${BOINCDIR}/global_prefs_override.xml ] ; then
echo \"\"\"
<!--
This is a configuration file of the BOINC client that can be used to override global preferences
@ -444,19 +446,26 @@ jobs:
<global_preferences>
</global_preferences>
\"\"\" > ${BOINCDIR}/global_prefs_override.xml
fi
if [ ! -e /etc/boinc-client/global_prefs_override.xml ] ;
then
ln -s ${BOINCDIR}/global_prefs_override.xml /etc/boinc-client/global_prefs_override.xml
fi
if [ ! -f ${BOINCDIR}/gui_rpc_auth.cfg ] ; then
if [ ! -e ${BOINCDIR}/gui_rpc_auth.cfg ] ; then
echo \"\" > ${BOINCDIR}/gui_rpc_auth.cfg
fi
if [ ! -e /etc/boinc-client/gui_rpc_auth.cfg ] ; then
ln -s ${BOINCDIR}/gui_rpc_auth.cfg /etc/boinc-client/gui_rpc_auth.cfg
fi
if [ ! -f ${BOINCDIR}/remote_hosts.cfg ] ; then
if [ ! -e ${BOINCDIR}/remote_hosts.cfg ] ; then
echo \"\"\"
# This file contains a list of remote host names or IP addresses (one per line)
# that are allowed to connect to the BOINC client via the GUI RPC interface.
# Only the hosts listed in this file will be allowed to connect.
# Lines starting with '#' and ';' are comments and are ignored.
\"\"\" > ${BOINCDIR}/remote_hosts.cfg
fi
if [ ! -e /etc/boinc-client/remote_hosts.cfg ] ; then
ln -s ${BOINCDIR}/remote_hosts.cfg /etc/boinc-client/remote_hosts.cfg
fi
if [ ! -e ${BOINCDIR}/ca-bundle.crt ] ; then
@ -464,10 +473,10 @@ jobs:
fi
set_perm_recursive ${BOINCDIR} ${BOINCUSER} ${BOINCGROUP} u+rw,g+rw,o+r-w
set_perm ${BOINCDIR} ${BOINCUSER} ${BOINCGROUP} 0775
if [ -f ${BOINCDIR}/gui_rpc_auth.cfg ] ; then
if [ -e ${BOINCDIR}/gui_rpc_auth.cfg ] ; then
set_perm ${BOINCDIR}/gui_rpc_auth.cfg ${BOINCUSER} ${BOINCGROUP} 0660
fi
if [ -f ${BOINC_DIR}/remote_hosts.cfg ] ; then
if [ -e ${BOINC_DIR}/remote_hosts.cfg ] ; then
set_perm ${BOINCDIR}/remote_hosts.cfg ${BOINCUSER} ${BOINCGROUP} 0660
fi
if [ -d ${BOINCDIR}/projects ] ; then
@ -478,6 +487,18 @@ jobs:
set_perm ${BOINCDIR}/slots ${BOINCUSER} ${BOINCGROUP} 0775
update_nested_dirs ${BOINCDIR}/slots u+x,g+x,o+x
fi
if [ -e /etc/boinc-client/cc_config.xml ] ; then
set_perm /etc/boinc-client/cc_config.xml ${BOINCUSER} ${BOINCGROUP} 0660
fi
if [ -e /etc/boinc-client/global_prefs_override.xml ] ; then
set_perm /etc/boinc-client/global_prefs_override.xml ${BOINCUSER} ${BOINCGROUP} 0660
fi
if [ -e /etc/boinc-client/gui_rpc_auth.cfg ] ; then
set_perm /etc/boinc-client/gui_rpc_auth.cfg ${BOINCUSER} ${BOINCGROUP} 0660
fi
if [ -e /etc/boinc-client/remote_hosts.cfg ] ; then
set_perm /etc/boinc-client/remote_hosts.cfg ${BOINCUSER} ${BOINCGROUP} 0660
fi
if [ -x /bin/systemctl ] ; then
systemctl enable --now boinc-client.service
fi
@ -586,6 +607,7 @@ jobs:
strategy:
matrix:
os: [buster, bullseye, bookworm]
type: [install, upgrade, upgrade-from-alpha]
fail-fast: false
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
@ -596,7 +618,23 @@ jobs:
if: success()
run: |
apt update -qq
apt install -y python3
apt install -y python3 gnupg2
- name: Install distro package for further upgrade
if: success() && matrix.type == 'upgrade'
run: |
DEBIAN_FRONTEND=noninteractive apt install -y boinc-client boinc-manager
mv /bin/systemctl /bin/systemctl.bak
- name: Install distro package for further upgrade from the alpha
if: success() && matrix.type == 'upgrade-from-alpha'
run: |
DEBIAN_FRONTEND=noninteractive apt install -y software-properties-common
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 40254C9B29853EA6
apt-add-repository "deb https://boinc.berkeley.edu/dl/linux/alpha/${{ matrix.os }} ${{ matrix.os }} main"
apt update -qq
mv /bin/systemctl /bin/systemctl.bak
DEBIAN_FRONTEND=noninteractive apt install -y boinc-client boinc-manager
- name: Download client
if: success()
@ -631,6 +669,7 @@ jobs:
strategy:
matrix:
os: [focal, jammy, noble]
type: [install, upgrade, upgrade-from-ppa, upgrade-from-alpha]
fail-fast: false
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
@ -643,6 +682,34 @@ jobs:
apt update -qq
apt install -y python3
- name: Install distro package for further upgrade
if: success() && matrix.type == 'upgrade'
run: |
DEBIAN_FRONTEND=noninteractive apt install -y boinc-client boinc-manager
- name: Install distro package for further upgrade from the PPA
if: success() && matrix.type == 'upgrade-from-ppa'
run: |
DEBIAN_FRONTEND=noninteractive apt install -y software-properties-common
add-apt-repository -y ppa:costamagnagianfranco/boinc
apt update -qq
DEBIAN_FRONTEND=noninteractive apt install -y boinc-client boinc-manager
- name: Install distro package for further upgrade from the alpha
if: success() && matrix.type == 'upgrade-from-alpha' && matrix.os != 'noble'
run: |
DEBIAN_FRONTEND=noninteractive apt install -y software-properties-common
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 40254C9B29853EA6
apt-add-repository "deb https://boinc.berkeley.edu/dl/linux/alpha/${{ matrix.os }} ${{ matrix.os }} main"
apt update -qq
mv /bin/systemctl /bin/systemctl.bak
DEBIAN_FRONTEND=noninteractive apt install -y boinc-client boinc-manager
- name: Rename systemctl (not supported on CI)
if: success() && (matrix.type == 'upgrade' || matrix.type == 'upgrade-from-ppa')
run: |
mv /bin/systemctl /bin/systemctl.bak
- name: Download client
if: success()
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
@ -676,6 +743,7 @@ jobs:
strategy:
matrix:
os: [37, 38, 39, 40]
type: [install, upgrade, upgrade-from-alpha]
fail-fast: false
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
@ -687,6 +755,20 @@ jobs:
run: |
dnf install -y python3
- name: Install distro package for further upgrade
if: success() && matrix.type == 'upgrade'
run: |
dnf install -y boinc-client boinc-manager
- name: Install distro package for further upgrade from the alpha
if: success() && matrix.type == 'upgrade-from-alpha' && matrix.os != '40'
run: |
dnf install -y dnf-plugins-core
dnf config-manager --add-repo https://boinc.berkeley.edu/dl/linux/alpha/fc${{ matrix.os }}
dnf config-manager --set-enabled boinc.berkeley.edu_dl_linux_alpha_fc${{ matrix.os }}
rpm --import https://boinc.berkeley.edu/dl/linux/alpha/fc${{ matrix.os }}/boinc.gpg
yum install -y boinc-client boinc-manager
- name: Download client
if: success()
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
@ -702,8 +784,8 @@ jobs:
- name: Install client and manager
if: success()
run: |
yum localinstall -y $(find ./ -type f -name "boinc-client*.rpm" -printf "%p\n")
yum localinstall -y $(find ./ -type f -name "boinc-manager*.rpm" -printf "%p\n")
yum localinstall -y --allowerasing $(find ./ -type f -name "boinc-client*.rpm" -printf "%p\n")
yum localinstall -y --allowerasing $(find ./ -type f -name "boinc-manager*.rpm" -printf "%p\n")
- name: Run integration tests
if: success()
@ -719,6 +801,7 @@ jobs:
strategy:
matrix:
os: [15.4, 15.5]
type: [install, upgrade, upgrade-from-alpha]
fail-fast: false
steps:
- name: Install dependencies
@ -735,6 +818,18 @@ jobs:
run: |
echo "OS=`echo ${{ matrix.os }} | sed 's/\./_/g'`" >> $GITHUB_ENV
- name: Install distro package for further upgrade
if: success() && matrix.type == 'upgrade'
run: |
zypper install -y boinc-client boinc-manager
- name: Install distro package for further upgrade from the alpha
if: success() && matrix.type == 'upgrade-from-alpha'
run: |
rpm --import https://boinc.berkeley.edu/dl/linux/alpha/suse${{ env.OS }}/boinc.gpg
zypper --non-interactive --quiet ar -G -f https://boinc.berkeley.edu/dl/linux/alpha/suse${{ env.OS }} official-boinc-repo
zypper install -y boinc-client boinc-manager
- name: Download client
if: success()
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e

View File

@ -86,7 +86,7 @@ if [ ! -d /etc/boinc-client ] ; then
mkdir -p /etc/boinc-client
fi
if [ ! -f ${BOINCDIR}/cc_config.xml ] ; then
if [ ! -e ${BOINCDIR}/cc_config.xml ] ; then
echo """
<!--
This is a configuration file of the BOINC client.
@ -95,10 +95,13 @@ if [ ! -f ${BOINCDIR}/cc_config.xml ] ; then
<cc_config>
</cc_config>
""" > ${BOINCDIR}/cc_config.xml
fi
if [ ! -e /etc/boinc-client/cc_config.xml ] ; then
ln -s ${BOINCDIR}/cc_config.xml /etc/boinc-client/cc_config.xml
fi
if [ ! -f ${BOINCDIR}/global_prefs_override.xml ] ; then
if [ ! -e ${BOINCDIR}/global_prefs_override.xml ] ; then
echo """
<!--
This is a configuration file of the BOINC client that can be used to override global preferences
@ -108,21 +111,30 @@ if [ ! -f ${BOINCDIR}/global_prefs_override.xml ] ; then
<global_preferences>
</global_preferences>
""" > ${BOINCDIR}/global_prefs_override.xml
fi
if [ ! -e /etc/boinc-client/global_prefs_override.xml ] ; then
ln -s ${BOINCDIR}/global_prefs_override.xml /etc/boinc-client/global_prefs_override.xml
fi
if [ ! -f ${BOINCDIR}/gui_rpc_auth.cfg ] ; then
if [ ! -e ${BOINCDIR}/gui_rpc_auth.cfg ] ; then
echo "" > ${BOINCDIR}/gui_rpc_auth.cfg
fi
if [ ! -e /etc/boinc-client/gui_rpc_auth.cfg ] ; then
ln -s ${BOINCDIR}/gui_rpc_auth.cfg /etc/boinc-client/gui_rpc_auth.cfg
fi
if [ ! -f ${BOINCDIR}/remote_hosts.cfg ] ; then
if [ ! -e ${BOINCDIR}/remote_hosts.cfg ] ; then
echo """
# This file contains a list of remote host names or IP addresses (one per line)
# that are allowed to connect to the BOINC client via the GUI RPC interface.
# Only the hosts listed in this file will be allowed to connect.
# Lines starting with '#' and ';' are comments and are ignored.
""" > ${BOINCDIR}/remote_hosts.cfg
fi
if [ ! -e /etc/boinc-client/remote_hosts.cfg ] ; then
ln -s ${BOINCDIR}/remote_hosts.cfg /etc/boinc-client/remote_hosts.cfg
fi
@ -133,11 +145,11 @@ fi
set_perm_recursive ${BOINCDIR} ${BOINCUSER} ${BOINCGROUP} u+rw,g+rw,o+r-w
set_perm ${BOINCDIR} ${BOINCUSER} ${BOINCGROUP} 0775
if [ -f ${BOINCDIR}/gui_rpc_auth.cfg ] ; then
if [ -e ${BOINCDIR}/gui_rpc_auth.cfg ] ; then
set_perm ${BOINCDIR}/gui_rpc_auth.cfg ${BOINCUSER} ${BOINCGROUP} 0660
fi
if [ -f ${BOINC_DIR}/remote_hosts.cfg ] ; then
if [ -e ${BOINC_DIR}/remote_hosts.cfg ] ; then
set_perm ${BOINCDIR}/remote_hosts.cfg ${BOINCUSER} ${BOINCGROUP} 0660
fi
@ -151,6 +163,22 @@ if [ -d ${BOINCDIR}/slots ] ; then
update_nested_dirs ${BOINCDIR}/slots u+x,g+x,o+x
fi
if [ -e /etc/boinc-client/cc_config.xml ] ; then
set_perm /etc/boinc-client/cc_config.xml ${BOINCUSER} ${BOINCGROUP} 0660
fi
if [ -e /etc/boinc-client/global_prefs_override.xml ] ; then
set_perm /etc/boinc-client/global_prefs_override.xml ${BOINCUSER} ${BOINCGROUP} 0660
fi
if [ -e /etc/boinc-client/gui_rpc_auth.cfg ] ; then
set_perm /etc/boinc-client/gui_rpc_auth.cfg ${BOINCUSER} ${BOINCGROUP} 0660
fi
if [ -e /etc/boinc-client/remote_hosts.cfg ] ; then
set_perm /etc/boinc-client/remote_hosts.cfg ${BOINCUSER} ${BOINCGROUP} 0660
fi
if [ -x /bin/systemctl ] ; then
systemctl enable --now boinc-client.service
fi

View File

@ -102,17 +102,37 @@ class IntegrationTests:
ts.expect_true(os.path.exists("/usr/local/share/icons/boinc.png"), "Test 'boinc.png' file exists in '/usr/local/share/icons/'")
ts.expect_true(os.path.exists("/usr/local/share/icons/boinc.svg"), "Test 'boinc.svg' file exists in '/usr/local/share/icons/'")
ts.expect_true(os.path.exists("/var/lib/boinc/cc_config.xml"), "Test 'cc_config.xml' file exists in '/var/lib/boinc/'")
ts.expect_true(os.path.islink("/etc/boinc-client/cc_config.xml"), "Test '/etc/boinc-client/cc_config.xml' file is a symbolic link")
ts.expect_equal("/var/lib/boinc/cc_config.xml", os.readlink("/etc/boinc-client/cc_config.xml"), "Test '/etc/boinc-client/cc_config.xml' file is a symbolic link to '/var/lib/boinc/cc_config.xml'")
ts.expect_true(os.path.exists("/etc/boinc-client/cc_config.xml"), "Test 'cc_config.xml' file exists in '/etc/boinc-client/'")
if (os.path.islink("/etc/boinc-client/cc_config.xml")):
ts.expect_equal("/var/lib/boinc/cc_config.xml", os.readlink("/etc/boinc-client/cc_config.xml"), "Test '/etc/boinc-client/cc_config.xml' file is a symbolic link to '/var/lib/boinc/cc_config.xml'")
elif(os.path.islink("/var/lib/boinc/cc_config.xml")):
ts.expect_equal("/etc/boinc-client/cc_config.xml", os.readlink("/var/lib/boinc/cc_config.xml"), "Test '/var/lib/boinc/cc_config.xml' file is a symbolic link to '/etc/boinc-client/cc_config.xml'")
else:
ts.expect_true(False, "Test 'cc_config.xml' file is a symbolic link")
ts.expect_true(os.path.exists("/var/lib/boinc/global_prefs_override.xml"), "Test 'global_prefs_override.xml' file exists in '/var/lib/boinc/'")
ts.expect_true(os.path.islink("/etc/boinc-client/global_prefs_override.xml"), "Test '/etc/boinc-client/global_prefs_override.xml' file is a symbolic link")
ts.expect_equal("/var/lib/boinc/global_prefs_override.xml", os.readlink("/etc/boinc-client/global_prefs_override.xml"), "Test '/etc/boinc-client/global_prefs_override.xml' file is a symbolic link to '/var/lib/boinc/global_prefs_override.xml'")
ts.expect_true(os.path.exists("/etc/boinc-client/global_prefs_override.xml"), "Test 'global_prefs_override.xml' file exists in '/etc/boinc-client/'")
if (os.path.islink("/etc/boinc-client/global_prefs_override.xml")):
ts.expect_equal("/var/lib/boinc/global_prefs_override.xml", os.readlink("/etc/boinc-client/global_prefs_override.xml"), "Test '/etc/boinc-client/global_prefs_override.xml' file is a symbolic link to '/var/lib/boinc/global_prefs_override.xml'")
elif(os.path.islink("/var/lib/boinc/global_prefs_override.xml")):
ts.expect_equal("/etc/boinc-client/global_prefs_override.xml", os.readlink("/var/lib/boinc/global_prefs_override.xml"), "Test '/var/lib/boinc/global_prefs_override.xml' file is a symbolic link to '/etc/boinc-client/global_prefs_override.xml'")
else:
ts.expect_true(False, "Test 'global_prefs_override.xml' file is a symbolic link")
ts.expect_true(os.path.exists("/var/lib/boinc/remote_hosts.cfg"), "Test 'remote_hosts.cfg' file exists in '/var/lib/boinc/'")
ts.expect_true(os.path.islink("/etc/boinc-client/remote_hosts.cfg"), "Test '/etc/boinc-client/remote_hosts.cfg' file is a symbolic link")
ts.expect_equal("/var/lib/boinc/remote_hosts.cfg", os.readlink("/etc/boinc-client/remote_hosts.cfg"), "Test '/etc/boinc-client/remote_hosts.cfg' file is a symbolic link to '/var/lib/boinc/remote_hosts.cfg'")
ts.expect_true(os.path.exists("/etc/boinc-client/remote_hosts.cfg"), "Test 'remote_hosts.cfg' file exists in '/etc/boinc-client/'")
if (os.path.islink("/etc/boinc-client/remote_hosts.cfg")):
ts.expect_equal("/var/lib/boinc/remote_hosts.cfg", os.readlink("/etc/boinc-client/remote_hosts.cfg"), "Test '/etc/boinc-client/remote_hosts.cfg' file is a symbolic link to '/var/lib/boinc/remote_hosts.cfg'")
elif(os.path.islink("/var/lib/boinc/remote_hosts.cfg")):
ts.expect_equal("/etc/boinc-client/remote_hosts.cfg", os.readlink("/var/lib/boinc/remote_hosts.cfg"), "Test '/var/lib/boinc/remote_hosts.cfg' file is a symbolic link to '/etc/boinc-client/remote_hosts.cfg'")
else:
ts.expect_true(False, "Test 'remote_hosts.cfg' file is a symbolic link")
ts.expect_true(os.path.exists("/var/lib/boinc/gui_rpc_auth.cfg"), "Test 'gui_rpc_auth.cfg' file exists in '/var/lib/boinc/'")
ts.expect_true(os.path.islink("/etc/boinc-client/gui_rpc_auth.cfg"), "Test '/etc/boinc-client/gui_rpc_auth.cfg' file is a symbolic link")
ts.expect_equal("/var/lib/boinc/gui_rpc_auth.cfg", os.readlink("/etc/boinc-client/gui_rpc_auth.cfg"), "Test '/etc/boinc-client/gui_rpc_auth.cfg' file is a symbolic link to '/var/lib/boinc/gui_rpc_auth.cfg'")
ts.expect_true(os.path.exists("/etc/boinc-client/gui_rpc_auth.cfg"), "Test 'gui_rpc_auth.cfg' file exists in '/etc/boinc-client/'")
if (os.path.islink("/etc/boinc-client/gui_rpc_auth.cfg")):
ts.expect_equal("/var/lib/boinc/gui_rpc_auth.cfg", os.readlink("/etc/boinc-client/gui_rpc_auth.cfg"), "Test '/etc/boinc-client/gui_rpc_auth.cfg' file is a symbolic link to '/var/lib/boinc/gui_rpc_auth.cfg'")
elif(os.path.islink("/var/lib/boinc/gui_rpc_auth.cfg")):
ts.expect_equal("/etc/boinc-client/gui_rpc_auth.cfg", os.readlink("/var/lib/boinc/gui_rpc_auth.cfg"), "Test '/var/lib/boinc/gui_rpc_auth.cfg' file is a symbolic link to '/etc/boinc-client/gui_rpc_auth.cfg'")
else:
ts.expect_true(False, "Test 'gui_rpc_auth.cfg' file is a symbolic link")
ts.expect_not_equal("", self._get_ca_certificates_file_path(), "Test system 'ca-certificates.crt' file exists")
ts.expect_true(os.path.exists("/var/lib/boinc/ca-bundle.crt"), "Test 'ca-bundle.crt' file exists in '/var/lib/boinc/'")
ts.expect_true(os.path.islink("/var/lib/boinc/ca-bundle.crt"), "Test '/var/lib/boinc/ca-bundle.crt' file is a symbolic link")
@ -152,6 +172,9 @@ class IntegrationTests:
def test_files_permissions(self):
ts = testset.TestSet("Test files permissions")
ts.expect_equal("boinc:boinc", self._get_file_owner("/etc/boinc-client/cc_config.xml"), "Test '/etc/boinc-client/cc_config.xml' file owner")
ts.expect_equal("boinc:boinc", self._get_file_owner("/etc/boinc-client/global_prefs_override.xml"), "Test '/etc/boinc-client/global_prefs_override.xml' file owner")
ts.expect_equal("boinc:boinc", self._get_file_owner("/etc/boinc-client/remote_hosts.cfg"), "Test '/etc/boinc-client/remote_hosts.cfg' file owner")
ts.expect_equal("boinc:boinc", self._get_file_owner("/var/lib/boinc/cc_config.xml"), "Test '/var/lib/boinc/cc_config.xml' file owner")
ts.expect_equal("boinc:boinc", self._get_file_owner("/var/lib/boinc/global_prefs_override.xml"), "Test '/var/lib/boinc/global_prefs_override.xml' file owner")
ts.expect_equal("boinc:boinc", self._get_file_owner("/var/lib/boinc/remote_hosts.cfg"), "Test '/var/lib/boinc/remote_hosts.cfg' file owner")