Skip to content

Commit

Permalink
Good enough for now...
Browse files Browse the repository at this point in the history
  • Loading branch information
b- committed Oct 7, 2023
1 parent 2ce0b5b commit ebf9f42
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 172 deletions.
3 changes: 1 addition & 2 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ ADD --chmod=0755 scripts/* /tmp/

RUN /tmp/cleanup.sh

# 1Password is disabled for now. Install it as an overlay.
RUN /tmp/1password2.sh
RUN /tmp/1password.sh
RUN /tmp/bat.sh
RUN /tmp/delta.sh
RUN /tmp/getfirefox.sh
Expand Down
109 changes: 46 additions & 63 deletions scripts/1password.sh
Original file line number Diff line number Diff line change
@@ -1,63 +1,46 @@
#!/bin/sh
#
# ripped and hacked by bri from 1password's official after-install.sh
#
set -eu
mkdir /tmp/1p
pushd /tmp/1p
curl -LO https://downloads.1password.com/linux/tar/stable/x86_64/1password-latest.tar.gz
tar -xf 1password-latest.tar.gz
cd 1password-*.x64

# Fill in policy kit file with bri # a list of (the first 10) human users of the system.
export POLICY_OWNERS
POLICY_OWNERS="unix-user:bri "
#POLICY_OWNERS="$(cut -d: -f1,3 /etc/passwd | grep -E ':[0-9]{4}$' | cut -d: -f1 | head -n 10 | sed 's/^/unix-user:/' | tr '\n' ' ')"
eval "cat <<EOF
$(cat ./com.1password.1Password.policy.tpl)
EOF" > ./com.1password.1Password.policy

# Install policy kit file for system unlock
install -Dm0644 ./com.1password.1Password.policy -t /usr/share/polkit-1/actions/

# Install examples
install -Dm0644 ./resources/custom_allowed_browsers -t /usr/share/doc/1password/examples/

# chrome-sandbox requires the setuid bit to be specifically set.
# See https://github.com/electron/electron/issues/17972
# chmod 4755 ./chrome-sandbox
#
# GROUP_NAME="onepassword"
#
# # Setup the Core App Integration helper binary with the correct permissions and group
# if [ ! "$(getent group "${GROUP_NAME}")" ]; then
# groupadd "${GROUP_NAME}"
# fi
#
# HELPER_PATH="./1Password-KeyringHelper"
# BROWSER_SUPPORT_PATH="./1Password-BrowserSupport"
#
# chgrp "${GROUP_NAME}" $HELPER_PATH
# # The binary requires setuid so it may interact with the Kernel keyring facilities
# chmod u+s $HELPER_PATH
# chmod g+s $HELPER_PATH
#
# # This gives no extra permissions to the binary. It only hardens it against environmental tampering.
# chgrp "${GROUP_NAME}" $BROWSER_SUPPORT_PATH
# chmod g+s $BROWSER_SUPPORT_PATH
#
# # Restore previous directory
# cd "$CWD"
#
# Register path symlink
ln -sf /opt/1Password/1password /usr/bin/1password
#
#if [ "$(id -u)" -ne 0 ]; then
# echo "You must be running as root to run 1Password's post-installation process"
# exit
#fi
#
#installFiles
#installAutoupdateChannel
#
#exit 0
#!/usr/bin/env sh

set -e

echo "Installing 1Password"
cd /usr/lib
wget -qO- https://downloads.1password.com/linux/tar/stable/x86_64/1password-latest.tar.gz | tar -zxv
ln -s 1Password 1password-*
cd "$(mktemp -d)"

mkdir /var/opt
rpm-ostree install https://downloads.1password.com/linux/rpm/stable/x86_64/1password-latest.rpm

# rpm -ivh ./1password-latest.rpm

# This is where the mess starts. 1Password is installed to /opt/1Password with
# No way to change it. RIP. So we kinda _hack_ it and hope nothing is hard set
# in the compiled code :(
mv /var/opt/1Password /usr/lib/1Password
cat > /usr/bin/install-1password <<EOF
#!/bin/bash
ln -s /usr/lib/1Password /opt/1Password
EOF
chmod +x /usr/bin/install-1password

# # Rewrite some hard set paths here
# grep -rl "/opt/1Password" /usr/lib/1Password | xargs sed -i 's/\/opt\/1Password/\/usr\/lib\/1Password/g'
# grep -rl "/opt/1Password" /usr/share/applications | xargs sed -i 's/\/opt\/1Password/\/usr\/lib\/1Password/g'
#
# # And redo the binary link
# rm /usr/bin/1password
# ln -s /usr/lib/1Password/1password /usr/bin/1password

# Then we install the 1password CLI binary as well

wget -q https://cache.agilebits.com/dist/1P/op2/pkg/v2.14.0/op_linux_amd64_v2.14.0.zip

unzip op_linux_amd64_v2.14.0.zip

mv op /usr/bin

groupadd onepassword-cli
chown root:onepassword-cli /usr/bin/op
chmod g+s /usr/bin/op

op --version
46 changes: 0 additions & 46 deletions scripts/1password2.sh

This file was deleted.

62 changes: 1 addition & 61 deletions scripts/getfirefox.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,69 +1,9 @@
#!/bin/bash
# get firefox
# because something is broken and `rpm-ostree install firefox` doesn't work :(

cd /usr/lib
wget -O- "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US#!/bin/bash" | tar -jxv

# unpack a huge shell script from the rpm install that launches firefox
# this enables things like xinput2 and wayland
base64 -d <<EOF | gunzip > /usr/bin/firefox
H4sIAKzWIGUAA6VZbXPaSBL+HH5FR6ayxmfxYnudxCl2FwO2uWCgAMfxbXJYSANoLSSdRjImce63
X/eMRkiAnWTPlYotTc/TPT093U+Pdl6WIh6UxrZbGht8ltvJ7cBwxsD03JC5IQdvAuHM5jCxHQZG
wIBH47+YGULo4QCDDgu5afgMetHYsU2c3rZN5nIGH1jAbc+FSrECuySqxSNa4R0svQjmxhJcL4QI
hRMdCMAeTOaHYLtoxdx3bMM1GSzscCYUxiBFuIkhvHFooKyB0j4+TRAhJQdGCLMw9E9KpcViUZx7
X2zHMYpeMC11eu2SWPDAm4QLWptl8zCwx1HILIhciwUZJLQwLYBLM1zQagNEaA00QP/ZfB+uW8OL
7tUQrmv9fq0zvIHuGdQ6N/C+1WnsA8NlICx78APG0bsBTrZpkcwqwoCxjMKJJw3gPjPtiW2CY7jT
yJgymHr3LHBtd4rTA3s6w40yXAsce26HRohe55v2F5PN7eIU2zUcqHuWWFbKK+hFKyXacu3QRskG
u2eO5yOiCIgtGCoQcGLdm88j1zZjS+pe4HuBeCgC9LxAvjYDZpAfx8tVEOEmiPn+UqwKdusFqLx9
+2Yl8Rx2zXFwdl/6o884C+7RrWItdYxnsXFesMsLJ/gut4Pvd+CKoz9P4oc8hmDAJt5D/DykqORm
YFM4opuY4YrADyKKt9hr4AfeNDDmMAm8ufBNPEAIgT/HQOahgc/CyASZKeAFygJnYeQDSg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271afBzCej5GsPiTY89xe6
qQu8BWieYyn6qcVdKoyp/UlfObXb3WtBtZAbN+galL6qReKSFcYIw1mQW218OeZoyRuo0naqS71V
QkjuvDK7meHh5Cpx4tgDM39u1v8AizDFlcoeAAA=
EOF

ln -s /usr/lib/firefox/firefox /usr/bin/firefox

# https://raw.githubusercontent.com/mozilla/sumo-kb/main/install-firefox-linux/firefox.desktop
> /usr/share/applications/firefox.desktop <<EOF
Expand Down

0 comments on commit ebf9f42

Please sign in to comment.