Skip to content
forked from BOINC/boinc

Commit

Permalink
[linux] fix install scripts to handle upgrade cases.
Browse files Browse the repository at this point in the history
This fixes BOINC#5564.

Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
  • Loading branch information
AenBleidd committed May 21, 2024
1 parent 308bac6 commit dd0eaab
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 23 deletions.
112 changes: 103 additions & 9 deletions .github/workflows/linux-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -444,30 +446,37 @@ 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
ln -s ${CA_BUNDLE} ${BOINCDIR}/ca-bundle.crt
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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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()
Expand All @@ -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
Expand All @@ -735,6 +818,17 @@ 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: |
zypper --non-interactive --quiet ar -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
Expand Down
40 changes: 34 additions & 6 deletions packages/deb/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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
Loading

0 comments on commit dd0eaab

Please sign in to comment.