summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-01-27 21:11:44 (EST)
committer P. J. McDermott <pjm@nac.net>2012-01-27 21:11:44 (EST)
commit09f2e004228ad53ce4730fc64b42e581e2b9427a (patch)
tree584bd8f99e5d0e1a4c2b84b8ddd3cc55608d8f9e
parent11bd0646333d511d577cc8535297a4bb2bf8b2c0 (diff)
Generate conffiles list.
-rw-r--r--TODO1
-rw-r--r--src/oh-gencontrol14
2 files changed, 14 insertions, 1 deletions
diff --git a/TODO b/TODO
index 42d227b..6d3b955 100644
--- a/TODO
+++ b/TODO
@@ -4,7 +4,6 @@ TODO:
* Handle "Architecture" field in oh-gencontrol, opkbuild, and oh-buildopk.
* Check on file ownership and modes.
* Finish tar archive handling in opkhelper.
- * Support "Conffiles".
* Build packages with copyright information and changelogs. [1][2]
* Generate MD5 checksums of files.
diff --git a/src/oh-gencontrol b/src/oh-gencontrol
index 62a6eef..03acc3d 100644
--- a/src/oh-gencontrol
+++ b/src/oh-gencontrol
@@ -91,6 +91,7 @@ gen_control_bin()
printf 'oh-gencontrol: Generating control directory for package "%s"...\n' \
"${binpkg}"
+ data_dir="${binpkg}.data"
control_dir="${binpkg}.control"
control="${control_dir}/control"
@@ -121,6 +122,7 @@ gen_control_bin()
copy_required_field ${binpkg} Description ${control}
copy_optional_field Homepage ${control}
+ # Maintainer scripts.
for script in preinst postinst prerm postrm; do
if [ -f ../${binpkg}.pkg/${script} ]; then
cp ../${binpkg}.pkg/${script} ${control_dir}
@@ -128,6 +130,18 @@ gen_control_bin()
# TODO: Handle links?
fi
done
+
+ # Conffiles.
+ # Adapted from dh_installdeb of debhelper.
+ if [ -d ${data_dir}/etc ]; then
+ find ${data_dir}/etc -type f | sed "s@^${data_dir}@@" \
+ >> ${control_dir}/conffiles
+ if [ -z "$(cat ${control_dir}/conffiles)" ]; then
+ rm -f ${control_dir}/conffiles
+ else
+ chmod 644 ${control_dir}/conffiles
+ fi
+ fi
}
if [ ${#} -eq 0 ]; then