From 56076588cf55c7eb151734fb2ab1ce5027da7053 Mon Sep 17 00:00:00 2001
From: Andy Portmen <andy.portmen@gmail.com>
Date: Tue, 3 Nov 2020 10:53:31 +0100
Subject: [PATCH] use "/usr/share/native-client/" as the tmp directory during
 installation

---
 apt/DEBIAN/postinst                | 4 ++--
 apt/DEBIAN/preinst                 | 3 +++
 apt/opt/native-client/README       | 1 -
 apt/usr/share/native-client/README | 1 +
 prepare.sh                         | 4 ++--
 5 files changed, 8 insertions(+), 5 deletions(-)
 create mode 100755 apt/DEBIAN/preinst
 delete mode 100644 apt/opt/native-client/README
 create mode 100644 apt/usr/share/native-client/README

diff --git a/apt/DEBIAN/postinst b/apt/DEBIAN/postinst
index 8fdca17..cf24ced 100755
--- a/apt/DEBIAN/postinst
+++ b/apt/DEBIAN/postinst
@@ -1,4 +1,4 @@
 #!/bin/sh
 
-/opt/native-client/install.sh
-rm -rf /opt/native-client/
+/usr/share/native-client/install.sh
+rm -rf /usr/share/native-client
diff --git a/apt/DEBIAN/preinst b/apt/DEBIAN/preinst
new file mode 100755
index 0000000..94e2cc8
--- /dev/null
+++ b/apt/DEBIAN/preinst
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+rm -rf /usr/share/native-client
diff --git a/apt/opt/native-client/README b/apt/opt/native-client/README
deleted file mode 100644
index 0590127..0000000
--- a/apt/opt/native-client/README
+++ /dev/null
@@ -1 +0,0 @@
-temporary storage for native-client
diff --git a/apt/usr/share/native-client/README b/apt/usr/share/native-client/README
new file mode 100644
index 0000000..2b58867
--- /dev/null
+++ b/apt/usr/share/native-client/README
@@ -0,0 +1 @@
+temporary storage
diff --git a/prepare.sh b/prepare.sh
index 51bd2e4..b5153bc 100755
--- a/prepare.sh
+++ b/prepare.sh
@@ -11,7 +11,7 @@ cd ..
 zip "src_no_node.zip" -9 --symlinks -r * -x "*.DS_Store" -x "*/node/*/node" "windows/node/*/node.exe" "*.zip"
 
 # debian package
-unzip linux.zip -d apt/opt/native-client/
-cp apt/opt/native-client/uninstall.sh apt/DEBIAN/postrm
+cp -L -R linux/* apt/usr/share/native-client
+cp ./linux/uninstall.sh apt/DEBIAN/postrm
 dpkg-deb --build apt
 mv apt.deb linux.deb