summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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