From a970fba0ca4918c5f41dfe0f738a9e8e873fd9e1 Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Thu, 8 Jun 2017 18:57:53 +0200
Subject: [PATCH] [enh] 'postinst' installation script must change for Duniter
 modules compliance

---
 release/arch/debian/package/DEBIAN/postinst | 24 +++++++++++++--------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/release/arch/debian/package/DEBIAN/postinst b/release/arch/debian/package/DEBIAN/postinst
index 8ab67ea17..8007a23db 100755
--- a/release/arch/debian/package/DEBIAN/postinst
+++ b/release/arch/debian/package/DEBIAN/postinst
@@ -1,28 +1,34 @@
 #!/bin/bash
 
 DUN_ROOT=/opt/duniter
-DUN_SOURCES=$DUN_ROOT/sources
-DUN_NW=$DUN_ROOT/nw
+DUN_SOURCES=$DUN_ROOT/
 mkdir -p $DUN_SOURCES
 
-# Duniter sources
+# Duniter sources extraction
 if [[ -f $DUN_ROOT/duniter-desktop.nw ]]; then
   unzip -q -d $DUN_SOURCES/ $DUN_ROOT/duniter-desktop.nw
+  rm -rf $DUN_ROOT/duniter-desktop.nw
 fi
 
 # Duniter-Desktop
-if [[ -f $DUN_ROOT/nw.nwb ]]; then
-  unzip -q -d $DUN_NW $DUN_ROOT/nw.nwb
-  cp -R $DUN_SOURCES/gui/* $DUN_NW/
-  chmod +x $DUN_NW/nw $DUN_NW/lib $DUN_NW/locales
-  ln -s $DUN_NW/nw /usr/bin/duniter-desktop
+if [[ -f $DUN_SOURCES/nw ]]; then
+  chmod +x $DUN_SOURCES/nw $DUN_SOURCES/lib $DUN_SOURCES/locales
+  chmod +rw $DUN_SOURCES/nw $DUN_SOURCES/lib $DUN_SOURCES/locales
+  ln -s $DUN_SOURCES/nw /usr/bin/duniter-desktop
   sed -i "s/DEB_PACKAGING=.*/DEB_PACKAGING=true/g" $DUN_SOURCES/duniter.sh
+  # Links for Node + NPM
+  cd $DUN_SOURCES
+  cd bin
+  ln -s ../lib/node_modules/npm/bin/npm-cli.js ./npm -f
+  cd ..
+  ln -s ./bin/node node -f
+  ln -s ./bin/npm npm -f
 fi
 
 # Duniter CLI executes with embedded node
 if [[ -d $DUN_SOURCES/node ]]; then
   chmod 755 $DUN_SOURCES/bin/duniter
-  sed -i "s/usr\/bin\/env node/opt\/duniter\/sources\/node\/bin\/node/g" $DUN_SOURCES/bin/duniter
+  sed -i "s/usr\/bin\/env node/opt\/duniter\/node\/bin\/node/g" $DUN_SOURCES/bin/duniter
   sed -i "s/DEB_PACKAGING=.*/DEB_PACKAGING=true/g" $DUN_SOURCES/duniter.sh
   ln -s $DUN_SOURCES/duniter.sh /usr/bin/duniter
 fi
-- 
GitLab