先日、debconf を使用して値設定、 postinst での値の取得までできていたで、 postinst で設定ファイルの値を sed (実は使うの初めて ぉぃ)で置換するようにしてみた。
設定ファイルの内容を置換して、> で強制書込みすると白紙になるようなので、/tmp に tmpfile をかまして置換していくようにしてみた。
set -e
appdir=/usr/share/webupdate
conffile=/etc/webupdate/config.php
conffiletmp=/tmp/config.php
. /usr/share/debconf/confmodule
・
(cut!!)
・
db_get webupdate/documentroot
documentroot=$RET
if [ ! -e "$documentroot/webupdate" ] && [ $RET ]; then
ln -s $appdir $documentroot
fi
cp $conffile $conffiletmp
db_get webupdate/loginexpiretime
if [ $RET ]; then
sed "s/\"LOGIN_EXPIRE_TIME\", \"30\"/\"LOGIN_EXPIRE_TIME\", \"$RET\"/" $conffiletmp > $conffile;
fi
cp $conffile $conffiletmp
db_get webupdate/mastermailaddress
if [ $RET ]; then
sed "s/\"MASTER_MAIL_ADDRESS\", "'yamasaki@good-day.co.jp'/\"MASTER_MAIL_ADDRESS\", \'$RET\'/" $conffiletmp > $conffile;
fi
cp $conffile $conffiletmp
db_get webupdate/domain
if [ $RET ]; then
sed "s/\"DOMAIN\", \".good-day.co.jp\"/\"DOMAIN\", \".$RET\"/" $conffiletmp > $conffile;
fi
・
・
(cut!!)
/etc/webupdate/config.php のファイル内容は、debconf の設定で入力した値に置換されていた。が、インストール後に、
dpkg-reconfigure webupdate
で、設定変更の質問は、インストール時と同じように出るのだが、/etc/webupdate/config.php のファイルは置換されていなかった(´・ω・`)ショボーン。他に何か設定がいるようでした……