PET scripts puzzler (solved)

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

PET scripts puzzler (solved)

#1 Post by Sit Heel Speak »

I am being thwarted in my quest to create a universal PET package to install BCI-hinting-enabled libfreetype, by just a single remaining bug. I can't see what's wrong and hope someone can help.

The implementation / architecture of the PET package, is as follows:

1. PPM unpacks sourcefiles into the two subdirs
--a. /usr/local/new_libfreetype
--b. /usr/local/new_fontconfig

2. PPM starts post-install script pinstall.sh, pinstall.sh does the following:
--a. Creates a subdir and copies existing libfreetype.s* into it (/usr/local/original_libfreetype)
--b. Creates a subdir and copies existing font config files into it (/usr/local/original_fontconfig)
--c. Creates a subdir and copies rc.local into it (/usr/local/original_libfreetype/original_rc_local)
--d. Copies from new_libfreetype, into /root/Startup, a bash script restore_original_rc_local
--e. Appends a line to rc.local for execution during next reboot. The line calls a script called run_upon_first_next_reboot.
--f. Calls up defaultbrowser with an advisory page on patents.
--g. calls up defaulttexteditor with a message assuring that all is OK and instructing to reboot.

3. Then, when the user reboots:
--a. The appended-to rc.local calls run_upon_first_next_reboot.
--b. run_upon_first_next_reboot copies the upgraded libfreetype libs into /usr/bin over the old ones, and upgraded font config files into /etc/fonts.
--c. X starts, and /root/Startup/restore_original_rc_local executes. restore_original_rc_local does the following:
--d. if a marker file (supplied in the source) is present, copies the original rc.local from its temporary stashplace /usr/local/original_libfreetype/original_rc_local back over the appended-to copy in /etc/rc.d.
--e. --and then deletes the marker file in /usr/local/new_libfreetype, so rc.local gets re-copied in only once.
--f. And finally, calls up defaulttexteditor with a congratulations notice.

It all works beautifully EXCEPT that in step 2c the pinstall.sh script is failing to create a copy of rc.local. Therefore, step 3d fails, and so at the end,...well,...the thrilled user has BCI-hinting-enabled freetype and is dazzled at the sharpness and glows with success, all right...but, rc.local still has the additional appended line. The extra line does no harm, because it can be made conditional, to execute only if the first-time-run marker file (gone after step 3e) is present, ...but for the sake of stylistic cleanness, the appended line shouldn't be there, i.e. the original rc.local should be copied back in.

Here is the snippet from pinstall.sh which is not obliging me:

Code: Select all

# Create a backup of rc.local preparatory to the after-reboot portion of this installation:
if [ ! -d /usr/local/original_libfreetype ]; then
	mkdir /usr/local/original_libfreetype
	sync
fi
if [ ! -d /usr/local/original_libfreetype/original_rc_local ]; then
	mkdir /usr/local/original_libfreetype/original_rc_local
	sync
fi
if [! -f /usr/local/original_libfreetype/original_rc_local/rc.local ]; then
	cp -f /etc/rc.d/rc.local /usr/local/original_libfreetype/original_rc_local/rc.local
	sync
fi
Can anyone see why it's not making the desired copy of rc.local? Is there something special in the way Puppy handles rc.local?

TIA,
Philip
Last edited by Sit Heel Speak on Wed 05 Aug 2009, 00:07, edited 2 times in total.

Bruce B

#2 Post by Bruce B »

To make your original backup
cp /etc/rc.d/rc.local /

Then see if it copied.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#3 Post by MU »

or maybe try
cp -ax
I sometimes need that instead of "cp", or a file does not get copied.
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#4 Post by amigo »

You are missing a space between the bracket and !:
if [!

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

#5 Post by Sit Heel Speak »

:shock: :roll: :) :D That does it. I'm switching to tea...

I must have looked at that snippet 50 times, and didn't see it. Amigo of course nailed it.

My thanks to all of you, you are mentioned in pinstall.sh. You'll get ten percent of any profit I make from it, too... :lol:

Now to go start populating that thread...

Post Reply