diff options
author | zxp19821005 | 2025-03-04 22:41:27 +0800 |
---|---|---|
committer | zxp19821005 | 2025-03-04 22:41:27 +0800 |
commit | 75d62bb94c2a2c4f99f539df9ff9d323008599da (patch) | |
tree | 42ea1738e6f8726cb1f215d11540edcffb4b97bf | |
download | aur-awsaml-git.tar.gz |
update to 3.1.2.r35.gd1d35c8
-rw-r--r-- | .SRCINFO | 21 | ||||
-rw-r--r-- | PKGBUILD | 80 | ||||
-rw-r--r-- | awsaml.sh | 29 |
3 files changed, 130 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..44a74f80aedb --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,21 @@ +pkgbase = awsaml-git + pkgdesc = An application for providing automatically rotated temporary AWS credentials.(Use system-wide electron) + pkgver = 3.1.2.r35.gd1d35c8 + pkgrel = 1 + url = https://github.com/rapid7/awsaml + arch = any + license = MIT + makedepends = npm + makedepends = nvm + makedepends = git + makedepends = curl + makedepends = gendesk + depends = electron31 + provides = awsaml=3.1.2 + conflicts = awsaml + source = awsaml.git::git+https://github.com/rapid7/awsaml.git + source = awsaml.sh + sha256sums = SKIP + sha256sums = 291f50480f5a61bc9c68db7d44cd0412071128706baa868a9cb854f8779a1980 + +pkgname = awsaml-git diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..f29327bfcb57 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,80 @@ +# Maintainer: zxp19821005 <zxp19821005 at 163 dot com> +pkgname=awsaml-git +_pkgname=Awsaml +pkgver=3.1.2.r35.gd1d35c8 +_electronversion=31 +_nodeversion=20 +pkgrel=1 +pkgdesc="An application for providing automatically rotated temporary AWS credentials.(Use system-wide electron)" +arch=('any') +url="https://github.com/rapid7/awsaml" +license=('MIT') +provides=("${pkgname%-git}=${pkgver%.r*}") +conflicts=("${pkgname%-git}") +depends=( + "electron${_electronversion}" +) +makedepends=( + 'npm' + 'nvm' + 'git' + 'curl' + 'gendesk' +) +source=( + "${pkgname//-/.}::git+${url}.git" + "${pkgname%-git}.sh" +) +sha256sums=('SKIP' + '291f50480f5a61bc9c68db7d44cd0412071128706baa868a9cb854f8779a1980') +pkgver() { + cd "${srcdir}/${pkgname//-/.}" + set -o pipefail + git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/v//g' || + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)" +} +_ensure_local_nvm() { + local NVM_DIR="${srcdir}/.nvm" + source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]] + nvm install "${_nodeversion}" + nvm use "${_nodeversion}" +} +prepare() { + sed -i -e " + s/@electronversion@/${_electronversion}/g + s/@appname@/${pkgname%-git}/g + s/@runname@/app.asar/g + s/@cfgdirname@/${pkgname%-git}/g + s/@options@/env ELECTRON_OZONE_PLATFORM_HINT=auto/g + " "${srcdir}/${pkgname%-git}.sh" + _ensure_local_nvm + gendesk -q -f -n --pkgname="${pkgname%-git}" --pkgdesc="${pkgdesc}" --categories="Utility" --name="${_pkgname}" --exec="${pkgname%-git} %U" + cd "${srcdir}/${pkgname//-/.}" + export ELECTRON_SKIP_BINARY_DOWNLOAD=1 + export SYSTEM_ELECTRON_VERSION="$(electron${_electronversion} -v | sed 's/v//g')" + HOME="${srcdir}/.electron-gyp" + mkdir -p "${srcdir}/.electron-gyp" + touch "${srcdir}/.electron-gyp/.yarnrc" + if [[ "$(curl -s ipinfo.io/country)" == *"CN"* ]]; then + { + echo 'npmRegistryServer: "https://registry.npmmirror.com"' + echo "cacheFolder: "${srcdir}"/.yarn/cache" + echo "globalFolder: "${srcdir}"/.yarn/global" + } >> .yarnrc.yml + export npm_config_electron_mirror=https://registry.npmmirror.com/-/binary/electron/ + export npm_config_electron_builder_binaries_mirror=https://registry.npmmirror.com/-/binary/electron-builder-binaries/ + fi + sed -i "s/\"electron\": \"[^\"]*\"/\"electron\": \"${SYSTEM_ELECTRON_VERSION}\"/g" package.json + NODE_ENV=development yarn install +} +build() { + cd "${srcdir}/${pkgname//-/.}" + NODE_ENV=production yarn run package +} +package() { + install -Dm755 "${srcdir}/${pkgname%-git}.sh" "${pkgdir}/usr/bin/${pkgname%-git}" + install -Dm644 "${srcdir}/${pkgname//-/.}/out/${_pkgname}-linux-"*/resources/app.asar -t "${pkgdir}/usr/lib/${pkgname%-git}" + install -Dm644 "${srcdir}/${pkgname//-/.}/images/icon.png" "${pkgdir}/usr/share/pixmaps/${pkgname%-git}.png" + install -Dm644 "${srcdir}/${pkgname%-git}.desktop" -t "${pkgdir}/usr/share/applications" + install -Dm644 "${srcdir}/${pkgname//-/.}/LICENSE.md" -t "${pkgdir}/usr/share/licenses/${pkgname}" +}
\ No newline at end of file diff --git a/awsaml.sh b/awsaml.sh new file mode 100644 index 000000000000..40e422ca2ee7 --- /dev/null +++ b/awsaml.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -o pipefail +_APPDIR="/usr/lib/@appname@" +_RUNNAME="${_APPDIR}/@runname@" +_CFGDIR="@cfgdirname@/" +_OPTIONS="@options@" +export PATH="${_APPDIR}:${PATH}" +export LD_LIBRARY_PATH="${_APPDIR}/swiftshader:${_APPDIR}/lib:${LD_LIBRARY_PATH}" +export ELECTRON_IS_DEV=0 +export ELECTRON_FORCE_IS_PACKAGED=true +export ELECTRON_DISABLE_SECURITY_WARNINGS=true +export ELECTRON_OVERRIDE_DIST_PATH="/usr/bin/electron@electronversion@" +export NODE_ENV=production +export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" +export _FLAGS_FILE="${XDG_CONFIG_HOME}/${_CFGDIR}@appname@-flags.conf" +declare -a _USER_FLAGS +if [[ -f "${_FLAGS_FILE}" ]]; then + while read -r line; do + if [[ ! "${line}" =~ ^[[:space:]]*#.* ]]; then + _USER_FLAGS+=("${line}") + fi + done < "${_FLAGS_FILE}" +fi +cd "${_APPDIR}" || { echo "Failed to change directory to ${_APPDIR}"; exit 1; } +if [[ "${EUID}" -ne 0 ]] || [[ "${ELECTRON_RUN_AS_NODE}" ]]; then + exec electron@electronversion@ "${_RUNNAME}" ${_OPTIONS} "${_USER_FLAGS[@]}" "$@" +else + exec electron@electronversion@ "${_RUNNAME}" ${_OPTIONS} --no-sandbox "${_USER_FLAGS[@]}" "$@" +fi
\ No newline at end of file |