Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
fix: opt packages + add vivaldi
Browse files Browse the repository at this point in the history
  • Loading branch information
scottames committed Jul 23, 2023
1 parent 1c46db2 commit 2c59601
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 16 deletions.
8 changes: 8 additions & 0 deletions recipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ rpm:
# A list of .repo files that aren't in the COPR, added by scripts/pre/proprietaryrepos.sh
repo-files:
- https://raw.githubusercontent.com/scottames/ublue/live/repos/1password.repo
- https://repo.vivaldi.com/stable/vivaldi-fedora.repo
# These RPMs will be installed from your enabled repositories (Fedora's own
# repos, extra "repos" you've added, etc). The installation is automatically
# performed via rpm-ostree during the image build, and will be pre-installed
Expand Down Expand Up @@ -72,6 +73,13 @@ rpm:
- yubico-piv-tool-devel
- yubikey-manager
- yubikey-manager-qt
- vivaldi-stable
# Fixes packages that install to /opt by symlinking:
# ../../usr/lib/opt/[name here]
# in /opt/[name here]
optpackages:
- 1Password
- vivaldi
# These RPMs will be removed from the system image. This step happens during
# image build, BEFORE installing custom RPMs (from the "rpm.install" category).
remove:
Expand Down
22 changes: 11 additions & 11 deletions scripts/post/1Password.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@

set -oeux pipefail

mv /var/opt/1Password \
/usr/share/1Password
echo "-- Touching up 1Password + CLI, assuming rpm installed --"

sed -i 's|^Exec=/opt/1Password/1password %U|Exec=/usr/share/1Password/1password %U|' \
sed -i 's|^Exec=/opt/1Password/1password %U|Exec=/usr/lib/opt/1Password/1password %U|' \
/usr/share/applications/1password.desktop

rm /usr/bin/1password
ln -s /usr/share/1Password/1password /usr/bin/1password

# CLI
#https://cache.agilebits.com/dist/1P/op2/pkg/v2.19.0/op_linux_amd64_v2.19.0.zip
echo "Installing 1Password"

cd "$(mktemp -d)"
ln -s /usr/lib/opt/1Password/1password /usr/bin/1password

# Note: as of this writing the onepassword-cli group still needs to be
# manually created once after iso install, further updates will not be affected
if [ ! "$(getent group onepassword-cli)" ]; then
groupadd onepassword-cli
echo "--- Creating onepassword-cli group ---"
groupadd -g 1010 onepassword-cli
else
echo "onepassword-cli group already exists"
fi

chgrp onepassword-cli /usr/bin/op
chmod g+s /usr/bin/op

op --version

echo "---"
15 changes: 15 additions & 0 deletions scripts/post/vivaldi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -oeux pipefail

echo "-- Touching up Vivaldi, assuming rpm installed --"

rm /usr/bin/vivaldi-stable
ln -s /usr/lib/opt/vivaldi/vivaldi /usr/bin/vivaldi-stable

# Assumes Google Chrome installed via Flatpak
rm /usr/lib/opt/vivaldi/WidevineCdm
ln -s /var/lib/flatpak/app/com.google.Chrome/current/active/files/extra/WidevineCdm \
/usr/lib/opt/vivaldi/WidevineCdm

echo "---"
5 changes: 5 additions & 0 deletions scripts/pre/1Password.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

set -oeux pipefail

# Create the onepassword-cli group prior to install to ensure the GID is > 1000
if [ ! "$(getent group onepassword-cli)" ]; then
echo "-- Creating onepassword-cli group --"
groupadd -g 1010 onepassword-cli
echo "---"
else
echo "onepassword-cli group already exists"
fi
24 changes: 24 additions & 0 deletions scripts/pre/optfix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

set -oeux pipefail

RECIPE_FILE="/usr/share/ublue-os/recipe.yml"
get_yaml_array() {
mapfile -t "${1}" < <(yq -- "${2}" "${RECIPE_FILE}")
}

get_yaml_array optpackages '.rpm.optpackages[]'
if [[ ${#optpackages[@]} -gt 0 ]]; then
echo "-- Creating symlinks to fix packages that install to /opt --"
mkdir -p "/var/opt"
ln -s "/var/opt" "/opt"
for optpackage in "${optpackages[@]}"; do
optpackage="${optpackage%\"}"
optpackage="${optpackage#\"}"

mkdir -p "/usr/lib/opt/${optpackage}"
ln -s "../../usr/lib/opt/${optpackage}" "/var/opt/${optpackage}"
echo "Created symlinks for ${optpackage}"
done
echo "---"
fi
5 changes: 0 additions & 5 deletions scripts/pre/var_opt.sh

This file was deleted.

0 comments on commit 2c59601

Please sign in to comment.