[arch-commits] Commit in hdparm/repos (4 files)

Tobias Powalowski tpowa at gemini.archlinux.org
Thu Jan 13 16:00:39 UTC 2022


    Date: Thursday, January 13, 2022 @ 16:00:39
  Author: tpowa
Revision: 434412

archrelease: copy trunk to testing-x86_64

Added:
  hdparm/repos/testing-x86_64/
  hdparm/repos/testing-x86_64/PKGBUILD
    (from rev 434411, hdparm/trunk/PKGBUILD)
  hdparm/repos/testing-x86_64/pass-ldflags.patch
    (from rev 434411, hdparm/trunk/pass-ldflags.patch)
  hdparm/repos/testing-x86_64/wiper.sh.2_6.max-ranges.patch
    (from rev 434411, hdparm/trunk/wiper.sh.2_6.max-ranges.patch)

-------------------------------+
 PKGBUILD                      |   46 +++++++++++++++++++++
 pass-ldflags.patch            |   11 +++++
 wiper.sh.2_6.max-ranges.patch |   84 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 141 insertions(+)

Copied: hdparm/repos/testing-x86_64/PKGBUILD (from rev 434411, hdparm/trunk/PKGBUILD)
===================================================================
--- testing-x86_64/PKGBUILD	                        (rev 0)
+++ testing-x86_64/PKGBUILD	2022-01-13 16:00:39 UTC (rev 434412)
@@ -0,0 +1,46 @@
+# Maintainer: Paul Mattal <paul at archlinux.org>
+
+pkgname=hdparm
+pkgver=9.63
+pkgrel=1
+pkgdesc="A shell utility for manipulating Linux IDE drive/driver parameters"
+arch=(x86_64)
+depends=('glibc')
+optdepends=('sh: required by idectl and ultrabayd')
+source=(https://downloads.sourceforge.net/sourceforge/hdparm/${pkgname}-${pkgver}.tar.gz
+        wiper.sh.2_6.max-ranges.patch pass-ldflags.patch)
+license=('BSD')
+url="https://sourceforge.net/projects/hdparm/"
+optdepends=('bash: for wiper.sh script')
+options=('emptydirs')
+sha512sums=('1d09dc2c79c31f45fa242dd5bf259e84281d1464e49ada9fd53bb6d58cb0458046e534a93f9d6de18478ca5db50b6d36ecbe5b784c0c681a1db29f15fadd525c'
+            'ddb9eff6e4c0b67da72104a9ddcb6fde2b6ad543174e56a7e065453beb88f4c16b977718b1db4beaed41aff477a0ed955303172d019efbe9eacef2a397f27499'
+            '4103276304a858a9540ce173f22c5eb64cadac36b5cd38d9396d63fa721a579e16d4d0f84e3c627d0620c42815c437abf14c9657fdb1a28e8263a52a0bb26c4f')
+
+prepare() {
+  cd ${pkgname}-${pkgver}
+  # Fix Range input/output error when wiping Intel G2 and OCZ drives
+  patch -Np1 -i "$srcdir"/wiper.sh.2_6.max-ranges.patch
+  # Enable FULL RELRO
+  patch -Np1 -i "$srcdir"/pass-ldflags.patch
+}
+
+build() {
+  cd ${pkgname}-${pkgver}
+  make
+}
+
+package() {
+  cd ${pkgname}-${pkgver}
+  # install
+  mkdir -p "${pkgdir}"/usr/bin
+  make DESTDIR="${pkgdir}" sbindir=/usr/bin install
+  install -m755 contrib/idectl "${pkgdir}"/usr/bin
+  install -m755 contrib/ultrabayd "${pkgdir}"/usr/bin
+
+  install -D -m 0644 $srcdir/$pkgname-$pkgver/wiper/README.txt "$pkgdir"/usr/share/doc/wiper/README.txt
+  install -D -m 0755 $srcdir/$pkgname-$pkgver/wiper/wiper.sh "$pkgdir"/usr/bin/wiper.sh
+
+  #install license file
+  install -D -m 644 LICENSE.TXT "$pkgdir"/usr/share/licenses/hdparm/LICENSE.TXT
+}

Copied: hdparm/repos/testing-x86_64/pass-ldflags.patch (from rev 434411, hdparm/trunk/pass-ldflags.patch)
===================================================================
--- testing-x86_64/pass-ldflags.patch	                        (rev 0)
+++ testing-x86_64/pass-ldflags.patch	2022-01-13 16:00:39 UTC (rev 434412)
@@ -0,0 +1,11 @@
+diff -aur hdparm-9.58/Makefile hdparm-9.58.new/Makefile
+--- hdparm-9.60/Makefile	2017-05-01 21:08:42.000000000 +0200
++++ hdparm-9.60.new/Makefile	2019-09-22 19:19:03.783229803 +0200
+@@ -15,6 +15,7 @@
+ 
+ CFLAGS := -O2 -W -Wall -Wbad-function-cast -Wcast-align -Wpointer-arith -Wcast-qual -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -fkeep-inline-functions -Wwrite-strings -Waggregate-return -Wnested-externs -Wtrigraphs $(CFLAGS)
+ 
++LDFLAGS := -s ${LDFLAGS}
+ INSTALL = install
+ INSTALL_DATA = $(INSTALL) -m 644
+ INSTALL_DIR = $(INSTALL) -m 755 -d

Copied: hdparm/repos/testing-x86_64/wiper.sh.2_6.max-ranges.patch (from rev 434411, hdparm/trunk/wiper.sh.2_6.max-ranges.patch)
===================================================================
--- testing-x86_64/wiper.sh.2_6.max-ranges.patch	                        (rev 0)
+++ testing-x86_64/wiper.sh.2_6.max-ranges.patch	2022-01-13 16:00:39 UTC (rev 434412)
@@ -0,0 +1,84 @@
+--- hdparm-9.28/wiper/wiper.sh.orig	2010-03-09 06:17:37.000000000 -0800
+--- hdparm-9.28/wiper/wiper.sh	2010-05-15 03:08:02.182856971 -0700
+@@ -29,7 +29,7 @@
+ function usage_error(){
+ 	echo >&2
+ 	echo "Linux tune-up (TRIM) utility for SATA SSDs"
+-	echo "Usage:  $0 [--verbose] [--commit] <mount_point|block_device>" >&2
++	echo "Usage:  $0 [--max-ranges <num>] [--verbose] [--commit] <mount_point|block_device>" >&2
+ 	echo "   Eg:  $0 /dev/sda1" >&2
+ 	echo >&2
+ 	exit 1
+@@ -44,6 +44,7 @@
+ 
+ export verbose=0
+ commit=""
++max_ranges=-1
+ destroy_me=""
+ argc=$#
+ arg=""
+@@ -51,6 +52,10 @@
+ 		commit=yes
+ 	elif [ "$1" = "--verbose" ]; then
+ 		verbose=$((verbose + 1))
++	elif [ "$1" = "--max-ranges" -a $argc -gt 1 ]; then
++		max_ranges=$2
++		argc=$((argc - 1))
++		shift
+ 	elif [ "$1" = "" ]; then
+ 		usage_error
+ 	else
+@@ -499,6 +550,18 @@
+ 	fi
+ fi
+ 
++## Different SSD's have a different maximum number of ranges they'll accept
++## in a single TRIM command.
++if [ $max_ranges -le 0 ] ; then
++	model=`$HDPARM -I $rawdev | $GAWK '/Model Number/ { print $NF }'`
++	case "$model" in
++		SSDSA[12]*)  max_ranges=512 ;;	# Intel X18-M/X25-M
++		OCZ-VERTEX2) max_ranges=64 ;;	# OCZ Vertex2
++		*)           max_ranges=65535
++	esac
++fi
++[ $verbose -gt 0 ] && echo "max-ranges = $max_ranges"
++
+ ## All ready.  Now let the user know exactly what we intend to do:
+ ##
+ mountstatus="$fstype non-mounted"
+@@ -608,7 +671,7 @@
+ 		nsectors += count;
+ 		while (count > 0) {
+ 			this_count  = (count > 65535) ? 65535 : count
+-			printf "%u:%u ", lba, this_count
++			printf "%u:%u \n", lba, this_count
+ 			if (verbose > 1)
+ 				printf "%u:%u ", lba, this_count > "/dev/stderr"
+ 			lba        += this_count
+@@ -695,6 +758,22 @@
+ 	-v verbose="$verbose"			\
+ 	-v xfs_blksects="$xfs_blksects"		\
+ 	-v xfs_agoffsets="$xfs_agoffsets"	\
+-	"$GAWKPROG" | $TRIM
++	"$GAWKPROG" | (
++		i=0
++		while read range ; do
++			ranges=$ranges" "$range
++			((i++))
++			if [ $i -ge $max_ranges ] ; then
++				[ $verbose -gt 0 ] && echo -e "Trim ranges:"$ranges"\n"         
++				echo $ranges | $TRIM
++				ranges=""
++				i=0
++			fi
++		done
++		if [ $i -gt 0 ] ; then
++			[ $verbose -gt 0 ] && echo -e "Trim ranges:"$ranges"\n"
++ 			echo $ranges | $TRIM
++		fi
++	)
+ 
+ do_cleanup $?
+
+ 	  	 



More information about the arch-commits mailing list