Saving ownKeepass

I haven’t read the forums in a while and got pointed to this thread.

I just managed to compile ownKeepass for aarch64: https://openrepos.net/content/aerique/ownkeepass-aarch64

It’s pretty much in a “works for me” stage and I’m not much of a project maintainer so I will post my build steps this weekend here so someone else can hopefully pick it up.

Use at your own risk since I have not published my steps yet. I’m also using crypto libraries I just grabbed off the net (although I think they’re the same as used by the original ownKeepass).

Like others said both ownKeepass and SailOTP are critical apps for me and with the upcoming Alien Dalvik the Xperia 10 II will be daily driver material for me.

(Final word: I have been surprised how easy it is to clone the repo of an old Sailfish OS app and recompile it for aarch64 (especially if they have no third-party dependencies.)

5 Likes

Thank you all for your efforts!

Side question: does it make sense to also publish a newer build for the other archs? I understand it is built against some parts of KeePass, which might have important changes also for non-aarch64 as well.

I don’t think so because the Git submodule it uses is pinned at the 2.4.3 version: https://github.com/keepassxreboot/keepassxc/commit/5d6ef0c47191f1bd9e8ae296920357aeb74e8fd5

okay but while “we” re at it that could be updated as well.

Thanks @aerique !

@nephros, I don’t think it’s just updating the keepass dependency as it requires testing to make sure upping the version isn’t breaking anything.

But I’m quite ready to help in testing. And as soon as @aerique publishes his build step, it’ll try tweaking things and playing around with keepassxc and see what can be done.

Here is what I did to build ownKeepass for aarch64.

I think the biggest problem people that want to repeat these steps will face is that I’m using my own build environment (Sailfish OS Builds in Docker). I will not go into the reasons why here, but I suggest first trying to repeat these steps in the same environment and then porting it to what most people use (which is the official Sailfish OS SDK I think).

ownKeepass depends on libargon2 and libsodium. In this example we’ll use the RPMs I already uploaded to my repository, but if you’re interested in building them yourself you can check out how I did it (thanks to @abranson for some clarifications!):

Preparing Sailfish OS Builds in Docker

  • mkdir ~/software (if it does not exist yet)
  • cd ~/software
  • git clone https://git.sr.ht/~aerique/sfosbid sfosbid-git
  • cd sfosbid-git
  • ./download.sh
  • ./build.sh -u
  • ./run.sh -u

Preparing the Build Environment

This section assumes you’ve run ./run.sh -u from the previous section and are
now in the Docker container.

  • sb2 -t SailfishOS-latest-aarch64 -m sdk-install -R
  • rpm --import https://sailfish.openrepos.net/openrepos.key
  • zypper addrepo -f https://sailfish.openrepos.net/aerique/personal-main.repo
  • zypper install libargon2-devel libsodium-devel libgcrypt-devel
  • exit
    • this exits the sb2 sdk-install environment from above, it does not exit the Docker container

Building ownKeepass

(This is still in the Docker container.)

We will not use the official repository but @samule’s slightly updated one that has already improved the libgcrypt situation for us:

  • cd projects
  • git clone https://github.com/24mu13/ownkeepass.git ownkeepass-git
  • cd ownkeepass-git
  • git submodule update --init --recursive
  • cd Sailfish
  • in ownKeepass.pro change ARCH_LIBS from armv7hl to aarch64
  • in rpm/harbour-ownkeepass.yaml remove - libargon2 in the PkgCongfigBR list
  • mb2 -t SailfishOS-latest-aarch64 build

If the build was successfull you’ll have an ownKeepass RPM in the RPMS
directory.

7 Likes

Thanks @aerique for the detailed instruction :smiley:

I only use Sailfish IDE and it’s build engine, I’ll see if I can replicate your instructions and compile a working RPM without using Docker and a specific build environment.

I have not tested anything, but looking at the commands I believe you could just replace sb2 -t SailfishOS-latest-aarch64 -m sdk-install -R with sfdk tools exec SailfishOS-4.1.0.23EA-aarch64 and mb2 -t SailfishOS-latest-aarch64 build with sfdk build. Please note however that this installs the build dependencies directly in the target. I’d prefer having them in shared output directory and installing them automatically in a target snapshot. So this might work better:

  • Download the dependencies and place them in /home/foobar/keepass-rpms
  • sfdk config target=SailfishOS-4.1.0.23EA-aarch64
  • sfdk config snapshot
  • sfdk config output-dir=/home/foobar/keepass-rpms
  • sfdk build
2 Likes

Very nice work @aerique, and everyone, thank you.

Myself I use coderus work from Docker Hub to build in docker.

I write Gitlab CI scripts to do that, because they can then be used both on a local machine using gitlab-runner, or using the CI feature on gitlab.

Anyway I have taken the recipe above and put it in a gitlab-ci file. Posting below in case anyone is interested in building that way.
Not too much interesting or new in there, but it stores the output rpms in a dir in docker, and creates a local repo for zypper to install from instead of using online repos.

stages:
  - build

image: "coderus/sailfishos-platform-sdk-${TARGET}:${SFOS_VERSION}"
tags:
  - docker

default:

variables:
  #SFOS_VERSION: "4.0.1.45"
  SFOS_VERSION: "4.1.0.23"
  GIT_SUBMODULE_STRATEGY: recursive
  OUTDIR: $CI_PROJECT_DIR/output
  #BLDDIR: ~/build # this does not work because ~ does not expand. use a shell variable instead
  YAMLNAME: ownkeepass.yaml
  SPECNAME: ownkeepass.spec
  TARGET: armv7hl # set this globally for local builds because gitlab-ci-runner can not deal with extends: foo

.build-local:
  stage: build
  script:
    # prep
    - BLDDIR=~/build
    - mkdir -p $OUTDIR/$SFOS_VERSION/
    - mkdir -p ${BLDDIR}
    - cp -r $CI_PROJECT_DIR/* $BLDDIR/
    - pushd $BLDDIR
    # argon
    - git clone https://git.sr.ht/~aerique/libargon2-spec libargon2-spec-git
    - pushd libargon2-spec-git
    - git submodule update --init --recursive
    - mb2 -t SailfishOS-$SFOS_VERSION-$TARGET --no-fix-version prepare | tee $OUTDIR/prepare.log
    - mb2 -t SailfishOS-$SFOS_VERSION-$TARGET --no-fix-version build   | tee $OUTDIR/build.log
    - cp -r RPMS/* $OUTDIR/$SFOS_VERSION/
    - popd
    # sodium
    - git clone https://git.sr.ht/~aerique/libsodium-spec libsodium-spec-git
    - pushd libsodium-spec-git
    - curl -o libsodium-1.0.18-stable.tar.gz https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable.tar.gz
    - tar xvfz libsodium-1.0.18-stable.tar.gz
    - mb2 -t SailfishOS-$SFOS_VERSION-$TARGET --no-fix-version prepare | tee $OUTDIR/prepare.log
    - mb2 -t SailfishOS-$SFOS_VERSION-$TARGET --no-fix-version build   | tee $OUTDIR/build.log
    - cp -r RPMS/* $OUTDIR/$SFOS_VERSION/
    - popd
    # main
    - LR=~/myrepo
    - mkdir -p $LR
    - for f in $(find $OUTDIR/$SFOS_VERSION -type f -name *.rpm); do cp ${f} $LR; done
    - sb2 -t SailfishOS-$SFOS_VERSION-$TARGET -m sdk-install -R zypper ar --no-gpgcheck $LR localfiles
    - sb2 -t SailfishOS-$SFOS_VERSION-$TARGET -m sdk-install -R zypper ref
    - sb2 -t SailfishOS-$SFOS_VERSION-$TARGET -m sdk-install -R zypper --non-interactive install libgcrypt-devel
    - sb2 -t SailfishOS-$SFOS_VERSION-$TARGET -m sdk-install -R zypper --non-interactive install --from localfiles libargon2-devel libsodium-devel
    - git clone https://github.com/24mu13/ownkeepass.git ownkeepass
    - pushd ownkeepass
    - git submodule update --init --recursive
    - cd Sailfish
    - sed -i -e '/.*libargon2.*/d' rpm/harbour-ownkeepass.yaml
    - sed -i -e '/.*libargon2.*/d' rpm/harbour-ownkeepass.spec
    - mb2 -t SailfishOS-$SFOS_VERSION-$TARGET --no-fix-version prepare | tee $OUTDIR/prepare.log
    - mb2 -t SailfishOS-$SFOS_VERSION-$TARGET --no-fix-version build   | tee $OUTDIR/build.log
    - cp -r RPMS/* $OUTDIR/$SFOS_VERSION/
    - rm -r $BLDDIR/
  artifacts:
      when: always
      paths:
        - "output/*.log"
        - "output/*.spec"
        - "output/*.yaml"
        - "output/$SFOS_VERSION"
  cache:
    key: ${CI_PROJECT_NAME}_${CI_JOB_NAME}
    paths:
      - $SRCNAME-$SRCTAG
      - /home/.zypp-cache
      - /srv/mer/targets/SailfishOS-$SFOS_VERSION-$TARGET/var/cache/zypp/
      - /var/cache/zypp/
      - /home/nemo/src

build-arm64:
  stage: build
  extends: .build-local
  variables:
    TARGET: aarch64

build-arm:
  stage: build
  extends: .build-local
  variables:
    TARGET: armv7hl

build-x86:
  stage: build
  extends: .build-local
  variables:
    TARGET: i486

If you have gitlab-runner instaled locally, this will run the build:

#!/usr/bin/env bash

BASE_DIR=$PWD
BUILD_DIR=$BASE_DIR/build
CACHE_DIR=${HOME}/.cache/gitlab-runner-cache
mkdir -p $BUILD_DIR
builder="$1"
if [[ x"$1" = x"" ]]; then
  builder='.build-local'
fi
case $1 in
  '-h'|'list'|'help')
	echo these local builders exist:
	grep '^\..*local' .gitlab-ci.yml
	exit 0
	;;
esac

DOPTS="--docker-pull-policy=never --docker-volumes "$BUILD_DIR/:/builds:rw" --docker-cache-dir $CACHE_DIR "
[[ -e $BASE_DIR/build.log ]] && mv $BASE_DIR/build.log $BASE_DIR/build.log.old
gitlab-ci-multi-runner -l warn exec docker $DOPTS $builder 2>&1 | tee $BASE_DIR/build.log  |  grep -v 'ERROR: Could not create cache adapter'
2 Likes

Now that SailSync ownCloud have a 64bit version, and thanks to @aerique build of ownkeepass, my workflow to sync (through nextcloud) and use my keepass passwords is working fully again natively.
Thank you all.

4 Likes

ownKeepass is now available at OBS via sailfishos:chum repositories. Currently, builds are available for all architectures and released SFOS versions starting from 3.4.0.24 till 4.1.0.24.

To make it possible, I have used @aerique work, adjusted his packaging scripts for libargon2 and libsodium that got also published in Chum repos.

ownKeepass had some libs bundled in binary format within the sources to simplify packaging. Those got removed. I also dropped generation of SPEC from YAML, SPEC got cleaned up and now the application is built from the root of the project.

When someone gets to develop ownKeepass further, please look into the changes made at sailfishos-chum/ownkeepass. Had to remove forking as it leads to submitting of local PRs into other repositories upstream of the forking tree.

Note that testing is limited, seems to work for my database and allowed to create new one as well which I successfully opened on PC. That’s on 4.1.0.24/aarch64.

@aerique mentioned something regarding libgcrypt - I have not used any updated version of the lib. It looks to be available in SFOS repos and I don’t know whether it needs to be updated for earlier SFOS versions. Please chip in and let me know. In that case we may have to add that to Chum repos as well.

Enjoy, hopefully all works with this build.

11 Likes

Excellent, it seems the original topic now has git its solution, and it’s excatly what OBS/Chum appears to be about.

Thanks to all involved!

Thanks for the work @rinigus (and others!). At the moment I’m on GrapheneOS (I switch between SFOS and degoogled Android every 6 months or so, I’ll be back :wink: ) so I haven’t followed: can I remove my ownKeepass repo from OpenRepos now?

Maybe you should keep it for a bit. We don’t have yet Chum and OpenRepos integration ready and some would prefer to install via OpenRepos from your build.

Alright, will do!

20

@rinigus I apologize if you’ve already answered in the discussion as I was unable to find it: do you intend to also restart publishing ownKeepass in OpenRepos (or Jolla Store) and how can we help you do so?

No, I don’t have intention for publishing it outside Chum repos. If we get OpenRepos / Chum integration working, it should be made available at OpenRepos automatically then.

But note that I am not really considering myself as ownKeepass maintainer either. I adjusted packaging scripts to make it build at OBS, but nothing further.

Good to know, thank you. Also, it makes no difference to me whether it’s manual or automatic so I hope this integration isn’t hard to add.

1 Like

You could follow it here: OpenRepos and Chum integration

Is there a workaround or some fix to make ownKeepass access SD-card? As I’m not a developer I really need help with this.

1 Like