diff --git a/package.sh b/package.sh index fddc241..3f992ae 100755 --- a/package.sh +++ b/package.sh @@ -1,74 +1,52 @@ #!/bin/bash -# This script packages sshyp (from source) for Arch Linux. -# In the future, it will also package for Alpine, Debian, Termux. +# This script packages sshyp (from source) for various Linux environments. + # NOTE It is recommended to instead use the latest officially packaged and tagged release. # NOTE If using Arch, it is recommended to install from the AUR or from the PKGBUILD attatched to the latest official release. # NOTE As of release fr4, sshync will become a separate package and thus a dependency for sshyp. sshync is automatically installed with the PKGBUILD version. -echo -e '\nOptions (please enter the number only):\n\n1. Alpine Linux\n2. Arch Linux (PKGBUILD)\n3. Debian Linux\n4. Termux\n5. Generic (used for PKGBUILD)\n6. All (will create all types of packages)\n' +echo -e '\nOptions (please enter the number only):' +echo -e '\nDistribution Packages:\n\n1. Debian Linux\n2. Termux\n3. Generic (used for PKGBUILD/APKBUILD)\n' +echo -e '\nBuild Scripts:\n\n4. Alpine Linux (APKBUILD)\n5. Arch Linux (PKGBUILD)\n' +echo -e '\nOther:\n\n6. All (generates all distribution packages and build scripts)\n' read -n 1 -r -p "Distribution: " distro echo -e '\nThe value entered in this field will only affect the version reported to the package manager. The latest source is used regardless.\n' read -r -p "Version number: " version -read -r -p "Revision number: " revision - -mkdir packages - -if [ "$distro" == "2" ] || [ "$distro" == "6" ]; then - echo -e '\nGenerating PKGBUILD...' - mkdir -p sshyp_"$version"-"$revision"_termux/{data,DEBIAN} - mkdir -p sshyp_"$version"-"$revision"_termux/data/data/com.termux/files/usr/var - mkdir -p usr/share/man/man1 - echo '# Maintainer: Randall Winkhart - - pkgname=sshyp - pkgver='"$version"' - pkgrel='"$revision"' - pkgdesc='A light-weight, self-hosted, synchronized password manager' - url='https://github.com/rwinkhart/sshyp' - arch=('any') - license=('GPL3') - depends=( python gnupg openssh nano xclip wl-clipboard) - - source=("https://github.com/rwinkhart/sshyp/releases/download/v$pkgver/sshyp-$pkgver.tar.xz") - sha512sums=('be6695cc231f4414322f2c4b919caf0759f4111e50259b3a6bbcb6e90a0ceba5d094c8766c287e5443c61adfdf414c1a93bc70e505dfd4bf34097c713b6e7d2f') - - package() { - - tar xf sshyp-"$pkgver".tar.xz -C "${pkgdir}" - chown -R "$USER" ${pkgdir}/var/lib/sshyp - - } - ' > packages/PKGBUILD - echo -e "\nPKGBUILD generated.\n" +if [ "$distro" == "4" ] || [ "$distro" == "5" ] || [ "$distro" == "6" ]; then + echo -e '\nThe value entered in this field will only affect the revision number for build scripts.\n' + read -r -p "Revision number: " revision fi -if [ "$distro" == "4" ] || [ "$distro" == "6" ]; then - echo -e '\nPackaging for Termux...' - mkdir -p sshyp_"$version"-"$revision"_termux/{data,DEBIAN} - mkdir -p sshyp_"$version"-"$revision"_termux/data/data/com.termux/files/usr/var - mkdir -p usr/share/man/man1 +mkdir -p packages + +if [ "$distro" == "2" ] || [ "$distro" == "6" ]; then + echo -e '\nPackaging for Termux...\n' + mkdir -p packages/termuxtemp/sshyp_"$version"-"$revision"_termux/{data,DEBIAN} + mkdir -p packages/termuxtemp/sshyp_"$version"-"$revision"_termux/data/data/com.termux/files/usr/var + mkdir -p packages/termuxtemp/sshyp_"$version"-"$revision"_termux/data/data/com.termux/files/usr/share/man/man1 echo "Package: sshyp - Version: $version - Section: utils - Architecture: all - Maintainer: Randall Winkhart - Description: A light-weight, self-hosted, synchronized password manager - Depends: python, gnupg, openssh, nano, termux-api, termux-am - " > sshyp_"$version"-"$revision"_termux/DEBIAN/control - cp -r bin sshyp_"$version"-"$revision"_termux/data/data/com.termux/files/usr/ - cp -r share sshyp_"$version"-"$revision"_termux/data/data/com.termux/files/usr/ - touch sshyp_"$version"-"$revision"_termux/data/data/com.termux/files/usr/var/flag_termux - cp extra/manpage sshyp_"$version"-"$revision"_termux/data/data/com.termux/files/usr/share/man/man1/sshyp.1 - gzip sshyp_"$version"-"$revision"_termux/data/data/com.termux/files/usr/share/man/man1/sshyp.1 - dpkg-deb --build --root-owner-group sshyp_"$version"-"$revision"_termux/ - mv sshyp_"$version"-"$revision"_termux.deb packages/ +Version: $version +Section: utils +Architecture: all +Maintainer: Randall Winkhart +Description: A light-weight, self-hosted, synchronized password manager +Depends: python, gnupg, openssh, nano, termux-api, termux-am +" > packages/termuxtemp/sshyp_"$version"-"$revision"_termux/DEBIAN/control + cp -r bin packages/termuxtemp/sshyp_"$version"-"$revision"_termux/data/data/com.termux/files/usr/ + cp -r share packages/termuxtemp/sshyp_"$version"-"$revision"_termux/data/data/com.termux/files/usr/ + touch packages/termuxtemp/sshyp_"$version"-"$revision"_termux/data/data/com.termux/files/usr/var/flag_termux + cp extra/manpage packages/termuxtemp/sshyp_"$version"-"$revision"_termux/data/data/com.termux/files/usr/share/man/man1/sshyp.1 + gzip packages/termuxtemp/sshyp_"$version"-"$revision"_termux/data/data/com.termux/files/usr/share/man/man1/sshyp.1 + dpkg-deb --build --root-owner-group packages/termuxtemp/sshyp_"$version"-"$revision"_termux/ + mv packages/termuxtemp/sshyp_"$version"-"$revision"_termux.deb packages/ + rm -rf packages/termuxtemp echo -e "\nTermux packaging complete.\n" fi -if [ "$distro" == "5" ] || [ "$distro" == "6" ]; then - echo -e '\nPackaging as generic...' +if [ "$distro" == "3" ] || [ "$distro" == "6" ]; then + echo -e '\nPackaging as generic...\n' mkdir -p packages/archtemp/var/lib/sshyp mkdir -p packages/archtemp/usr cp -r bin packages/archtemp/usr/ @@ -76,7 +54,7 @@ if [ "$distro" == "5" ] || [ "$distro" == "6" ]; then mkdir -p packages/archtemp/usr/share/man/man1 cp extra/manpage packages/archtemp/usr/share/man/man1/sshyp.1 gzip packages/archtemp/usr/share/man/man1/sshyp.1 - tar -cf packages/sshyp-"$version".tar.xz packages/archtemp/usr/ packages/archtemp/var/ + tar -C packages/archtemp -cvf packages/sshyp-"$version".tar.xz usr/ var/ rm -rf packages/archtemp echo -e '\nsha512 sum:' sha512sum packages/sshyp-"$version".tar.xz @@ -84,3 +62,29 @@ if [ "$distro" == "5" ] || [ "$distro" == "6" ]; then sha256sum packages/sshyp-"$version".tar.xz echo -e "\nGeneric packaging complete.\n" fi + +if [ "$distro" == "5" ] || [ "$distro" == "6" ]; then + echo -e '\nGenerating PKGBUILD...' + echo '# Maintainer: Randall Winkhart + +pkgname=sshyp +pkgver='"$version"' +pkgrel='"$revision"' +pkgdesc='A light-weight, self-hosted, synchronized password manager' +url='https://github.com/rwinkhart/sshyp' +arch=('any') +license=('GPL3') +depends=( python gnupg openssh nano xclip wl-clipboard) + +source=("https://github.com/rwinkhart/sshyp/releases/download/v$pkgver/sshyp-$pkgver.tar.xz") +sha512sums=('be6695cc231f4414322f2c4b919caf0759f4111e50259b3a6bbcb6e90a0ceba5d094c8766c287e5443c61adfdf414c1a93bc70e505dfd4bf34097c713b6e7d2f') + +package() { + + tar xf sshyp-"$pkgver".tar.xz -C "${pkgdir}" + chown -R "$USER" ${pkgdir}/var/lib/sshyp + +} +' > packages/PKGBUILD + echo -e "\nPKGBUILD generated.\n" +fi