FreeBSD Port For CodeIgniter Upgraded to 1.6.1
Hi everyone,
I’ve submitted some new FreeBSD port upgrades over the past week, including new support for CodeIgniter 1.6.1. In addition to the version bump of the upstream distribution, I also added some new bits to allow customization of certain CI files. The port is also careful to avoid removing those modified files when a new port upgrade comes along.
The reference for how to handle user-configurable files installed as part of a port can be found in the excellent FreeBSD Porter’s Handbook in the Configuration Files section.
In the new CodeIgniter port, the following user-configurable files are installed:
<INSTALL_DIR>/index.php
<INSTALL_DIR>/index.php.sample
<INSTALL_DIR>/system/application/config/autoload.php
<INSTALL_DIR>/system/application/config/autoload.php.sample
<INSTALL_DIR>/system/application/config/config.php
<INSTALL_DIR>/system/application/config/config.php.sample
<INSTALL_DIR>/system/application/config/database.php
<INSTALL_DIR>/system/application/config/database.php.sample
<INSTALL_DIR>/system/application/config/hooks.php
<INSTALL_DIR>/system/application/config/hooks.php.sample
<INSTALL_DIR>/system/application/config/mimes.php
<INSTALL_DIR>/system/application/config/mimes.php.sample
<INSTALL_DIR>/system/application/config/routes.php
<INSTALL_DIR>/system/application/config/routes.php.sample
<INSTALL_DIR>/system/application/config/smileys.php
<INSTALL_DIR>/system/application/config/smileys.php.sample
<INSTALL_DIR>/system/application/config/user_agents.php
<INSTALL_DIR>/system/application/config/user_agents.php.sample
What this does is install a reference copy of each file (*.sample) that is not expected to be edited by the user. The actual file that CodeIgniter uses to render pages (no .sample suffix) is user-configurable as needed.
Then some crazy-looking shell code in the pkg-plist file makes sure that any edited files are not removed if the port is deinstalled or upgraded (reformatted for readability):
%D/%%WWWDIR%/%%CI_CONF_DIR%%/autoload.php; then \
rm -f %D/%%WWWDIR%%/%%CI_CONF_DIR%%/autoload.php; else \
%%ECHO_MSG%% "===> Customized %D/%%WWWDIR%%/%%CI_CONF_DIR%%/autoload.php \
has not been removed"; fi
%%WWWDIR%%/%%CI_CONF_DIR%%/autoload.php.sample
@exec if [ ! -f %D/%%WWWDIR%%/%%CI_CONF_DIR%%/autoload.php ]; then \
cp -p %D/%F %B/autoload.php; fi
This concept needs to be implemented in several of the other ports that I maintain, including CakePHP and Prado. If anyone has a list of files that are user-configurable in each of those frameworks, please send it along!
Keep in touch,
Greg
SourceHosting.net, LLC