Subject: [alpine-aports] [PATCH] main/sshfs: add /sbin/setup-sshfs

From: Stuart Cardall <[email-masked]>
Date: Fri, 6 Feb 2015 17:30:37 +0000

revised patch with the setup script moved to /sbin
---
 main/sshfs/APKBUILD    | 16 ++++++++++++----
 main/sshfs/sshfs.setup | 29 +++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 4 deletions(-)
 create mode 100644 main/sshfs/sshfs.setup

diff --git a/main/sshfs/APKBUILD b/main/sshfs/APKBUILD
index 6b3c3b4..8727b06 100644
--- a/main/sshfs/APKBUILD
+++ b/main/sshfs/APKBUILD
@@ -8,7 +8,9 @@ arch="all"
 license="GPL"
 depends="openssh-client"
 makedepends="pkgconfig fuse-dev glib-dev"
-source="http://downloads.sourceforge.net/sourceforge/fuse/sshfs-fuse-$pkgver.tar.gz"
+source="http://downloads.sourceforge.net/sourceforge/fuse/sshfs-fuse-$pkgver.tar.gz
+	$pkgname.setup
+	"
 
 _builddir="$srcdir"/sshfs-fuse-$pkgver
 build () 
@@ -25,8 +27,14 @@ build ()
 package() {
 	cd "$_builddir"
 	make DESTDIR="$pkgdir" install || return 1
+	install -m755 -D "$srcdir"/$pkgname.setup \
+        "$pkgdir"/sbin/setup-$pkgname || return 1
+
 }
 
-md5sums="17494910db8383a366b1301e5f5148a9  sshfs-fuse-2.5.tar.gz"
-sha256sums="e9171452e5d0150b9c6a2158fd2e2dcefb5d5d03ba4d208949e00a3a46c6e63e  sshfs-fuse-2.5.tar.gz"
-sha512sums="48ae4008d10fe66b843ff1e891627f8262e00d064fec048c8c1189507e757994e81e4fa2deb4d8d56cff0d1818efe4a692494b9c48a01c6c79c626acefa1b53e  sshfs-fuse-2.5.tar.gz"
+md5sums="17494910db8383a366b1301e5f5148a9  sshfs-fuse-2.5.tar.gz
+006b92e3a95f7156e3f8f99493262d01  sshfs.setup"
+sha256sums="e9171452e5d0150b9c6a2158fd2e2dcefb5d5d03ba4d208949e00a3a46c6e63e  sshfs-fuse-2.5.tar.gz
+96722ab9c7cb961266d4f684ea3e3b53e3fcddd513f7273c7a29cd6af69e1b23  sshfs.setup"
+sha512sums="48ae4008d10fe66b843ff1e891627f8262e00d064fec048c8c1189507e757994e81e4fa2deb4d8d56cff0d1818efe4a692494b9c48a01c6c79c626acefa1b53e  sshfs-fuse-2.5.tar.gz
+4bfaa2d9da94a09c4c7f6f93242f5ff503beb4b273df14e39ae14eb0902d0b92a0359395c2674d8c5c0ecf077ee6ab70c93b6497947e53d0972c58f8f8e6c5e9  sshfs.setup"
diff --git a/main/sshfs/sshfs.setup b/main/sshfs/sshfs.setup
new file mode 100644
index 0000000..e89d5bc
--- /dev/null
+++ b/main/sshfs/sshfs.setup
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+NORMAL="\033[1;0m"
+STRONG="\033[1;1m"
+GREEN="\033[1;32m"
+
+print_strong() {
+	local prompt="${STRONG}$1 ${GREEN}$2${NORMAL}"
+        printf "${prompt} %s"
+}
+
+user_list=$(awk -F':' '{ if ( $3 >= 1000 && $1 != "nobody" ) print $1}' /etc/passwd)
+group=readproc
+
+if [ -n "$user_list" ]; then
+	print_strong "\nAdd normal system users to group '$group'" "(to allow sshfs mounting) [y/N]:"
+	read answer
+
+	case "$answer" in
+		y*|Y*) for user in $user_list; do
+				read -p "Add '$user' to Group '$group'?: [y/N] " answer
+				case "$answer" in
+				    y*|Y*) addgroup $user $group;;
+				esac
+		       done;;
+	esac
+fi
+exit 0
+
-- 
2.2.2

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---