VOL-793: Align with Luca's mkdebian changes

Change-Id: Id1d53a7d80e28cdad090ef51a6e6cf0fc37f3c7c
diff --git a/mkdebian/debian/asfvolt16.postinst b/mkdebian/debian/asfvolt16.postinst
index 8c4e661..ab3c7e7 100644
--- a/mkdebian/debian/asfvolt16.postinst
+++ b/mkdebian/debian/asfvolt16.postinst
@@ -1,9 +1,20 @@
 #!/bin/bash
 
-rm -rf /opt/bcm68620
-rm -rf  /broadcom
-rm -rf /run/bcm68620
+# Extract BAL driver
 tar zxf /tmp/release_asfvolt16.tar.gz -C / 2>&1 > /dev/null
+
+# Copy OpenOLT folder
+mv /tmp/openolt /broadcom
+
+# Copy libraries
+mv /tmp/libgrpc++_reflection.so.1 /usr/local/lib
+mv /tmp/libgrpc++.so.1 /usr/local/lib
+mv /tmp/libgrpc.so.6 /usr/local/lib
+
+# Init file
+#mv /tmp/voltha_init.sh /broadcom
+grep -q '\/opt\/bcm68620\/svk_init.sh' /etc/rc.local || sed -i -e '$i \/opt\/bcm68620\/svk_init.sh' /etc/rc.local
+
 source /root/.bashrc
-/sbin/ldconfig
-/opt/bcm68620/svk_init.sh
+cd /broadcom && /sbin/ldconfig
+/opt\/bcm68620\/svk_init.sh
diff --git a/mkdebian/debian/asfvolt16.postrm b/mkdebian/debian/asfvolt16.postrm
new file mode 100644
index 0000000..a666b17
--- /dev/null
+++ b/mkdebian/debian/asfvolt16.postrm
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+rm -rf /opt/bcm68620
+rm -rf /run/bcm68620
+
+rm -rf /broadcom
+
+rm -rf /usr/local/lib/libgrpc++_reflection.so.1
+rm -rf /usr/local/lib/libgrpc++.so.1
+rm -rf /usr/local/lib/libgrpc.so.6
+
+# Remove init scripts
+sed -i '\/opt\/bcm68620\/svk_init.sh/d' /etc/rc.local
+# sed -i '\/broadcom\/voltha_init.sh/d' /etc/rc.local
diff --git a/mkdebian/debian/asfvolt16.preinst b/mkdebian/debian/asfvolt16.preinst
index d2b2335..34bbd3b 100644
--- a/mkdebian/debian/asfvolt16.preinst
+++ b/mkdebian/debian/asfvolt16.preinst
@@ -2,11 +2,8 @@
 
 # kill CLI applications
 echo "kill running time application"
-[ -n "`pidof bcm_user_appl`" ] && killall bcm_user_appl
-[ -n "`pidof bcm.user`" ] && killall bcm.user
-[ -n "`pidof bcm_sdn_agent`" ] && killall bcm_sdn_agent
 [ -n "`pidof bal_core_dist`" ] && killall bal_core_dist 
-[ -n "`pidof voltha_bal_driver`" ] && killall voltha_bal_driver
+[ -n "`pidof openolt`" ] && killall openolt
 
 # unload drivers
 echo "unload kernel drivers"
@@ -24,3 +21,11 @@
 rm -rf /dev/linux-kernel-bde
 rm -rf /dev/coop_dba
 
+rm -rf /opt/bcm68620
+rm -rf /run/bcm68620
+
+rm -rf  /broadcom
+
+rm -rf /usr/local/lib/libgrpc++_reflection.so.1
+rm -rf /usr/local/lib/libgrpc++.so.1
+rm -rf /usr/local/lib/libgrpc.so.5
diff --git a/mkdebian/debian/rules b/mkdebian/debian/rules
index dbb836f..b2906d4 100755
--- a/mkdebian/debian/rules
+++ b/mkdebian/debian/rules
@@ -27,9 +27,13 @@
 override_dh_auto_install: 
 	mkdir -p $(DEB_DH_INSTALL_SOURCEDIR)/tmp
 	cp -a $(CURDIR)/debian/release_asfvolt16.tar.gz $(DEB_DH_INSTALL_SOURCEDIR)/tmp
+	cp -a $(CURDIR)/debian/libgrpc++_reflection.so.1 $(DEB_DH_INSTALL_SOURCEDIR)/tmp
+	cp -a $(CURDIR)/debian/libgrpc++.so.1 $(DEB_DH_INSTALL_SOURCEDIR)/tmp
+	cp -a $(CURDIR)/debian/libgrpc.so.6 $(DEB_DH_INSTALL_SOURCEDIR)/tmp
+	cp -a $(CURDIR)/debian/openolt $(DEB_DH_INSTALL_SOURCEDIR)/tmp
 
-#override_dh_shlibdeps:
-#	dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info -l$(ONLP_LIB_PATH):$(OFDPA_LIB_PATH)
+override_dh_shlibdeps:
+	dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info -l$(ONLP_LIB_PATH):$(OFDPA_LIB_PATH)
 
 # avoid auto strip for debug ofagentapp.dbg
 #
@@ -65,3 +69,4 @@
 	@echo ONLP_LIB_PATH=$(ONLP_LIB_PATH)
 #	@echo OFDPA_LIB_PATH=$(OFDPA_LIB_PATH)
 #	@echo OFDPA_BIN_PATH=$(OFDPA_BIN_PATH)
+