image28

nhminer

May 6th, 2020
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.97 KB | None | 0 0
  1. # Maintainer: Jonathan Steel <jsteel at archlinux.org>
  2. # Contributor: Peter Simons <[email protected]>
  3.  
  4. pkgname=nhos
  5. pkgver=1.1.5
  6. pkgrel=1
  7. pkgdesc="nicehash os miner without the os part"
  8. arch=('x86_64')
  9. url="https://www.nicehash.com/my/"
  10. license=('multi')
  11. depends=('glibc')
  12. makedepends=('glibc')
  13. source=(https://www.nicehash.com/my/mining/rigs/$pkgname-$pkgver.img)
  14. conflicts=('nhos')
  15. md5sums=('72a097a2a025a08bfefabed1790b2177')
  16.  
  17. BASEDIR="`pwd`"
  18.  
  19. build() {
  20.   BUILDDIR="$BASEDIR/build";
  21.   SRCDIR="$BASEDIR/src"
  22.  
  23.   mkdir -p "$BUILDDIR"
  24.   mkdir -p "$SRCDIR"
  25.  
  26. # mount nhos img file as root
  27.   OFFSET=$((`fdisk -u sectors -l "$BASEDIR/$pkgname-$pkgver.img" 2> /dev/null | tail -n1 | awk -F' ' '{print $2}'`*512))
  28.   mkdir -p $SRCDIR/$pkgname-$pkgver
  29.   #mount -t auto -o loop,ro,user=image,offset=$OFFSET $pkgname-$pkgver.img $SRCDIR/$pkgname-$pkgver/
  30.  
  31. # extract nhos-miner image
  32.   cd "$BUILDDIR"
  33.   echo "Extracting to `pwd`"
  34.   for d in `ls $SRCDIR/$pkgname-$pkgver/apps/default/*.tcz`;
  35.   do
  36.     DIR=`basename $d | rev | cut -c5- | rev`;
  37.     unsquashfs "$d";
  38.     cp -Rf squashfs-root/* ./;
  39.     rm -rf squashfs-root;
  40.   done
  41.  
  42. # extract initramfs
  43.   echo "Extract initramfs"
  44.   cd "$BUILDDIR"
  45.   mkdir -p "$BUILDDIR/initramfs"
  46.   cd "$BUILDDIR/initramfs/"
  47.   zcat "$SRCDIR/$pkgname-$pkgver/boot/default/initrd.gz" | cpio -idmvu -Wall && echo
  48.   echo "Return status is $?"
  49.  
  50.   echo "Changing to $BASEDIR"
  51.   cd "$BASEDIR"
  52.  
  53.   # cp initramfs etc/sysconfig/nhos dir to unsquashed merged folder
  54.   echo "Copy etc config files for nhos miner"
  55.   mkdir -p "$BUILDDIR/etc/sysconfig/nhos"
  56.   cp -r $BUILDDIR/initramfs/etc/sysconfig/nhos/* "$BUILDDIR/etc/sysconfig/nhos/"
  57.  
  58.   # cp initramfs opt dir to unsquashed merged folder
  59.   echo "Copy nhos miner scripts to opt folder"
  60.   cp -r $BUILDDIR/initramfs/opt/* "$BUILDDIR/opt/"
  61.  
  62.   # cleanup package folder
  63.   echo "cleaning up"
  64.   rm -rf "$BUILDDIR/initramfs"
  65. }
  66.  
  67. package() {
  68.   BUILDDIR="$BASEDIR/build";
  69.  
  70.   echo "Copying $BUILDDIR/* to $BASEDIR/pkg/nhos"
  71.   cp -r $BUILDDIR/* "$BASEDIR/pkg/nhos/"
  72. }
Add Comment
Please, Sign In to add comment