Skip to content

Commit

Permalink
containers/ws: Factorize install command in install.sh
Browse files Browse the repository at this point in the history
Drop `$INSTALLER` -- we don't use this from anywhere any more.
  • Loading branch information
martinpitt committed Jun 27, 2022
1 parent 65699c4 commit 447f03b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions containers/ws/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,24 @@ package_name()

OSVER=$(. /etc/os-release && echo "$VERSION_ID")

if [ -z "$INSTALLER" ]; then
INSTALLER="dnf"
fi
dnf -y update

"$INSTALLER" -y update
"$INSTALLER" install -y util-linux-core sed
INSTALL="dnf install -y"
$INSTALL util-linux-core sed

arch=`uname -p`
rpm=$(ls /container/rpms/cockpit-ws-*$OSVER.*$arch.rpm /container/rpms/cockpit-bridge-*$OSVER.*$arch.rpm || true)

# If there are rpm files in the current directory we'll install those
if [ -n "$rpm" ]; then
$INSTALLER -y install /container/rpms/cockpit-ws-*$OSVER.*$arch.rpm /container/rpms/cockpit-bridge-*$OSVER.*$arch.rpm
$INSTALL /container/rpms/cockpit-ws-*$OSVER.*$arch.rpm /container/rpms/cockpit-bridge-*$OSVER.*$arch.rpm
else
# pull packages from https://copr.fedorainfracloud.org/coprs/g/cockpit/cockpit-preview/
echo -e '[group_cockpit-cockpit-preview]\nname=Copr repo for cockpit-preview owned by @cockpit\nbaseurl=https://copr-be.cloud.fedoraproject.org/results/@cockpit/cockpit-preview/fedora-$releasever-$basearch/\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://copr-be.cloud.fedoraproject.org/results/@cockpit/cockpit-preview/pubkey.gpg\nrepo_gpgcheck=0\nenabled=1\nenabled_metadata=1' > /etc/yum.repos.d/cockpit.repo
ws=$(package_name "cockpit-ws")
bridge=$(package_name "cockpit-bridge")
"$INSTALLER" -y install "$ws" "$bridge"
$INSTALL "$ws" "$bridge"
fi

"$INSTALLER" clean all
dnf clean all
rm -rf /container/rpms || true

0 comments on commit 447f03b

Please sign in to comment.