From 42ef63c0d9c60c3314cc2d553451304679ef82b5 Mon Sep 17 00:00:00 2001 From: Cuan Date: Mon, 1 Aug 2022 20:48:27 -0400 Subject: [PATCH] sshyp-mfa - Added Alpine Linux packaging --- sshyp-mfa/package.sh | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/sshyp-mfa/package.sh b/sshyp-mfa/package.sh index 8bcdd24..2ce88e4 100755 --- a/sshyp-mfa/package.sh +++ b/sshyp-mfa/package.sh @@ -3,12 +3,13 @@ # This script packages sshyp-mfa (from source) for various UNIX(-like) environments. # Dependencies (Arch Linux): dpkg (packaging for Debian/Termux), freebsd-pkg (packaging for FreeBSD) # Dependencies (Fedora) (can only package for self): rpmdevtools +# Dependencies (Alpine): xz (not part of a basic installation, needed for generic package creation and unpacking for abuild), alpine-sdk (required to build the .apk file from the generated APKBUILD), bash # NOTE It is recommended to instead use the latest officially packaged and tagged release. echo -e '\nOptions (please enter the number only):' echo -e '\nPackage Formats:\n\n1. Haiku\n2. Debian&Ubuntu Linux\n3. Fedora Linux\n4. FreeBSD\n5. Termux\n6. Generic (used for PKGBUILD/APKBUILD)' -echo -e '\nBuild Scripts:\n\n7. Arch Linux (PKGBUILD)' -echo -e '\nOther:\n\n8. All (generates all distribution packages (excluding Haiku and Fedora, as these must be packaged on their respective distributions) and build scripts)\n' +echo -e '\nBuild Scripts:\n\n7. Arch Linux (PKGBUILD)\n8. Alpine Linux (APKBUILD)' +echo -e '\nOther:\n\n9. All (generates all distribution packages (excluding Haiku, Fedora, and Alpine, as these must be packaged on their respective distributions) and build scripts)\n' read -n 1 -r -p "Distribution: " distro echo -e '\n\nThe value entered in this field will only affect the version reported to the package manager. The latest source is used regardless.\n' @@ -17,7 +18,7 @@ read -r -p "Version number: " version echo -e '\nThe value entered in this field will only affect the revision number for build scripts.\n' read -r -p "Revision number: " revision -if [ "$distro" == "7" ] || [ "$distro" == "8" ]; then +if [ "$distro" == "7" ] || [ "$distro" == "8" ] || [ "$distro" == "9" ]; then echo -e '\nOptions (please enter the number only):' echo -e '\n1. GitHub Release Tag\n2. Local\n' read -r -p "Source (for build scripts): " source @@ -74,7 +75,7 @@ urls { echo -e "\nHaiku packaging complete.\n" fi -if [ "$distro" == "2" ] || [ "$distro" == "8" ]; then +if [ "$distro" == "2" ] || [ "$distro" == "9" ]; then echo -e '\nPackaging for Debian...\n' mkdir -p packages/debiantemp/sshyp-mfa_"$version"-"$revision"_all/{DEBIAN,usr/share/man/man1} echo "Package: sshyp-mfa @@ -98,7 +99,7 @@ Installed-Size: 100 echo -e "\nDebian packaging complete.\n" fi -if [ "$distro" == "5" ] || [ "$distro" == "8" ]; then +if [ "$distro" == "5" ] || [ "$distro" == "9" ]; then echo -e '\nPackaging for Termux...\n' mkdir -p packages/termuxtemp/sshyp-mfa_"$version"-"$revision"_all_termux/{data/data/com.termux/files/usr/share/man/man1,DEBIAN} echo "Package: sshyp-mfa @@ -122,7 +123,7 @@ Installed-Size: 100 echo -e "\nTermux packaging complete.\n" fi -if [ "$distro" == "3" ] || [ "$distro" == "4" ] || [ "$distro" == "6" ] || [ "$distro" == "7" ] || [ "$distro" == "8" ]; then +if [ "$distro" == "3" ] || [ "$distro" == "4" ] || [ "$distro" == "6" ] || [ "$distro" == "7" ] || [ "$distro" == "8" ] || [ "$distro" == "9" ]; then echo -e '\nPackaging as generic...\n' mkdir -p packages/generictemp/usr/share/man/man1 cp -r bin packages/generictemp/usr/ @@ -173,7 +174,7 @@ rm -rf ~/rpmbuild echo -e "\nFedora packaging complete.\n" fi -if [ "$distro" == "4" ] || [ "$distro" == "8" ]; then +if [ "$distro" == "4" ] || [ "$distro" == "9" ]; then echo -e '\nPackaging for FreeBSD...\n' mkdir -p packages/FreeBSDtemp/bin tar xf packages/sshyp-mfa-"$version".tar.xz -C packages/FreeBSDtemp @@ -206,10 +207,9 @@ rm -rf packages/FreeBSDtemp echo -e "\nFreeBSD packaging complete.\n" fi -if [ "$distro" == "7" ] || [ "$distro" == "8" ]; then +if [ "$distro" == "7" ] || [ "$distro" == "9" ]; then echo -e '\nGenerating PKGBUILD...' echo "# Maintainer: Randall Winkhart - pkgname=sshyp-mfa pkgver="$version" pkgrel="$revision" @@ -230,3 +230,27 @@ package() { " > packages/PKGBUILD echo -e "\nPKGBUILD generated.\n" fi + +if [ "$distro" == "8" ] || [ "$distro" == "9" ]; then + echo -e '\nGenerating APKBUILD...' + echo "# Maintainer: Randall Winkhart +pkgname=sshyp-mfa +pkgver="$version" +pkgrel="$revision" +pkgdesc='An MFA (TOTP/Steam) key generator for the sshyp password manager' +options=!check +url='https://github.com/rwinkhart/sshyp-labs' +arch='noarch' +license='GPL-3.0-or-later' +depends='sshyp python3' +source=\""$source"\" +package() { + mkdir -p "\"\$pkgdir\"" + cp -r "\"\$srcdir/usr/"\" "\"\$pkgdir\"" +} +sha512sums=\" +"$sha512' 'sshyp-mfa\"\$pkgver\".tar.xz" +\" +" > packages/APKBUILD + echo -e "\nAPKBUILD generated.\n" +fi