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

Commit

Permalink
refactor: optfix + add vivaldi
Browse files Browse the repository at this point in the history
  • Loading branch information
scottames committed Jul 22, 2023
1 parent 1c46db2 commit 886ab57
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 16 deletions.
9 changes: 9 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,14 @@ rpm:
- yubico-piv-tool-devel
- yubikey-manager
- yubikey-manager-qt
- vivaldi-stable
# Create symlinks
# ../../usr/lib/opt/[name here]
# in /opt/[name here]
# to fix installing packages that add files to /opt while building the image
optfix:
- 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
24 changes: 13 additions & 11 deletions scripts/post/1Password.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,28 @@

set -oeux pipefail

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

sed -i 's|^Exec=/opt/1Password/1password %U|Exec=/usr/share/1Password/1password %U|' \
# FIXME
# mv /var/opt/1Password \
# /usr/lib/opt/1Password

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

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 "---"
4 changes: 4 additions & 0 deletions scripts/pre/1Password.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
set -oeux pipefail

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}")
}

# Add repo files.
get_yaml_array optpackages '.rpm.optfix[]'
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 886ab57

Please sign in to comment.