Source: shadowsocks-libev
Severity: wishlist
Tags: patch

Dear Maintainer,

This package depends apg or pwgen to generate an initial password, but I
don't think it's needed to use an extra program.

perl-base is an Essential package, so every Debian based system has perl
interpreter. You can just use perl's rand function to do this. So that
this package has less depends and I can reduce the install size.

passwd=$(perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..12)')

This snippet is taken from mysql-5.7 package.
diff -Nru shadowsocks-libev-3.1.3+ds/debian/changelog 
shadowsocks-libev-3.1.3+ds/debian/changelog
--- shadowsocks-libev-3.1.3+ds/debian/changelog 2018-03-21 12:15:49.000000000 
+0800
+++ shadowsocks-libev-3.1.3+ds/debian/changelog 2018-05-28 13:29:05.000000000 
+0800
@@ -1,3 +1,10 @@
+shadowsocks-libev (3.1.3+ds-2.1) UNRELEASED; urgency=medium
+
+  * Drop apg and pwgen from Depends, use perl rand to generate
+    password.
+
+ -- Shengjing Zhu <i...@zhsj.me>  Mon, 28 May 2018 13:29:05 +0800
+
 shadowsocks-libev (3.1.3+ds-2) unstable; urgency=medium
 
   [ Sync from 3.1.3+ds-1ubuntu1 ]
diff -Nru shadowsocks-libev-3.1.3+ds/debian/control 
shadowsocks-libev-3.1.3+ds/debian/control
--- shadowsocks-libev-3.1.3+ds/debian/control   2018-03-21 12:09:19.000000000 
+0800
+++ shadowsocks-libev-3.1.3+ds/debian/control   2018-05-28 13:29:05.000000000 
+0800
@@ -26,7 +26,6 @@
 Breaks: shadowsocks (<< 1.5.3-2)
 Architecture: any
 Depends:
- apg | pwgen,
  libcap2-bin [linux-any],
  lsb-base (>= 3.0-6),
  ${misc:Depends},
diff -Nru shadowsocks-libev-3.1.3+ds/debian/shadowsocks-libev.postinst 
shadowsocks-libev-3.1.3+ds/debian/shadowsocks-libev.postinst
--- shadowsocks-libev-3.1.3+ds/debian/shadowsocks-libev.postinst        
2018-03-19 00:38:32.000000000 +0800
+++ shadowsocks-libev-3.1.3+ds/debian/shadowsocks-libev.postinst        
2018-05-28 13:29:05.000000000 +0800
@@ -32,14 +32,7 @@
                        echo "setcap not installed; ss-* will only be runnable 
by root."
                fi
                if [ ! -f /etc/shadowsocks-libev/config.json ]; then
-                       set +e
-                       pathfind apg
-                       if [ $? -eq 0 ]; then
-                               passwd=$(apg -n 1 -M ncl)
-                       else
-                               passwd=$(pwgen 12 1)
-                       fi
-                       set -e
+                       passwd=$(perl -e 'print 
map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..12)')
                        mkdir -p /etc/shadowsocks-libev
                        sed "s/barfoo!/$passwd/" 
/usr/share/shadowsocks-libev/config.json \
                                > /etc/shadowsocks-libev/config.json

Attachment: signature.asc
Description: PGP signature

Reply via email to