[arch-projects] [initscripts][PATCH] Use Makefile to replace install.sh

Dave Reisner d at falconindy.com
Sat Apr 23 11:21:10 EDT 2011


If we're going to use a Makefile for minilogd, we might as well use it
for everything. This has some moving pieces:

* fix minilogd rule: minilogd.o is a target dep not a build rule
* rename adjtime.cron => adjtime
* fixup PKGBUILD to account for changes
---
 Makefile     |   18 +++++++++++++++---
 PKGBUILD     |    7 ++++++-
 adjtime      |   15 +++++++++++++++
 adjtime.cron |   15 ---------------
 install.sh   |   27 ---------------------------
 5 files changed, 36 insertions(+), 46 deletions(-)
 create mode 100755 adjtime
 delete mode 100755 adjtime.cron
 delete mode 100755 install.sh

diff --git a/Makefile b/Makefile
index 0ec54ee..07bf7f9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,22 @@
-VER:=$(shell sh -c 'git describe')
+VER  := $(shell git describe)
+DIRS := /etc/rc.d /etc/conf.d /etc/rc.d/functions.d /etc/cron.hourly /sbin
 
-minilogd:
-	minilogd.o
+minilogd: minilogd.o
+
+installdirs:
+	install -dm755 $(foreach DIR, $(DIRS), $(DESTDIR)$(DIR))
+
+install: minilogd installdirs
+	install -m644 -t $(DESTDIR)/etc inittab rc.conf
+	install -m644 -t $(DESTDIR)/etc/rc.d functions
+	install -m755 -t $(DESTDIR)/etc rc.local rc.local.shutdown rc.multi rc.shutdown rc.single rc.sysinit
+	install -m755 -t $(DESTDIR)/etc/cron.hourly adjtime
+	install -m755 -t $(DESTDIR)/etc/rc.d functions hwclock network netfs
+	install -m755 -t $(DESTDIR)/sbin minilogd rc
 
 clean:
 	rm -f minilogd minilogd.o
 
 release:
 	git archive HEAD --prefix=initscripts-$(VER)/ | xz > initscripts-$(VER).tar.xz
+
diff --git a/PKGBUILD b/PKGBUILD
index 79f51f8..c5f2acd 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -19,5 +19,10 @@ sha256sums=()
 
 build() {
   cd ..
-  DESTDIR=${pkgdir} ./install.sh
+  make
+}
+
+package() {
+  cd ..
+  make DESTDIR="$pkgdir" install
 }
diff --git a/adjtime b/adjtime
new file mode 100755
index 0000000..8a894f1
--- /dev/null
+++ b/adjtime
@@ -0,0 +1,15 @@
+#!/bin/bash
+# Update our hwclock for system drift
+
+. /etc/rc.conf
+
+HWCLOCK_PARAMS="--adjust"
+case $HARDWARECLOCK in
+    UTC) HWCLOCK_PARAMS+=" --utc";;
+    localtime) HWCLOCK_PARAMS+=" --localtime";;
+    *) HWCLOCK_PARAMS="";;
+esac
+
+if [[ $HWCLOCK_PARAMS && -f /run/daemons/hwclock ]]; then
+    /sbin/hwclock $HWCLOCK_PARAMS
+fi
diff --git a/adjtime.cron b/adjtime.cron
deleted file mode 100755
index 8a894f1..0000000
--- a/adjtime.cron
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# Update our hwclock for system drift
-
-. /etc/rc.conf
-
-HWCLOCK_PARAMS="--adjust"
-case $HARDWARECLOCK in
-    UTC) HWCLOCK_PARAMS+=" --utc";;
-    localtime) HWCLOCK_PARAMS+=" --localtime";;
-    *) HWCLOCK_PARAMS="";;
-esac
-
-if [[ $HWCLOCK_PARAMS && -f /run/daemons/hwclock ]]; then
-    /sbin/hwclock $HWCLOCK_PARAMS
-fi
diff --git a/install.sh b/install.sh
deleted file mode 100755
index e469577..0000000
--- a/install.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-
-set -e
-
-install -d -m755 ${DESTDIR}/etc/rc.d
-install -d -m755 ${DESTDIR}/etc/conf.d
-install -d -m755 ${DESTDIR}/etc/rc.d/functions.d/
-install -d -m755 ${DESTDIR}/etc/cron.hourly/
-
-for i in inittab rc.conf; do
-  install -D -m644 $i ${DESTDIR}/etc/$i
-done
-for i in rc.local rc.local.shutdown rc.multi rc.shutdown rc.single rc.sysinit; do
-  install -D -m755 $i ${DESTDIR}/etc/$i
-done
-
-install -D -m755 adjtime.cron ${DESTDIR}/etc/cron.hourly/adjtime
-
-install -D -m644 functions ${DESTDIR}/etc/rc.d/functions
-for i in hwclock network netfs; do
-  install -D -m755 $i ${DESTDIR}/etc/rc.d/$i
-done
-
-make minilogd
-install -D -m755 minilogd ${DESTDIR}/sbin/minilogd
-
-install -D -m755 rc ${DESTDIR}/sbin/rc
-- 
1.7.4.4



More information about the arch-projects mailing list