Compare commits

...

7 Commits

8 changed files with 90 additions and 66 deletions

View File

@ -1,19 +1,27 @@
# debfetcher # debfetcher
debfetcher automates fetching and installing certain .deb packages from apt repos. debfetcher enables fetching, installing and updating certain .deb packages from apt repos for non-Debian
distributions.
## Features ## Features
- apt signature and package checksum verification - apt signature and package checksum verification
- User-level installation - User-level installation
## Motivation ## About
Many popular software packages are often distributed as .deb packages, targeting Ubuntu primarily. Many popular software packages are often distributed as .deb packages, targeting Ubuntu primarily.
Often they are not available in the repos of others distros. Even if they are, sometimes the version tends to be behind upstream for some time. They may also only be available as "unofficial" packages through user repositories such as AUR, PPA or Gentoo overlays. Often they are not available in the repos of others distros. Even if they are, sometimes the version tends to be behind upstream for some time. They may also only be available as "unofficial" packages through user repositories such as AUR, PPA or Gentoo overlays.
Examples for such packages are: Brave, Signal-Desktop, Element-Desktop, Spotify etc. Examples for such packages are: Brave, Signal-Desktop, Element-Desktop, Spotify etc.
debfetcher can fetch such packages from the official apt repos. debfetcher can fetch such packages from the official apt repos and keep them up to date.
The binaries in the .deb actually work on other distributions (often) The binaries in the .deb actually work on other distributions (often). In fact, distros
often use simply fetch the .deb packages from the apt repo in their templates. But they aren't always
quick to keep their template up to date with the latest upstream version.
There may therefore hardly be a practical benefit in using your distros package manager to install those. Your distro's
package may essentially just be a "proxy" for the .deb. Although you can make a version bump yourself,
it is rather inconvenient and you'll have to monitor for new releases yourself. Even though being out
of date is not a big problem often, it obviously can be when you are missing out on security updates.
debfetcher simply identifies the latest version of a package in the corresponding apt repo, downloads it and then installs the binaries from the .deb. debfetcher simply identifies the latest version of a package in the corresponding apt repo, downloads it and then installs the binaries from the .deb.
@ -27,20 +35,21 @@ debfetcher verifies the repo signatures and .deb checksum (just like apt).
- You don't have to wait for your distribution to make a version bump - You don't have to wait for your distribution to make a version bump
## Status ## Status
It is, and will most certainly remain, a hack (although a useful one for me) It is, and will most certainly remain, a "hack" (although a useful one for me)
## FAQ ## FAQ
### Sounds overall rather dirty. Does this even work? ### Sounds overall rather dirty. Does this even work?
Naturally, this will not work for all packages due to ABI issues or library version mismatches. Naturally, this will not work for all packages due to ABI issues or library version mismatches.
However, using the .deb even for distros not based on debian is an approach taken by distris for propritary packages or packages where building from source is a significant maintenance load (i. e. electron-based apps). Overall, the idea is tested and not new. But as said above, this is not my idea. Using the .deb even for distros not based on Debian is an approach taken by distris for propritary packages or packages where building from source is a significant maintenance load (i. e. electron-based apps). Overall, the idea is tested and not new.
### What if not all dependencies are installed? ### What if not all dependencies are installed?
debfetcher aims to be distro-agnostic. It will not install any dependencies. debfetcher aims to be distro-agnostic. It will not install any dependencies.
If they are missing, you'll get an error (most likely when starting the app). If they are missing, you'll get an error (most likely when starting the app).
Hence, you will have to ensure yourself that they are installed. The packages debfetcher was tested on bundle some Hence, you will have to make sure that they are installed. The packages debfetcher was tested on bundle some
of their dependencies. Also, in a typical Linux desktop installation chances are you already have all dependencies installed. of their dependencies. Also, in a typical Linux desktop installation chances are you already have all dependencies installed.
@ -64,7 +73,7 @@ A template contains the repo URI, package name etc and specifies where to extrac
``` ```
## User-level installation ## User-level installation
If you don't need/want a system-wide installation , debfetcher can be used to install a package in your local user profile. Therefore, debfetcher can be used without polluting your /. If you don't need/want a system-wide installation of a package, debfetcher can be used to install a package in your local user profile. Therefore, debfetcher can be used without polluting your /.
Refer to `debfetcher.user.conf.sample` to change the appropriate settings. Refer to `debfetcher.user.conf.sample` to change the appropriate settings.
@ -73,8 +82,11 @@ Execute
DEBFETCHER_CONFIG="/path/to/debfetcher.user.conf" ./debfetcher.sh get signal DEBFETCHER_CONFIG="/path/to/debfetcher.user.conf" ./debfetcher.sh get signal
``` ```
Note: The config/data directories of the installed packages won't change, which may or may not be
problematic.
## Usage ## Usage
### Install a package ### Install/Upgrade a package
``` ```
debfetcher.sh get [packagename] debfetcher.sh get [packagename]
``` ```
@ -83,9 +95,3 @@ debfetcher.sh get [packagename]
``` ```
debfetcher.sh upgrade debfetcher.sh upgrade
``` ```

View File

@ -78,12 +78,38 @@ print_usage()
verify_sig() verify_sig()
{ {
set +e
gpg --no-default-keyring --keyring "$1" --quiet --verify 2> "${CACHE_DIR}/last_gnupg_verify_result" gpg --no-default-keyring --keyring "$1" --quiet --verify 2> "${CACHE_DIR}/last_gnupg_verify_result"
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
fail "Signature check failed" fail "Signature check failed - See "${CACHE_DIR}/last_gnupg_verify_result""
fi
set -e
}
# default presets for templates
remove()
{
rm -rf -- "${DEBFETCHER_INSTALL_DESTDIR}/${THIS_BASEDIR}"
}
pre_install()
{
CURRENT_DIR="${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}"
if [ -d "${CURRENT_DIR}" ] ; then
mv -- "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}" "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}_${TS}"
fi fi
} }
post_install()
{
if [ ${KEEP_OLD} -eq 0 ] ; then
rm -rf -- "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}_${TS}"
fi
}
debfetcher_install() debfetcher_install()

View File

@ -7,22 +7,6 @@ PACKAGE="brave-browser"
TS=$(date +%s) TS=$(date +%s)
THIS_BASEDIR="/opt/brave.com" THIS_BASEDIR="/opt/brave.com"
remove()
{
rm -rf -- "${DEBFETCHER_INSTALL_DESTDIR}/${THIS_BASEDIR}"
}
pre_install()
{
CURRENT_DIR="${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}"
if [ -d "${CURRENT_DIR}" ] ; then
mv -- "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}" "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}_${TS}"
fi
}
install() install()
{ {
cp -a --parents -- opt/brave.com "${DEBFETCHER_INSTALL_DESTDIR}" cp -a --parents -- opt/brave.com "${DEBFETCHER_INSTALL_DESTDIR}"
@ -31,14 +15,3 @@ install()
} }
post_install()
{
if [ ${KEEP_OLD} -eq 0 ] ; then
rm -rf -- "${DEBFETCHER_INSTALL_DESTDIR}/opt/brave.com_${TS}"
fi
sourcepath=$(realpath "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}/brave/brave-browser")
ln -sf "${sourcepath}" "${DEBFETCHER_BIN_SYMLINK_DIR}/"
sed -e "s;Exec=/;Exec=${DEBFETCHER_BIN_SYMLINK_DIR};" -i "${DEBFETCHER_INSTALL_DESTDIR}"/usr/share/applications/brave-browser.desktop
}

View File

@ -0,0 +1,26 @@
APTURL="https://packages.element.io/debian"
DISTRO="default"
REPO="main"
PUBKEY="${PUBKEY_PATH}/element-io-archive-keyring.gpg"
PACKAGE="element-desktop"
TS=$(date +%s)
THIS_BASEDIR="/opt/Element"
install()
{
#Inspired by Gentoo's ebuild
cp -a --parents -- opt/Element "${DEBFETCHER_INSTALL_DESTDIR}"
cp --parents -- usr/share/applications/element-desktop.desktop "${DEBFETCHER_INSTALL_DESTDIR}"
chmod o=r ${DEBFETCHER_INSTALL_DESTDIR}/usr/share/applications/element-desktop.desktop
ln -sf ${DEBFETCHER_INSTALL_DESTDIR}/opt/Element/element-desktop "${DEBFETCHER_BIN_SYMLINK_DIR}"
find usr -name element-desktop.png | while read line ; do
path=$(dirname "$line")
mkdir -p -- /${DEBFETCHER_INSTALL_DESTDIR}/${path}
cp -a "$line" -- ${DEBFETCHER_INSTALL_DESTDIR}/${path}
done
}

View File

@ -7,21 +7,6 @@ PACKAGE="signal-desktop"
TS=$(date +%s) TS=$(date +%s)
THIS_BASEDIR="/opt/Signal" THIS_BASEDIR="/opt/Signal"
remove()
{
rm -rf -- "${DEBFETCHER_INSTALL_DESTDIR}/${THIS_BASEDIR}"
}
pre_install()
{
CURRENT_DIR="${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}"
if [ -d "${CURRENT_DIR}" ] ; then
mv -- "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}" "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}_${TS}"
fi
}
install() install()
{ {
#Inspired by Gentoo's ebuild #Inspired by Gentoo's ebuild
@ -34,11 +19,3 @@ install()
ln -sf ${DEBFETCHER_INSTALL_DESTDIR}/opt/Signal/signal-desktop "${DEBFETCHER_BIN_SYMLINK_DIR}" ln -sf ${DEBFETCHER_INSTALL_DESTDIR}/opt/Signal/signal-desktop "${DEBFETCHER_BIN_SYMLINK_DIR}"
} }
post_install()
{
if [ ${KEEP_OLD} -eq 0 ] ; then
rm -rf -- "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}_${TS}"
fi
}

View File

@ -0,0 +1,16 @@
APTURL="http://repository.spotify.com"
DISTRO="stable"
REPO="non-free"
PUBKEY="${PUBKEY_PATH}/spotify-keyring-7A3A762FAFD4A51F.gpg"
PACKAGE="spotify-client"
TS=$(date +%s)
THIS_BASEDIR="/opt/spotify"
install()
{
patchelf --replace-needed libcurl-gnutls.so.4 libcurl.so.4 usr/share/spotify/spotify
cp -a -- usr/share/spotify/ ${DEBFETCHER_INSTALL_DESTDIR}/${THIS_BASEDIR}
ln -sf ${DEBFETCHER_INSTALL_DESTDIR}/opt/spotify/spotify "${DEBFETCHER_BIN_SYMLINK_DIR}"
}

Binary file not shown.

Binary file not shown.