Subject: [alpine-aports] [PATCH 1/2] testing/udevil: move post-install message

From: Stuart Cardall <[email-masked]>
Date: Wed, 6 May 2015 16:01:14 +0000

---
 testing/udevil/APKBUILD            | 19 ++++++++++++++-----
 testing/udevil/udevil.apk-post-msg | 11 +++++++++++
 testing/udevil/udevil.post-install | 22 ----------------------
 3 files changed, 25 insertions(+), 27 deletions(-)
 create mode 100644 testing/udevil/udevil.apk-post-msg
 delete mode 100644 testing/udevil/udevil.post-install

diff --git a/testing/udevil/APKBUILD b/testing/udevil/APKBUILD
index e5f7931..95257a2 100644
--- a/testing/udevil/APKBUILD
+++ b/testing/udevil/APKBUILD
@@ -8,10 +8,13 @@ url="http://ignorantguru.github.io/udevil"
 arch="all"
 license="GPL3+"
 makedepends="$depends_dev glib-dev udev-dev intltool"
-install="$pkgname.post-install $pkgname.pre-install"
+install="$pkgname.pre-install"
 subpackages="$pkgname-lang"
-source="$pkgname-$pkgver.tar.gz::https://github.com/IgnorantGuru/$pkgname/archive/$pkgver.tar.gz"
 pkggroups="plugdev"
+source="$pkgname-$pkgver.tar.gz::https://github.com/IgnorantGuru/$pkgname/archive/$pkgver.tar.gz
+	$pkgname.apk-post-msg
+	"
+
 _builddir="$srcdir"/$pkgname-$pkgver
 prepare() {
 	local i
@@ -36,8 +39,14 @@ package() {
 	make -j1 DESTDIR="$pkgdir" install || return 1
 	chown root:plugdev "$pkgdir"/usr/bin/udevil || return 1
         chmod u+s,go-s,o-x "$pkgdir"/usr/bin/udevil # remove SUID bit
+	mkdir -p "$pkgdir/usr/share/apk-tools/$pkgname"
+	install -m644 "$srcdir/$pkgname.apk-post-msg" "$pkgdir/usr/share/apk-tools/$pkgname/post-install-message" || return 1
+#	chmod ugo-s,ugo+x "$pkgdir"/usr/bin/udevil #remove SUID bit completely
 }
 
-md5sums="281aa065d92c679cb41728069e72b272  udevil-0.4.4.tar.gz"
-sha256sums="ad2fd8375bd62622718a04235e9772119459089938dbb78e657955e595822b7c  udevil-0.4.4.tar.gz"
-sha512sums="adce4916e06d1cc4965521abbcbc2901e53930691167f431cb18e28d3ef8bde740e95a6a5f40dfc58dfd7b4b661b4475d3dd2b6174a5d7a55ae7c65629b82327  udevil-0.4.4.tar.gz"
+md5sums="281aa065d92c679cb41728069e72b272  udevil-0.4.4.tar.gz
+cd426d9d4f6387eb6eca51c661525d1b  udevil.apk-post-msg"
+sha256sums="ad2fd8375bd62622718a04235e9772119459089938dbb78e657955e595822b7c  udevil-0.4.4.tar.gz
+be09f2c03a852eee3e2b94250664e8a63b33df631a098e500d730a56c839789a  udevil.apk-post-msg"
+sha512sums="adce4916e06d1cc4965521abbcbc2901e53930691167f431cb18e28d3ef8bde740e95a6a5f40dfc58dfd7b4b661b4475d3dd2b6174a5d7a55ae7c65629b82327  udevil-0.4.4.tar.gz
+060e17a1847a40f5ad1f19d803c14de8be2bcde205cf23fbbd73f0167c577f4be04749476e31e6e153033f0b92a70b264b553bb4cc3c077acdb39b117a0f9814  udevil.apk-post-msg"
diff --git a/testing/udevil/udevil.apk-post-msg b/testing/udevil/udevil.apk-post-msg
new file mode 100644
index 0000000..6c63d7e
--- /dev/null
+++ b/testing/udevil/udevil.apk-post-msg
@@ -0,0 +1,11 @@
+To mount / unmount devices without the root password: add your user account to the 'plugdev' group.
+
+Optional dependencies:
+
+zenity: 	(devmon popups)
+davfs2: 	(mount WebDAV resources)
+cifs-utils: 	(mounting samba shares)
+curlftpfs: 	(mounting ftp shares)
+nfs-utils: 	(mounting nfs shares)
+sshfs-fuse: 	(mounting sftp shares)
+eject: 		(eject via devmon)
diff --git a/testing/udevil/udevil.post-install b/testing/udevil/udevil.post-install
deleted file mode 100644
index f2485ed..0000000
--- a/testing/udevil/udevil.post-install
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/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\n"
-}
-
-print_strong "\nTo mount / unmount devices without the root password:" " add your user account to the 'plugdev' group."
-print_strong "\nOptional dependencies:"
-print_strong "\nzenity: " "	(devmon popups)"
-print_strong "davfs2: " "	(mount WebDAV resources)"
-print_strong "cifs-utils: " "	(mounting samba shares)"
-print_strong "curlftpfs: " "	(mounting ftp shares)"
-print_strong "nfs-utils: " "	(mounting nfs shares)"
-print_strong "sshfs-fuse: " "	(mounting sftp shares)"
-print_strong "eject: " "	(eject via devmon)"
-exit 0
-
-- 
2.4.0

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

---

From: Natanael Copa <[email-masked]>
Date: Thu, 7 May 2015 08:53:49 +0200

On Wed,  6 May 2015 16:01:14 +0000

>  _builddir="$srcdir"/$pkgname-$pkgver

I am still not convinced that we want implement this as an apk-post msg
either. Do we really want that?

For example, when I ran a test build of network manager i saw this:

...
(105/188) Installing modemmanager (1.4.6-r0)
Executing modemmanager-1.4.6-r0.post-install

If your USB modem shows up as a Flash drive when you plug it in: 
install 'usb-modeswitch' to automatically switch to USB modem mode whenever you plug it in. 

To control your modem without the root password:  add your user account to the 'plugdev' group.
 
(106/188) Installing modemmanager-lang (1.4.6-r0)
(107/188) Installing modemmanager-doc (1.4.6-r0)
...

Now, what I wanted to do was build network manager. The usb-modeswitch
message was just distracting.

It does not improve the quality of the logs either:
http://bld2.alpinelinux.org/buildlogs/build-edge-x86_64/testing/networkmanager/networkmanager-1.0.0-r1.log

Now I was thinking, what if I was actually installing networkmanager to
my laptop to manage my wifi connections. Would that message be useful?
No. I would think, "My USB modem? do I have an USB modem? why whould i
need a usb modem? Would something not work if I had USB modem?"

Now, if I actually would want to use an USB modem, then I'd rather
search the docs how to get it working.

I find information that is given when not requested is annoying, even
if the intention is to be helpful.

So I don't know if we want this to be an apk-tools feature.

Now, if this is not to be an apk-tools feature, then why would it be
stored into /usr/share/apk-tools? I know it was me who suggested it,
but on second thought, I don't think its a good idea, because the
message has theoretically nothing to with apk-tools.

I wonder if it would be an idea to ship them with -doc packages? If you
don't add the -doc package then you are likely not interested in any
documentation in first place.

What do you think of using /usr/share/doc/$pkgname/README.alpine for
this?

If we still want apk-post-messages to be an option, then we could have
an apk-post-messages package with a trigger which
monitors /usr/share/doc/*/README.alpine. The script could look something like:

#!/bin/sh

for i; do
	echo "########################################"
	echo "# $i:"
	cat $i
done

That way you could `apk add apk-post-messages` and the README.alpine
would be displayed at end of install.

What do you think of that?

We could also have a magic 'all-docs' package if this is installed then
we could pull in all relevant -doc packages with install_if. abuild
could automatically add:

  install_if="$pkgname=$pkgver-r$pkgrel all-docs"

when creating the -doc package.

So you could do: apk add all-docs apk-post-messages if you always
wanted those (imho) annoying post install messages. And you'd always
get man pages installed.

-nc

PS. the README.alpine are probably rather small so we could simply implement them in APKBUILD as:

	mkdir -p "$pkgdir"/usr/share/doc/$pkgname
	cat <<EOF
<message here>
EOF

> +	install -m644 "$srcdir/$pkgname.apk-post-msg"
> "$pkgdir/usr/share/apk-tools/$pkgname/post-install-message" || return
> 1 +#	chmod ugo-s,ugo+x "$pkgdir"/usr/bin/udevil #remove SUID
> bit completely } 
> -sha512sums="adce4916e06d1cc4965521abbcbc2901e53930691167f431cb18e28d3ef8bde740e95a6a5f40dfc58dfd7b4b661b4475d3dd2b6174a5d7a55ae7c65629b82327
> udevil-0.4.4.tar.gz" +md5sums="281aa065d92c679cb41728069e72b272
> udevil-0.4.4.tar.gz +cd426d9d4f6387eb6eca51c661525d1b
> udevil.apk-post-msg"
> +060e17a1847a40f5ad1f19d803c14de8be2bcde205cf23fbbd73f0167c577f4be04749476e31e6e153033f0b92a70b264b553bb4cc3c077acdb39b117a0f9814
> udevil.apk-post-msg" diff --git a/testing/udevil/udevil.apk-post-msg
> b/testing/udevil/udevil.apk-post-msg new file mode 100644 index
> 0000000..6c63d7e --- /dev/null +++
> b/testing/udevil/udevil.apk-post-msg @@ -0,0 +1,11 @@ +To mount /
> unmount devices without the root password: add your user account to
> the 'plugdev' group. + +Optional dependencies: + +zenity:
> (devmon popups) +davfs2: 	(mount WebDAV resources)
> diff --git a/testing/udevil/udevil.post-install
> b/testing/udevil/udevil.post-install deleted file mode 100644
> index f2485ed..0000000
> -print_strong "\nTo mount / unmount devices without the root
> password:" " add your user account to the 'plugdev' group."
> -print_strong "\nOptional dependencies:" -print_strong "\nzenity: "
> "	(devmon popups)" -print_strong "davfs2: " "	(mount
> WebDAV resources)" -print_strong "cifs-utils: " "	(mounting
> samba shares)" -print_strong "curlftpfs: " "	(mounting ftp
> shares)" -print_strong "nfs-utils: " "	(mounting nfs shares)"

---