From c2211dc51e98fa27d565c44179c3044723e69253 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@openwrt.org>
Date: Thu, 23 Nov 2006 00:29:07 +0000
Subject: [PATCH] replace lots of manual install commands with INSTALL_*
 variables

SVN-Revision: 5624
---
 package/alsa/Makefile           |  8 ++---
 package/ar7-atm/Makefile        |  4 +--
 package/arptables/Makefile      |  2 +-
 package/base-files/Makefile     |  6 ++--
 package/bridge/Makefile         |  4 +--
 package/broadcom-wl/Makefile    | 22 ++++++------
 package/comgt/Makefile          | 34 +++++++++---------
 package/dnsmasq/Makefile        | 12 +++----
 package/dropbear/Makefile       | 18 +++++-----
 package/ebtables/Makefile       | 18 +++++-----
 package/fuse/Makefile           | 10 +++---
 package/gdbserver/Makefile      |  2 +-
 package/gmp/Makefile            |  2 +-
 package/haserl/Makefile         |  4 +--
 package/hostap-utils/Makefile   | 14 ++++----
 package/hostap/Makefile         |  4 +--
 package/hostapd/Makefile        | 10 +++---
 package/iproute2/Makefile       |  8 ++---
 package/ipsec-tools/Makefile    |  6 ++--
 package/iptables/Makefile       | 26 +++++++-------
 package/isakmpd/Makefile        |  2 +-
 package/keynote/Makefile        |  2 +-
 package/libpcap/Makefile        |  2 +-
 package/linux-atm/Makefile      |  8 ++---
 package/madwifi/Makefile        |  2 +-
 package/mtd/Makefile            |  4 +--
 package/nvram/Makefile          |  6 ++--
 package/openssl/Makefile        | 10 +++---
 package/openswan/Makefile       |  2 +-
 package/pcmcia-cs/Makefile      |  4 +--
 package/ppp/Makefile            | 64 ++++++++++++++++-----------------
 package/pptp/Makefile           | 12 +++----
 package/pwc/Makefile            |  4 +--
 package/robocfg/Makefile        |  4 +--
 package/rt2x00/Makefile         |  4 +--
 package/shfs/Makefile           |  6 ++--
 package/spca5xx/Makefile        |  2 +-
 package/switch/Makefile         |  8 ++---
 package/ueagle-atm/Makefile     |  6 ++--
 package/util-linux/Makefile     |  2 +-
 package/wireless-tools/Makefile |  8 ++---
 package/wlcompat/Makefile       |  6 ++--
 package/wpa_supplicant/Makefile |  4 +--
 package/yamonenv/Makefile       |  2 +-
 package/zd1211/Makefile         |  4 +--
 package/zlib/Makefile           |  2 +-
 46 files changed, 197 insertions(+), 197 deletions(-)

diff --git a/package/alsa/Makefile b/package/alsa/Makefile
index 2ac0b9433b9..7bd155078ed 100644
--- a/package/alsa/Makefile
+++ b/package/alsa/Makefile
@@ -72,11 +72,11 @@ define Build/Compile
 endef
 
 define Package/kmod-alsa/install
-	install -d -m0755 $(1)/lib/modules/$(LINUX_VERSION)
-	install -m0644 $(PKG_BUILD_DIR)/modules/*.$(LINUX_KMOD_SUFFIX) \
+	$(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION)
+	$(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/*.$(LINUX_KMOD_SUFFIX) \
 		$(1)/lib/modules/$(LINUX_VERSION)/
-	install -d -m0755 $(1)/etc/modules.d
-	install -m0644 ./files/alsa.modules $(1)/etc/modules.d/70-alsa
+	$(INSTALL_DIR) $(1)/etc/modules.d
+	$(INSTALL_DATA) ./files/alsa.modules $(1)/etc/modules.d/70-alsa
 endef
 
 $(eval $(call BuildPackage,kmod-alsa))
diff --git a/package/ar7-atm/Makefile b/package/ar7-atm/Makefile
index 25ef3728d42..03bd5c119a4 100644
--- a/package/ar7-atm/Makefile
+++ b/package/ar7-atm/Makefile
@@ -47,11 +47,11 @@ define Build/Compile
 endef
 
 define KernelPackage/sangam-atm-annex-a/install
-	install -m0644 $(PKG_BUILD_DIR)/ar0700xx_a.bin $(1)/lib/modules/ar0700xx.bin
+	$(INSTALL_DATA) $(PKG_BUILD_DIR)/ar0700xx_a.bin $(1)/lib/modules/ar0700xx.bin
 endef
 
 define KernelPackage/sangam-atm-annex-b/install
-	install -m0644 $(PKG_BUILD_DIR)/ar0700xx_b.bin $(1)/lib/modules/ar0700xx.bin
+	$(INSTALL_DATA) $(PKG_BUILD_DIR)/ar0700xx_b.bin $(1)/lib/modules/ar0700xx.bin
 endef
 
 $(eval $(call KernelPackage,sangam-atm-annex-a))
diff --git a/package/arptables/Makefile b/package/arptables/Makefile
index 7c2f8a9dd04..ac3639a0fbe 100644
--- a/package/arptables/Makefile
+++ b/package/arptables/Makefile
@@ -36,7 +36,7 @@ define Build/Compile
 endef
 
 define Package/arptables/install
-	install -m0755 -d $(1)/usr/sbin
+	$(INSTALL_DIR) $(1)/usr/sbin
 	$(CP) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
 endef
 
diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 62859294367..16c6dc1eb82 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -125,18 +125,18 @@ define Package/base-files$(TARGET)/install
 endef
 
 define Package/libgcc/install
-	install -m0755 -d $(1)/lib
+	$(INSTALL_DIR) $(1)/lib
 	$(CP) $(STAGING_DIR)/lib/libgcc_s.so.* $(1)/lib/
 endef
 
 define Package/libpthread/install
-	install -m0755 -d $(1)/lib
+	$(INSTALL_DIR) $(1)/lib
 	$(CP) $(STAGING_DIR)/lib/libpthread.so.* $(1)/lib/
 	$(CP) $(STAGING_DIR)/lib/libpthread-$(UCLIBC_VERSION).so $(1)/lib/
 endef
 
 define Package/uclibc/install
-	install -m0755 -d $(1)/lib
+	$(INSTALL_DIR) $(1)/lib
 	for file in ld-uClibc libc libcrypt libdl libm libnsl libresolv librt libuClibc libutil; do \
 		$(CP) $(STAGING_DIR)/lib/$$$$file.so.* $(1)/lib/; \
 		$(CP) $(STAGING_DIR)/lib/$$$$file-$(UCLIBC_VERSION).so $(1)/lib/; \
diff --git a/package/bridge/Makefile b/package/bridge/Makefile
index 07149fdee2e..0091af5a233 100644
--- a/package/bridge/Makefile
+++ b/package/bridge/Makefile
@@ -38,8 +38,8 @@ define Build/Configure
 endef
 
 define Package/bridge/install
-	install -m0755 -d $(1)/usr/sbin
-	install -m0755 $(PKG_BUILD_DIR)/brctl/brctl $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/brctl/brctl $(1)/usr/sbin/
 endef
 
 $(eval $(call BuildPackage,bridge))
diff --git a/package/broadcom-wl/Makefile b/package/broadcom-wl/Makefile
index b1a3573b170..769cfe8eabc 100644
--- a/package/broadcom-wl/Makefile
+++ b/package/broadcom-wl/Makefile
@@ -107,10 +107,10 @@ define Build/Compile
 endef
 
 define wl_template
-	install -d -m0755 $(1)/etc/modules.d
+	$(INSTALL_DIR) $(1)/etc/modules.d
 	echo "wl$(2)" > $(1)/etc/modules.d/20-wl$(2)
-	install -d -m0755 $(1)/lib/modules/$(LINUX_VERSION)
-	install -m0644 $(PKG_BUILD_DIR)/kmod/wl$(2).o $(PKG_BUILD_DIR)/kmod/wl$(2).o.patch $(1)/lib/modules/$(LINUX_VERSION)/
+	$(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION)
+	$(INSTALL_DATA) $(PKG_BUILD_DIR)/kmod/wl$(2).o $(PKG_BUILD_DIR)/kmod/wl$(2).o.patch $(1)/lib/modules/$(LINUX_VERSION)/
 endef
 
 define Package/kmod-brcm-wl/install
@@ -123,20 +123,20 @@ endef
 
 define Package/wlc/install
 	$(CP) ./files/* $(1)/
-	install -d -m0755 $(1)/sbin
-	install -m0755 $(PKG_BUILD_DIR)/wlc/wlc $(1)/sbin/
+	$(INSTALL_DIR) $(1)/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/wlc/wlc $(1)/sbin/
 endef
 
 define Package/wl/install
-	install -d -m0755 $(1)/usr/sbin
-	install -m0755 $(PKG_BUILD_DIR)/wl $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/wl $(1)/usr/sbin/
 endef
 
 define Package/nas/install
-	install -d -m0755 $(1)/usr/lib
-	install -m0755 $(PKG_BUILD_DIR)/libbcmcrypto.so $(1)/usr/lib/
-	install -d -m0755 $(1)/usr/sbin
-	install -m0755 $(PKG_BUILD_DIR)/nas $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/libbcmcrypto.so $(1)/usr/lib/
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/nas $(1)/usr/sbin/
 	ln -sf nas $(1)/usr/sbin/nas4not
 	ln -sf nas $(1)/usr/sbin/nas4wds
 endef
diff --git a/package/comgt/Makefile b/package/comgt/Makefile
index 82a2e2fe397..d22b72c53aa 100644
--- a/package/comgt/Makefile
+++ b/package/comgt/Makefile
@@ -42,23 +42,23 @@ define Build/Compile
 endef
 	
 define Package/comgt/install
-	install -d -m0755 $(1)/usr/bin
-	install -m0755 $(PKG_BUILD_DIR)/gcom $(1)/usr/bin/
-	install -d -m0755 $(1)/etc/ppp
-	install -m0755 ./files/3g.connect $(1)/etc/ppp/3g.connect
-	install -d -m0755 $(1)/etc/chatscripts
-	install -m0644 ./files/3g.chat $(1)/etc/chatscripts/3g.chat
-	install -d -m0755 $(1)/lib/network
-	install -m0644 ./files/3g.sh $(1)/lib/network/3g.sh
-	install -d -m0755 $(1)/etc/hotplug.d/button
-	install -m0644 ./files/3g.button $(1)/etc/hotplug.d/button/05-3g
-	install -d -m0755 $(1)/etc/hotplug.d/iface
-	install -m0644 ./files/3g.iface $(1)/etc/hotplug.d/iface/05-3g
-	install -d -m0755 $(1)/etc/gcom
-	install -m0644 ./files/setpin.gcom $(1)/etc/gcom/setpin.gcom
-	install -m0644 ./files/setmode.gcom $(1)/etc/gcom/setmode.gcom
-	install -m0644 ./files/getcardinfo.gcom $(1)/etc/gcom/getcardinfo.gcom
-	install -m0644 ./files/getstrength.gcom $(1)/etc/gcom/getstrength.gcom
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/gcom $(1)/usr/bin/
+	$(INSTALL_DIR) $(1)/etc/ppp
+	$(INSTALL_BIN) ./files/3g.connect $(1)/etc/ppp/3g.connect
+	$(INSTALL_DIR) $(1)/etc/chatscripts
+	$(INSTALL_DATA) ./files/3g.chat $(1)/etc/chatscripts/3g.chat
+	$(INSTALL_DIR) $(1)/lib/network
+	$(INSTALL_DATA) ./files/3g.sh $(1)/lib/network/3g.sh
+	$(INSTALL_DIR) $(1)/etc/hotplug.d/button
+	$(INSTALL_DATA) ./files/3g.button $(1)/etc/hotplug.d/button/05-3g
+	$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+	$(INSTALL_DATA) ./files/3g.iface $(1)/etc/hotplug.d/iface/05-3g
+	$(INSTALL_DIR) $(1)/etc/gcom
+	$(INSTALL_DATA) ./files/setpin.gcom $(1)/etc/gcom/setpin.gcom
+	$(INSTALL_DATA) ./files/setmode.gcom $(1)/etc/gcom/setmode.gcom
+	$(INSTALL_DATA) ./files/getcardinfo.gcom $(1)/etc/gcom/getcardinfo.gcom
+	$(INSTALL_DATA) ./files/getstrength.gcom $(1)/etc/gcom/getstrength.gcom
 endef
 
 $(eval $(call BuildPackage,comgt))
diff --git a/package/dnsmasq/Makefile b/package/dnsmasq/Makefile
index e4d73332fdd..e6af5672fa2 100644
--- a/package/dnsmasq/Makefile
+++ b/package/dnsmasq/Makefile
@@ -43,12 +43,12 @@ define Build/Compile
 endef
 
 define Package/dnsmasq/install
-	install -m0755 -d $(1)/usr/sbin
-	install -m0755 $(PKG_BUILD_DIR)/src/dnsmasq $(1)/usr/sbin/
-	install -m0755 -d $(1)/etc
-	install -m0644 ./files/dnsmasq.conf $(1)/etc/dnsmasq.conf
-	install -m0755 -d $(1)/etc/init.d
-	install -m0755 ./files/dnsmasq.init $(1)/etc/init.d/dnsmasq
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/dnsmasq $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/etc
+	$(INSTALL_DATA) ./files/dnsmasq.conf $(1)/etc/dnsmasq.conf
+	$(INSTALL_DIR) $(1)/etc/init.d
+	$(INSTALL_BIN) ./files/dnsmasq.init $(1)/etc/init.d/dnsmasq
 endef
 
 $(eval $(call BuildPackage,dnsmasq))
diff --git a/package/dropbear/Makefile b/package/dropbear/Makefile
index 1f4e47d4e72..26a7616e996 100644
--- a/package/dropbear/Makefile
+++ b/package/dropbear/Makefile
@@ -97,23 +97,23 @@ define Build/Compile
 endef
 	
 define Package/dropbear/install
-	install -d -m0755 $(1)/usr/sbin
-	install -m0755 $(PKG_BUILD_DIR)/dropbearmulti \
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti \
 		$(1)/usr/sbin/dropbear
-	install -d -m0755 $(1)/usr/bin
+	$(INSTALL_DIR) $(1)/usr/bin
 	ln -sf ../sbin/dropbear $(1)/usr/bin/scp
 	ln -sf ../sbin/dropbear $(1)/usr/bin/ssh
 	ln -sf ../sbin/dropbear $(1)/usr/bin/dbclient
 	ln -sf ../sbin/dropbear $(1)/usr/bin/dropbearkey
-	install -d -m0755 $(1)/etc/config
-	install -m0755 ./files/dropbear.config $(1)/etc/config/dropbear
-	install -d -m0755 $(1)/etc/init.d
-	install -m0755 ./files/dropbear.init $(1)/etc/init.d/dropbear
+	$(INSTALL_DIR) $(1)/etc/config
+	$(INSTALL_BIN) ./files/dropbear.config $(1)/etc/config/dropbear
+	$(INSTALL_DIR) $(1)/etc/init.d
+	$(INSTALL_BIN) ./files/dropbear.init $(1)/etc/init.d/dropbear
 endef
 
 define Package/dropbearconvert/install
-	install -d -m0755 $(1)/usr/bin
-	install -m0755 $(PKG_BUILD_DIR)/dropbearconvert \
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearconvert \
 		$(1)/usr/bin/dropbearconvert
 endef
 
diff --git a/package/ebtables/Makefile b/package/ebtables/Makefile
index a0e53a48d37..41c1e0fcda6 100644
--- a/package/ebtables/Makefile
+++ b/package/ebtables/Makefile
@@ -29,15 +29,15 @@ define Package/ebtables
 endef
 
 define Package/ebtables/install
-	install -d -m0755 $(1)/etc
-	install -m0644 $(PKG_BUILD_DIR)/ethertypes $(1)/etc/
-	install -d -m0755 $(1)/usr/lib/ebtables
-	install -m0755 $(PKG_BUILD_DIR)/lib*.so $(1)/usr/lib/
-	install -m0755 $(PKG_BUILD_DIR)/extensions/*.so $(1)/usr/lib/ebtables/
-	install -d -m0755 $(1)/usr/sbin
-	install -m0755 $(PKG_BUILD_DIR)/ebtables $(1)/usr/sbin/
-	install -m0755 $(PKG_BUILD_DIR)/ebtables-save $(1)/usr/sbin/
-	install -m0755 $(PKG_BUILD_DIR)/ebtables-restore $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/etc
+	$(INSTALL_DATA) $(PKG_BUILD_DIR)/ethertypes $(1)/etc/
+	$(INSTALL_DIR) $(1)/usr/lib/ebtables
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib*.so $(1)/usr/lib/
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/extensions/*.so $(1)/usr/lib/ebtables/
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/ebtables $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/ebtables-save $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/ebtables-restore $(1)/usr/sbin/
 endef
 
 $(eval $(call BuildPackage,ebtables))
diff --git a/package/fuse/Makefile b/package/fuse/Makefile
index 8c6b2ce5647..fda8f1c514d 100644
--- a/package/fuse/Makefile
+++ b/package/fuse/Makefile
@@ -129,22 +129,22 @@ define Build/UninstallDev
 endef
 
 define Package/fuse-utils/install
-	install -d -m0755 $(1)/usr/bin
+	$(INSTALL_DIR) $(1)/usr/bin
 	$(CP) $(PKG_INSTALL_DIR)/usr/bin/fusermount $(1)/usr/bin/
 endef
 
 define Package/kmod-fuse/install
-	install -d -m0755 $(1)/lib/modules/$(LINUX_VERSION)
+	$(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION)
 	$(CP) $(PKG_INSTALL_DIR)/lib/modules/$(LINUX_VERSION)/kernel/fs/fuse/fuse.$(LINUX_KMOD_SUFFIX) \
 		$(1)/lib/modules/$(LINUX_VERSION)/
-	install -d -m0755 $(1)/usr/lib
+	$(INSTALL_DIR) $(1)/usr/lib
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libfuse.so.* $(1)/usr/lib/
-	install -d -m0755 $(1)/usr/bin
+	$(INSTALL_DIR) $(1)/usr/bin
 	$(CP) $(PKG_INSTALL_DIR)/usr/bin/fusermount $(1)/usr/bin/
 endef
 
 define Package/libfuse/install
-	install -d -m0755 $(1)/usr/lib
+	$(INSTALL_DIR) $(1)/usr/lib
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libfuse.so.* $(1)/usr/lib/
 endef
 
diff --git a/package/gdbserver/Makefile b/package/gdbserver/Makefile
index c07eaf99279..d4d149102df 100644
--- a/package/gdbserver/Makefile
+++ b/package/gdbserver/Makefile
@@ -61,7 +61,7 @@ define Build/Compile
 endef
 
 define Package/gdbserver/install	
-	install -m0755 -d $(1)/usr/bin
+	$(INSTALL_DIR) $(1)/usr/bin
 	$(CP) $(PKG_INSTALL_DIR)/usr/bin/gdbserver $(1)/usr/bin/
 endef
 
diff --git a/package/gmp/Makefile b/package/gmp/Makefile
index 1470ead89aa..5a58f8f8dac 100644
--- a/package/gmp/Makefile
+++ b/package/gmp/Makefile
@@ -58,7 +58,7 @@ define Build/UninstallDev
 endef
 
 define Package/libgmp/install
-	install -m0755 -d $(1)/usr/lib
+	$(INSTALL_DIR) $(1)/usr/lib
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libgmp.so.* $(1)/usr/lib/
 endef
 
diff --git a/package/haserl/Makefile b/package/haserl/Makefile
index 83a7d848f85..15b64f7839a 100644
--- a/package/haserl/Makefile
+++ b/package/haserl/Makefile
@@ -29,8 +29,8 @@ define Package/haserl
 endef
 
 define Package/haserl/install
-	install -m0755 -d $(1)/usr/bin
-	install -m0755 $(PKG_BUILD_DIR)/src/haserl $(1)/usr/bin/
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/haserl $(1)/usr/bin/
 endef
 
 $(eval $(call BuildPackage,haserl))
diff --git a/package/hostap-utils/Makefile b/package/hostap-utils/Makefile
index 68afdd2709d..4f4be05890b 100644
--- a/package/hostap-utils/Makefile
+++ b/package/hostap-utils/Makefile
@@ -36,13 +36,13 @@ define Build/Compile
 endef
 
 define Package/hostap-utils/install	
-	install -m0755 -d $(1)/usr/sbin
-	install -m0755 $(PKG_BUILD_DIR)/hostap_crypt_conf $(1)/usr/sbin/
-	install -m0755 $(PKG_BUILD_DIR)/hostap_diag $(1)/usr/sbin/
-	install -m0755 $(PKG_BUILD_DIR)/hostap_io_debug $(1)/usr/sbin/
-	install -m0755 $(PKG_BUILD_DIR)/hostap_rid $(1)/usr/sbin/
-	install -m0755 $(PKG_BUILD_DIR)/prism2_srec $(1)/usr/sbin/
-	install -m0755 $(PKG_BUILD_DIR)/split_combined_hex $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/hostap_crypt_conf $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/hostap_diag $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/hostap_io_debug $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/hostap_rid $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/prism2_srec $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/split_combined_hex $(1)/usr/sbin/
 endef
 
 $(eval $(call BuildPackage,hostap-utils))
diff --git a/package/hostap/Makefile b/package/hostap/Makefile
index ae206145586..4cc77a2177e 100644
--- a/package/hostap/Makefile
+++ b/package/hostap/Makefile
@@ -121,13 +121,13 @@ ifeq ($(KERNEL),2.4)
   endef
 
   define Package/kmod-hostap-pci/install
-	install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION)
+	$(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION)
 	$(CP) \
 		$(1)/lib/modules/$(LINUX_VERSION)/
   endef
 
   define Package/kmod-hostap-plx/install
-	install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION)
+	$(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION)
 	$(CP) \
 		$(PKG_BUILD_DIR)/driver/modules/hostap_plx.$(LINUX_KMOD_SUFFIX) \
 		$(1)/lib/modules/$(LINUX_VERSION)/
diff --git a/package/hostapd/Makefile b/package/hostapd/Makefile
index 659f3e5ea3a..5c4ba22458f 100644
--- a/package/hostapd/Makefile
+++ b/package/hostapd/Makefile
@@ -84,10 +84,10 @@ define Package/InstallTemplate
 		rm -f $(PKG_BUILD_DIR)/.built; \
 		$(MAKE) $(PKG_BUILD_DIR)/.built; \
 	fi
-	install -m0755 -d $$(1)/etc
+	$(INSTALL_DIR) $$(1)/etc
 	install -m0600 $(PKG_BUILD_DIR)_$(2)/madwifi.conf $$(1)/etc/hostapd.conf
-	install -m0755 -d $$(1)/usr/sbin
-	install -m0755 $(PKG_BUILD_DIR)_$(2)/hostapd $$(1)/usr/sbin/
+	$(INSTALL_DIR) $$(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)_$(2)/hostapd $$(1)/usr/sbin/
 endef
 
 define Package/Template
@@ -120,8 +120,8 @@ define Build/Clean
 endef
 
 define Package/hostapd-utils/install
-	install -m0755 -d $(1)/usr/sbin
-	install -m0755 $(PKG_BUILD_DIR)/hostapd_cli $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd_cli $(1)/usr/sbin/
 endef
 
 $(eval $(call Package/Template,hostapd,default))
diff --git a/package/iproute2/Makefile b/package/iproute2/Makefile
index 3aa46bb8386..645d0349f49 100644
--- a/package/iproute2/Makefile
+++ b/package/iproute2/Makefile
@@ -55,13 +55,13 @@ define Build/Compile
 endef
 
 define Package/ip/install
-	install -d -m0755 $(1)/usr/sbin
-	install -m0755 $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
 endef
 
 define Package/tc/install
-	install -d -m0755 $(1)/usr/sbin
-	install -m0755 $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
 endef
 
 $(eval $(call BuildPackage,ip))
diff --git a/package/ipsec-tools/Makefile b/package/ipsec-tools/Makefile
index 2ae6b27eb59..586390a281d 100644
--- a/package/ipsec-tools/Makefile
+++ b/package/ipsec-tools/Makefile
@@ -84,12 +84,12 @@ define Build/Compile
 endef
 
 define Package/ipsec-tools/install
-	install -d -m0755 $(1)/etc
+	$(INSTALL_DIR) $(1)/etc
 	install -m0600 $(PKG_BUILD_DIR)/src/racoon/samples/racoon.conf $(1)/etc/
-	install -d -m0755 $(1)/usr/lib/
+	$(INSTALL_DIR) $(1)/usr/lib/
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libipsec.so.* $(1)/usr/lib/
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libracoon.so.* $(1)/usr/lib/
-	install -d -m0755 $(1)/usr/sbin
+	$(INSTALL_DIR) $(1)/usr/sbin
 	$(CP) $(PKG_INSTALL_DIR)/usr/sbin/plainrsa-gen $(1)/usr/sbin/
 	$(CP) $(PKG_INSTALL_DIR)/usr/sbin/racoon $(1)/usr/sbin/
 	$(CP) $(PKG_INSTALL_DIR)/usr/sbin/racoonctl $(1)/usr/sbin/
diff --git a/package/iptables/Makefile b/package/iptables/Makefile
index 5fb069f6de6..76014aa141a 100644
--- a/package/iptables/Makefile
+++ b/package/iptables/Makefile
@@ -191,30 +191,30 @@ define Build/UninstallDev
 endef
 
 define Package/iptables/install
-	install -d -m0755 $(1)/etc/config
-	install -m0644 ./files/firewall.config $(1)/etc/config/firewall
-	install -d -m0755 $(1)/etc/init.d
-	install -m0755 ./files/firewall.init $(1)/etc/init.d/firewall
-	install -m0755 ./files/firewall.user $(1)/etc/
-	install -d -m0755 $(1)/usr/lib
-	install -m0644 ./files/firewall.awk $(1)/usr/lib
-	install -d -m0755 $(1)/usr/sbin
+	$(INSTALL_DIR) $(1)/etc/config
+	$(INSTALL_DATA) ./files/firewall.config $(1)/etc/config/firewall
+	$(INSTALL_DIR) $(1)/etc/init.d
+	$(INSTALL_BIN) ./files/firewall.init $(1)/etc/init.d/firewall
+	$(INSTALL_BIN) ./files/firewall.user $(1)/etc/
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(INSTALL_DATA) ./files/firewall.awk $(1)/usr/lib
+	$(INSTALL_DIR) $(1)/usr/sbin
 	$(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(1)/usr/sbin/
-	install -d -m0755 $(1)/usr/lib/iptables
+	$(INSTALL_DIR) $(1)/usr/lib/iptables
 	(cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
 		$(CP) $(patsubst %,lib%.so,$(IPT_BUILTIN:xt_%=ipt_%)) $(1)/usr/lib/iptables/ \
 	)
 endef
 
 define Package/iptables-utils/install
-	install -d -m0755 $(1)/usr/sbin
+	$(INSTALL_DIR) $(1)/usr/sbin
 	$(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(1)/usr/sbin/
 endef
 
 define Package/ip6tables/install
-	install -d -m0755 $(1)/usr/sbin
+	$(INSTALL_DIR) $(1)/usr/sbin
 	$(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(1)/usr/sbin/
-	install -d -m0755 $(1)/usr/lib/iptables
+	$(INSTALL_DIR) $(1)/usr/lib/iptables
 	(cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
 		$(CP) libip6t_*.so $(1)/usr/lib/iptables/ \
 	)
@@ -222,7 +222,7 @@ endef
 
 define BuildPlugin
   define Package/$(1)/install
-	install -m0755 -d $$(1)/usr/lib/iptables
+	$(INSTALL_DIR) $$(1)/usr/lib/iptables
 	for m in $$(patsubst xt_%,ipt_%,$(2)); do \
 		$(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
 	done
diff --git a/package/isakmpd/Makefile b/package/isakmpd/Makefile
index a4e7ff7b033..00153fd7362 100644
--- a/package/isakmpd/Makefile
+++ b/package/isakmpd/Makefile
@@ -44,7 +44,7 @@ define Build/Compile
 endef
 
 define Package/isakmpd/install
-	install -d -m0755 $(1)/usr/sbin
+	$(INSTALL_DIR) $(1)/usr/sbin
 	$(CP) $(PKG_INSTALL_DIR)/* $(1)/
 endef
 
diff --git a/package/keynote/Makefile b/package/keynote/Makefile
index 38f1f6901d9..579300407bc 100644
--- a/package/keynote/Makefile
+++ b/package/keynote/Makefile
@@ -61,7 +61,7 @@ define Build/UninstallDev
 endef
 
 define Package/keynote/install
-	install -d -m0755 $(1)/usr/sbin
+	$(INSTALL_DIR) $(1)/usr/sbin
 	$(CP) $(PKG_BUILD_DIR)/keynote $(1)/usr/sbin/
 endef
 
diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile
index 93a090d3d6b..c33c034e8f0 100644
--- a/package/libpcap/Makefile
+++ b/package/libpcap/Makefile
@@ -89,7 +89,7 @@ define Build/UninstallDev
 endef
 
 define Package/libpcap/install
-	install -m0755 -d $(1)/usr/lib
+	$(INSTALL_DIR) $(1)/usr/lib
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.so.* $(1)/usr/lib/
 endef
 
diff --git a/package/linux-atm/Makefile b/package/linux-atm/Makefile
index ced3da69ef8..9aae0a0b0ed 100644
--- a/package/linux-atm/Makefile
+++ b/package/linux-atm/Makefile
@@ -73,15 +73,15 @@ define Build/UninstallDev
 endef
 
 define Package/linux-atm/install
-	install -d -m0755 $(1)/usr/lib
+	$(INSTALL_DIR) $(1)/usr/lib
 	cp -f $(PKG_INSTALL_DIR)/usr/lib/libatm.so.1 $(1)/usr/lib
 endef
 
 define Package/br2684ctl/install
-	install -d -m0755 $(1)/usr/sbin
+	$(INSTALL_DIR) $(1)/usr/sbin
 	$(CP) $(PKG_INSTALL_DIR)/usr/sbin/br2684ctl $(1)/usr/sbin/
-	install -d -m0755 $(1)/etc/hotplug.d/net
-	install -m0644 ./files/br2684.hotplug $(1)/etc/hotplug.d/net/30-br2684
+	$(INSTALL_DIR) $(1)/etc/hotplug.d/net
+	$(INSTALL_DATA) ./files/br2684.hotplug $(1)/etc/hotplug.d/net/30-br2684
 endef
 
 $(eval $(call BuildPackage,linux-atm))
diff --git a/package/madwifi/Makefile b/package/madwifi/Makefile
index 2d952d11486..dc06effa5be 100644
--- a/package/madwifi/Makefile
+++ b/package/madwifi/Makefile
@@ -138,7 +138,7 @@ define KernelPackage/madwifi/install
 	mkdir -p $(1)/etc/init.d
 	mkdir -p $(1)/lib/modules/$(LINUX_VERSION)
 	mkdir -p $(1)/usr/sbin
-	install -m0755 ./files/madwifi.init $(1)/etc/init.d/madwifi
+	$(INSTALL_BIN) ./files/madwifi.init $(1)/etc/init.d/madwifi
 	$(CP) $(PKG_BUILD_DIR)/tools/{madwifi_multi,80211debug,80211stats,athchans,athctrl,athdebug,athkey,athstats,wlanconfig} $(1)/usr/sbin/
 endef
 
diff --git a/package/mtd/Makefile b/package/mtd/Makefile
index 2a27f0f5c31..8444bd8029e 100644
--- a/package/mtd/Makefile
+++ b/package/mtd/Makefile
@@ -37,8 +37,8 @@ define Build/Compile
 endef
 
 define Package/mtd/install
-	install -d -m0755 $(1)/sbin
-	install -m0755 $(PKG_BUILD_DIR)/mtd $(1)/sbin/
+	$(INSTALL_DIR) $(1)/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/mtd $(1)/sbin/
 endef
 
 $(eval $(call BuildPackage,mtd))
diff --git a/package/nvram/Makefile b/package/nvram/Makefile
index ab33c115144..87e8b0659ea 100644
--- a/package/nvram/Makefile
+++ b/package/nvram/Makefile
@@ -40,10 +40,10 @@ define Build/UninstallDev
 endef
 
 define Package/nvram/install
-	install -d -m0755 $(1)/usr/lib
+	$(INSTALL_DIR) $(1)/usr/lib
 	$(CP) $(PKG_BUILD_DIR)/lib{nvram,shared}*.so $(1)/usr/lib/
-	install -d -m0755 $(1)/usr/sbin
-	install -m0755 $(PKG_BUILD_DIR)/nvram $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/nvram $(1)/usr/sbin/
 endef
 
 $(eval $(call BuildPackage,nvram))
diff --git a/package/openssl/Makefile b/package/openssl/Makefile
index 7bb31c8cb31..827c4415c00 100644
--- a/package/openssl/Makefile
+++ b/package/openssl/Makefile
@@ -115,18 +115,18 @@ define Build/UninstallDev
 endef
 
 define Package/libopenssl/install
-	install -d -m0755 $(1)/usr/lib
+	$(INSTALL_DIR) $(1)/usr/lib
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.so.* $(1)/usr/lib/
 	chmod 0644 $(1)/usr/lib/*
 endef
 
 define Package/openssl-util/install
-	install -d -m0755 $(1)/etc/ssl
+	$(INSTALL_DIR) $(1)/etc/ssl
 	$(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
-	install -d -m0755 $(1)/etc/ssl/certs
-	install -d -m0755 $(1)/etc/ssl/private
+	$(INSTALL_DIR) $(1)/etc/ssl/certs
+	$(INSTALL_DIR) $(1)/etc/ssl/private
 	chmod 0700 $(1)/etc/ssl/private
-	install -d -m0755 $(1)/usr/bin
+	$(INSTALL_DIR) $(1)/usr/bin
 	$(CP) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
 endef
 
diff --git a/package/openswan/Makefile b/package/openswan/Makefile
index b5adc542576..a644b20db0f 100644
--- a/package/openswan/Makefile
+++ b/package/openswan/Makefile
@@ -73,7 +73,7 @@ endef
 
 define Package/openswan/install
 	$(CP) $(PKG_INSTALL_DIR)/* $(1)
-	install -d -m0755 $(1)/etc/init.d
+	$(INSTALL_DIR) $(1)/etc/init.d
 	$(CP) ./files/ipsec.init $(1)/etc/init.d/ipsec
 	rm -rf $(1)/usr/share
 	rm -rf $(1)/usr/man
diff --git a/package/pcmcia-cs/Makefile b/package/pcmcia-cs/Makefile
index 78419de75d4..2e312fbf12a 100644
--- a/package/pcmcia-cs/Makefile
+++ b/package/pcmcia-cs/Makefile
@@ -58,9 +58,9 @@ define Build/Compile
 endef
 
 define Package/pcmcia-cs/install
-	install -d -m0755 $(1)/etc
+	$(INSTALL_DIR) $(1)/etc
 	$(CP) $(PKG_INSTALL_DIR)/etc/pcmcia $(1)/etc/
-	install -d -m0755 $(1)/usr/sbin
+	$(INSTALL_DIR) $(1)/usr/sbin
 	$(CP) $(PKG_INSTALL_DIR)/sbin/cardctl $(1)/usr/sbin/
 	$(CP) $(PKG_INSTALL_DIR)/sbin/cardmgr $(1)/usr/sbin/
 endef
diff --git a/package/ppp/Makefile b/package/ppp/Makefile
index 7d05db09af7..7f11f65c8cc 100644
--- a/package/ppp/Makefile
+++ b/package/ppp/Makefile
@@ -111,64 +111,64 @@ define Build/Compile
 endef
 
 define Package/ppp/install
-	install -d -m0755 $(1)/usr/lib/pppd/$(PKG_VERSION)
-	install -d -m0755 $(1)/usr/sbin
-	install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/pppd $(1)/usr/sbin/
-	install -d -m0755 $(1)/lib/network
-	install -m0755 ./files/ppp.sh $(1)/lib/network/
-	install -d -m0755 $(1)/etc/ppp
+	$(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION)
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pppd $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/lib/network
+	$(INSTALL_BIN) ./files/ppp.sh $(1)/lib/network/
+	$(INSTALL_DIR) $(1)/etc/ppp
 	install -m0600 ./files/etc/ppp/chap-secrets $(1)/etc/ppp/
-	install -m0644 ./files/etc/ppp/filter $(1)/etc/ppp/
-	install -m0755 ./files/etc/ppp/ip-up $(1)/etc/ppp/
-	install -d -m0755 $(1)/etc/ppp/ip-up.d
-	install -m0755 ./files/etc/ppp/ip-down $(1)/etc/ppp/
-	install -d -m0755 $(1)/etc/ppp/ip-down.d
-	install -m0644 ./files/etc/ppp/options $(1)/etc/ppp/
+	$(INSTALL_DATA) ./files/etc/ppp/filter $(1)/etc/ppp/
+	$(INSTALL_BIN) ./files/etc/ppp/ip-up $(1)/etc/ppp/
+	$(INSTALL_DIR) $(1)/etc/ppp/ip-up.d
+	$(INSTALL_BIN) ./files/etc/ppp/ip-down $(1)/etc/ppp/
+	$(INSTALL_DIR) $(1)/etc/ppp/ip-down.d
+	$(INSTALL_DATA) ./files/etc/ppp/options $(1)/etc/ppp/
 	ln -sf /tmp/resolv.conf $(1)/etc/ppp/resolv.conf
 endef
 	
 define Package/ppp-mod-pppoa/install
-	install -d -m0755 $(1)/usr/lib/pppd/$(PKG_VERSION)
-	install -m0755 $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/pppoatm.so \
+	$(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION)
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/pppoatm.so \
 		$(1)/usr/lib/pppd/$(PKG_VERSION)/
-	install -d -m0755 $(1)/lib/network
-	install -m0755 ./files/pppoa.sh $(1)/lib/network/
+	$(INSTALL_DIR) $(1)/lib/network
+	$(INSTALL_BIN) ./files/pppoa.sh $(1)/lib/network/
 endef
 
 define Package/ppp-mod-pppoe/install
-	install -d -m0755 $(1)/usr/lib/pppd/$(PKG_VERSION)
-	install -m0755 $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/rp-pppoe.so \
+	$(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION)
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/rp-pppoe.so \
 		$(1)/usr/lib/pppd/$(PKG_VERSION)/
-	install -d -m0755 $(1)/lib/network
-	install -m0755 ./files/pppoe.sh $(1)/lib/network/
+	$(INSTALL_DIR) $(1)/lib/network
+	$(INSTALL_BIN) ./files/pppoe.sh $(1)/lib/network/
 endef
 
 define Package/ppp-mod-radius/install
-	install -d -m0755 $(1)/usr/lib/pppd/$(PKG_VERSION)
-	install -m0755 $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/radius.so \
+	$(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION)
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/radius.so \
 		$(1)/usr/lib/pppd/$(PKG_VERSION)/
-	install -d -m0755 $(1)/etc/ppp
-	install -m0644 ./files/etc/ppp/radius.conf $(1)/etc/ppp/
-	install -d -m0755 $(1)/etc/ppp/radius
-	install -m0644 ./files/etc/ppp/radius/dictionary* \
+	$(INSTALL_DIR) $(1)/etc/ppp
+	$(INSTALL_DATA) ./files/etc/ppp/radius.conf $(1)/etc/ppp/
+	$(INSTALL_DIR) $(1)/etc/ppp/radius
+	$(INSTALL_DATA) ./files/etc/ppp/radius/dictionary* \
 		$(1)/etc/ppp/radius/
 	install -m0600 ./files/etc/ppp/radius/servers \
 		$(1)/etc/ppp/radius/
 endef
 
 define Package/chat/install
-	install -d -m0755 $(1)/usr/sbin
-	install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/chat $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/chat $(1)/usr/sbin/
 endef
 
 define Package/pppdump/install
-	install -d -m0755 $(1)/usr/sbin
-	install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/pppdump $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pppdump $(1)/usr/sbin/
 endef
 
 define Package/pppstats/install
-	install -d -m0755 $(1)/usr/sbin
-	install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/pppstats $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pppstats $(1)/usr/sbin/
 endef
 
 $(eval $(call BuildPackage,ppp))
diff --git a/package/pptp/Makefile b/package/pptp/Makefile
index bb0710419bf..081ff4e52ad 100644
--- a/package/pptp/Makefile
+++ b/package/pptp/Makefile
@@ -31,12 +31,12 @@ define Package/pptp
 endef
 
 define Package/pptp/install
-	install -d -m0755 $(1)/usr/sbin
-	install -m0755 $(PKG_BUILD_DIR)/pptp $(1)/usr/sbin/
-	install -d -m0755 $(1)/etc/ppp
-	install -m0644 ./files/options.pptp $(1)/etc/ppp/
-	install -d -m0755 $(1)/lib/network
-	install -m0755 ./files/pptp.sh $(1)/lib/network/
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/pptp $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/etc/ppp
+	$(INSTALL_DATA) ./files/options.pptp $(1)/etc/ppp/
+	$(INSTALL_DIR) $(1)/lib/network
+	$(INSTALL_BIN) ./files/pptp.sh $(1)/lib/network/
 endef
 
 $(eval $(call BuildPackage,pptp))
diff --git a/package/pwc/Makefile b/package/pwc/Makefile
index b2c281eed82..0b5925b4c8f 100644
--- a/package/pwc/Makefile
+++ b/package/pwc/Makefile
@@ -44,8 +44,8 @@ endef
 
 define Package/kmod-pwc/install
 	mkdir -p $(1)/etc/modules.d
-	install -m0644 ./files/pwc.modules $(1)/etc/modules.d/70-pwc
-	install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION)
+	$(INSTALL_DATA) ./files/pwc.modules $(1)/etc/modules.d/70-pwc
+	$(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION)
 	$(CP) $(PKG_BUILD_DIR)/pwc.$(LINUX_KMOD_SUFFIX) \
 		$(1)/lib/modules/$(LINUX_VERSION)/
 endef
diff --git a/package/robocfg/Makefile b/package/robocfg/Makefile
index c0e7e2c21ef..8538abfcfaf 100644
--- a/package/robocfg/Makefile
+++ b/package/robocfg/Makefile
@@ -31,8 +31,8 @@ define Build/Prepare
 endef
 
 define Package/robocfg/install
-	install -d -m0755 $(1)/sbin
-	install -m0755 $(PKG_BUILD_DIR)/robocfg $(1)/sbin/
+	$(INSTALL_DIR) $(1)/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/robocfg $(1)/sbin/
 endef
 
 $(eval $(call BuildPackage,robocfg))
diff --git a/package/rt2x00/Makefile b/package/rt2x00/Makefile
index 0a49818eb5b..c9502d83ccc 100644
--- a/package/rt2x00/Makefile
+++ b/package/rt2x00/Makefile
@@ -42,8 +42,8 @@ endef
 
 define Package/kmod-rt2x00/install
 	mkdir -p $(1)/etc/modules.d
-	install -m0644 ./files/rt2x00.modules $(1)/etc/modules.d/10-ralink
-	install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION)
+	$(INSTALL_DATA) ./files/rt2x00.modules $(1)/etc/modules.d/10-ralink
+	$(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION)
 	$(CP) $(PKG_BUILD_DIR)/Module/rt61.$(LINUX_KMOD_SUFFIX) \
 		$(1)/lib/modules/$(LINUX_VERSION)/
 endef
diff --git a/package/shfs/Makefile b/package/shfs/Makefile
index f4383a3f966..2562001b795 100644
--- a/package/shfs/Makefile
+++ b/package/shfs/Makefile
@@ -77,15 +77,15 @@ define Build/Compile
 endef
 
 define Package/kmod-shfs/install
-	install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION)
+	$(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION)
 	$(CP) $(PKG_INSTALL_DIR)/lib/modules/$(LINUX_VERSION)/kernel/fs/shfs/shfs.$(LINUX_KMOD_SUFFIX) \
 		$(1)/lib/modules/$(LINUX_VERSION)/
 endef
 
 define Package/shfs-utils/install
-	install -m0755 -d $(1)/usr/bin
+	$(INSTALL_DIR) $(1)/usr/bin
 	$(CP) $(PKG_INSTALL_DIR)/usr/bin/shfs{,u}mount $(1)/usr/bin/
-	install -m0755 -d $(1)/sbin
+	$(INSTALL_DIR) $(1)/sbin
 	$(CP) $(PKG_INSTALL_DIR)/sbin/mount.shfs $(1)/sbin/
 endef
 
diff --git a/package/spca5xx/Makefile b/package/spca5xx/Makefile
index 643e5863f44..e2aebfda2e5 100644
--- a/package/spca5xx/Makefile
+++ b/package/spca5xx/Makefile
@@ -44,7 +44,7 @@ define Build/Compile
 endef
 
 define Package/kmod-spca5xx/install
-	install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION)
+	$(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION)
 	$(CP) $(PKG_BUILD_DIR)/spca5xx.$(LINUX_KMOD_SUFFIX) \
 		$(1)/lib/modules/$(LINUX_VERSION)/
 endef
diff --git a/package/switch/Makefile b/package/switch/Makefile
index 07208bc30f7..a0644abeb15 100644
--- a/package/switch/Makefile
+++ b/package/switch/Makefile
@@ -41,12 +41,12 @@ define Build/Compile
 endef
 	
 define Package/kmod-switch/install
-	install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION)
+	$(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION)
 	$(CP) $(PKG_BUILD_DIR)/*.$(LINUX_KMOD_SUFFIX) \
 		$(1)/lib/modules/$(LINUX_VERSION)
-	install -m0755 -d $(1)/lib/network/
-	install -m0755 ./files/switch.sh $(1)/lib/network/
-	install -m0755 -d $(1)/etc/modules.d/
+	$(INSTALL_DIR) $(1)/lib/network/
+	$(INSTALL_BIN) ./files/switch.sh $(1)/lib/network/
+	$(INSTALL_DIR) $(1)/etc/modules.d/
 	printf 'switch-core\nswitch-robo\nswitch-adm\n' > $(1)/etc/modules.d/20-switch
 endef
 
diff --git a/package/ueagle-atm/Makefile b/package/ueagle-atm/Makefile
index 7e93fe1acd8..2e2bf43255a 100644
--- a/package/ueagle-atm/Makefile
+++ b/package/ueagle-atm/Makefile
@@ -43,12 +43,12 @@ define Build/Compile
 endef
 
 define Package/kmod-ueagle-atm/install
-	install -d -m0755 $(1)/lib/modules/$(LINUX_VERSION)
+	$(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION)
 	$(CP)	$(PKG_BUILD_DIR)/driver/ueagle-atm.$(LINUX_KMOD_SUFFIX) \
 		$(PKG_BUILD_DIR)/usbatm_iso/usbatm.$(LINUX_KMOD_SUFFIX) \
 		$(1)/lib/modules/$(LINUX_VERSION)/
-	install -d -m0755 $(1)/etc/modules.d
-	install -m0644 ./files/$(PKG_NAME).modules \
+	$(INSTALL_DIR) $(1)/etc/modules.d
+	$(INSTALL_DATA) ./files/$(PKG_NAME).modules \
 		$(1)/etc/modules.d/10-$(PKG_NAME)
 endef
 
diff --git a/package/util-linux/Makefile b/package/util-linux/Makefile
index 8ca8052ea12..e265edb1498 100644
--- a/package/util-linux/Makefile
+++ b/package/util-linux/Makefile
@@ -70,7 +70,7 @@ define Package/Template
 		rm -f $(PKG_BUILD_DIR)/.built; \
 		$(MAKE) $(PKG_BUILD_DIR)/.built; \
 	fi
-	install -d -m0755 $(2)
+	$(INSTALL_DIR) $(2)
 	$(CP) $(PKG_INSTALL_DIR)/$(1) $(2)/
 endef
 
diff --git a/package/wireless-tools/Makefile b/package/wireless-tools/Makefile
index f78bef986a0..f07a406409f 100644
--- a/package/wireless-tools/Makefile
+++ b/package/wireless-tools/Makefile
@@ -61,10 +61,10 @@ define Build/UninstallDev
 endef
 
 define Package/wireless-tools/install
-	install -d -m0755  $(1)/usr/lib
-	install -m0755 $(PKG_BUILD_DIR)/libiw.so.28 $(1)/usr/lib/
-	install -d -m0755 $(1)/usr/sbin
-	install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/iw{config,getid,list,priv,spy} $(1)/usr/sbin/
+	$(INSTALL_DIR)  $(1)/usr/lib
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/libiw.so.28 $(1)/usr/lib/
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iw{config,getid,list,priv,spy} $(1)/usr/sbin/
 endef
 
 $(eval $(call BuildPackage,wireless-tools))
diff --git a/package/wlcompat/Makefile b/package/wlcompat/Makefile
index 4a372946581..44acaee1f11 100644
--- a/package/wlcompat/Makefile
+++ b/package/wlcompat/Makefile
@@ -62,14 +62,14 @@ define Build/Compile
 endef
 
 define Package/kmod-wlcompat/install
-	install -d -m0755 $(1)/lib/modules/$(LINUX_VERSION)
+	$(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION)
 	$(CP) $(PKG_BUILD_DIR)/wlcompat.o $(1)/lib/modules/$(LINUX_VERSION)/
-	install -d -m0755 $(1)/etc/modules.d
+	$(INSTALL_DIR) $(1)/etc/modules.d
 	echo "wlcompat" > $(1)/etc/modules.d/30-wlcompat
 endef
 
 define Package/kmod-wlcompat-debug/install
-	install -d -m0755 $(1)/lib/modules/$(LINUX_VERSION)
+	$(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION)
 	$(CP) $(PKG_BUILD_DIR)/wlcompat-debug.o $(1)/lib/modules/$(LINUX_VERSION)/
 endef
 
diff --git a/package/wpa_supplicant/Makefile b/package/wpa_supplicant/Makefile
index b3fec0c1209..0530a952212 100644
--- a/package/wpa_supplicant/Makefile
+++ b/package/wpa_supplicant/Makefile
@@ -60,12 +60,12 @@ define Build/Compile
 endef
 
 define Package/wpa-supplicant/install
-	install -m0755 -d $(1)/usr/sbin
+	$(INSTALL_DIR) $(1)/usr/sbin
 	$(CP) $(PKG_BUILD_DIR)/wpa_supplicant $(1)/usr/sbin/
 endef
 
 define Package/wpa-cli/install
-	install -m0755 -d $(1)/usr/sbin
+	$(INSTALL_DIR) $(1)/usr/sbin
 	$(CP) $(PKG_BUILD_DIR)/wpa_cli $(1)/usr/sbin/
 endef
 
diff --git a/package/yamonenv/Makefile b/package/yamonenv/Makefile
index dfb9bbb59ab..c67658ea9a6 100644
--- a/package/yamonenv/Makefile
+++ b/package/yamonenv/Makefile
@@ -33,7 +33,7 @@ define Build/Configure
 endef
 
 define Package/yamonenv/install
-	install -d -m0755 $(1)/usr/sbin
+	$(INSTALL_DIR) $(1)/usr/sbin
 	$(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(1)/usr/sbin/
 endef
 
diff --git a/package/zd1211/Makefile b/package/zd1211/Makefile
index e5d2c2724f2..0c152b975fa 100644
--- a/package/zd1211/Makefile
+++ b/package/zd1211/Makefile
@@ -52,10 +52,10 @@ define Build/Compile
 endef
 
 define Package/kmod-zd1211/install
-	install -d -m0755 $(1)/lib/modules/$(LINUX_VERSION)
+	$(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION)
 	$(CP) $(PKG_BUILD_DIR)/zd1211.$(LINUX_KMOD_SUFFIX) \
 		$(1)/lib/modules/$(LINUX_VERSION)/
-	install -d -m0755 $(1)/usr/sbin
+	$(INSTALL_DIR) $(1)/usr/sbin
 	$(CP) $(PKG_BUILD_DIR)/apdbg $(1)/usr/sbin/
 	$(CP) $(PKG_BUILD_DIR)/sta $(1)/usr/sbin/$(PKG_NAME)-sta
 endef
diff --git a/package/zlib/Makefile b/package/zlib/Makefile
index 02eb45d858e..74544bc86a6 100644
--- a/package/zlib/Makefile
+++ b/package/zlib/Makefile
@@ -67,7 +67,7 @@ define Build/UninstallDev
 endef
 
 define Package/zlib/install
-	install -d -m0755 $(1)/usr/lib
+	$(INSTALL_DIR) $(1)/usr/lib
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libz.so.* $(1)/usr/lib/
 endef