Mailinglist Archive: opensuse-packaging (235 mails)

< Previous Next >
Re: [opensuse-packaging] changed config location
Am 08.03.2012 18:00, schrieb Michael Schroeder:
On Thu, Mar 08, 2012 at 01:39:02AM +0100, Christian Boltz wrote:
Am Mittwoch, 7. M?rz 2012 schrieb Lutz Thuns:
I'm thinking of following %post section:

%post
# backup old configuration files to new location
if [ -d /etc/default/wbar ]; then
for i in /etc/default/wbar/*; do

AFAIK the paths in %post scripts shouldn't start with / and instead
assume that you are in / - so your script should be

if [ -d etc/default/wbar ]; then
for i in etc/default/wbar/*; do

Using /etc in the script will probably break if rpm --root is used
(in other words: when booting the installation system from DVD)

Uh, a long time ago old yast called scriptlets after cd'ing into
the root directory, but those dark times are over. Rpm always uses
a chroot() before running a scriplet, so using an absolute path
is the prefered way.


Hi all,

following script is working fine, had to use basename...

%post
# backup old configuration files to new location
if [ -d /etc/default/wbar ]; then
for FILE in /etc/default/wbar/*; do
cp $FILE /etc/wbar.d/`basename "$FILE"`.rpmsave
done
fi

I dropped the "rm -r /etc/default/wbar" line because zypper/rpm seem to
remove the old files after the installation (and after the %post-script).

Thanks,

--
Lutz Thuns
openSUSE member (lOtz1009)
LXDE-Team
--
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-packaging+owner@xxxxxxxxxxxx

< Previous Next >