add processor checks

This commit is contained in:
xiota 2023-11-08 06:47:04 -08:00
parent 52864d246a
commit 884bbde284
4 changed files with 53 additions and 19 deletions

View file

@ -1,7 +1,7 @@
pkgbase = thorium-browser-bin
pkgdesc = Chromium fork focused on high performance and security
pkgver = 117.0.5938.157
pkgrel = 3
pkgrel = 4
url = https://github.com/Alex313031/Thorium
install = thorium-browser.install
arch = x86_64
@ -16,7 +16,7 @@ pkgbase = thorium-browser-bin
source = https://github.com/Alex313031/Thorium/releases/download/M117.0.5938.157/thorium-browser_117.0.5938.157_amd64.deb
source = thorium-browser.sh
sha256sums = SKIP
sha256sums = e09c5c523f45b8acfd58403514f9ad69047daa94600787bd7aee33d78080f9a9
sha256sums = d2bec392c1dafc6ab4a4cd463be8cf627c58e00960ebea54c54151e9df101f53
pkgname = thorium-browser-bin
depends = alsa-lib

View file

@ -19,7 +19,7 @@ fi
_pkgname="thorium-browser"
pkgname="$_pkgname-bin"
pkgver=117.0.5938.157
pkgrel=3
pkgrel=4
pkgdesc="Chromium fork focused on high performance and security"
url="https://github.com/Alex313031/Thorium"
license=('BSD')
@ -65,7 +65,7 @@ source=(
)
sha256sums=(
'SKIP'
'e09c5c523f45b8acfd58403514f9ad69047daa94600787bd7aee33d78080f9a9'
'd2bec392c1dafc6ab4a4cd463be8cf627c58e00960ebea54c54151e9df101f53'
)
pkgver() {

View file

@ -1,20 +1,34 @@
# Colored makepkg-like functions
msg_blue() {
printf "${blue}==>${bold} $1${all_off}\n"
printf "${BLUE}==>${BOLD} $1${ALL_OFF}\n"
}
note() {
printf "${blue}==>${yellow} NOTE:${bold} $1${all_off}\n"
printf "${BLUE}==>${YELLOW} NOTE:${BOLD} $1${ALL_OFF}\n"
}
all_off="$(tput sgr0)"
bold="${all_off}$(tput bold)"
blue="${bold}$(tput setaf 4)"
yellow="${bold}$(tput setaf 3)"
ALL_OFF="$(tput sgr0)"
BOLD="${ALL_OFF}$(tput bold)"
BLACK="${BOLD}$(tput setaf 0)"
RED="${BOLD}$(tput setaf 1)"
GREEN="${BOLD}$(tput setaf 2)"
YELLOW="${BOLD}$(tput setaf 3)"
BLUE="${BOLD}$(tput setaf 4)"
MAGENTA="${BOLD}$(tput setaf 5)"
CYAN="${BOLD}$(tput setaf 6)"
WHITE="${BOLD}$(tput setaf 7)"
post_install() {
note "Custom flags should be put directly in: ~/.config/thorium-flags.conf"
note "The launcher is called: 'thorium-browser'"
if /usr/lib/ld-linux-x86-64.so.2 --help | grep -qsE '^\s+x86-64-v3.*supported.*$' ; then
note "Custom flags should be put directly in: ~/.config/thorium-flags.conf"
note "The launcher is called: 'thorium-browser'"
elif /usr/lib/ld-linux-x86-64.so.2 --help | grep -qsE '^\s+x86-64-v2.*supported.*$' ; then
note "Your processor supports x86-64-v2, but not x86-64-v3."
note "You may want to install thorium-browser-sse3-bin instead."
else
note "Your processor does not support x86-64-v2 or x86-64-v3."
note "thorium-browser will not work on your computer."
fi
}
post_upgrade() {

View file

@ -1,11 +1,31 @@
#!/bin/bash
#!/usr/bin/env bash
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config}
# check microprocessor architecture level
if /usr/lib/ld-linux-x86-64.so.2 --help | grep -qsE '^\s+x86-64-v3.*supported.*$' ; then
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config}
# Allow users to override command-line options
if [[ -f $XDG_CONFIG_HOME/thorium-flags.conf ]]; then
THORIUM_USER_FLAGS="$(cat $XDG_CONFIG_HOME/thorium-flags.conf)"
# Allow users to override command-line options
if [[ -f $XDG_CONFIG_HOME/thorium-flags.conf ]]; then
THORIUM_USER_FLAGS="$(cat $XDG_CONFIG_HOME/thorium-flags.conf)"
fi
# Launch
exec /opt/thorium-browser/thorium-browser $THORIUM_USER_FLAGS "$@"
elif /usr/lib/ld-linux-x86-64.so.2 --help | grep -qsE '^\s+x86-64-v2.*supported.*$' ; then
_message=''
_message+=$'Your processor supports x86-64-v2, but not x86-64-v3.\n'
_message+=$'You may want to use thorium-browser-sse3-bin.'
else
_message=''
_message+=$'Your processor does not support x86-64-v2 or x86-64-v3.\n'
_message+=$'thorium-browser will not work on your computer.'
fi
# Launch
exec /opt/thorium-browser/thorium-browser $THORIUM_USER_FLAGS "$@"
# display processor support message
if tty -s ; then
echo "${_message:?}"
else
notify-send -a "thorium-browser" -t 3000 "${_message:?}"
fi
exit 1