tech-misc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: postinstall and motd check




To: "Jeremy C. Reed" <reed%reedmedia.net@localhost>

Subject: Re: postinstall and motd check

From: "Greg A. Woods; Planix, Inc." <woods%planix.ca@localhost>

Date: Fri, 7 Mar 2008 16:53:47 -0500



On 7-Mar-08, at 4:18 PM, Jeremy C. Reed wrote:


This doesn't look right. Why does this fail?


I noticed that the other day too.

Yesterday I did some debugging a
nd finally decided that the most  recent change to include the current proper URL was done blindly by  some search-and-replace blast.

However even without the curr
ent URL being included the old logic  fails miserably if the source directory (-s) is specified as the real  source tree (as opposed to a directory where the *etc.tgz set(s) were  unpacked).

The be
tter fix would be to edit the old URL into the new one without  grubbing about in any source directory for a new template file.

Fu
rthermore the use of "mktemp" in the do_motd() function is also  wrong. Postinstall sets up its own private (and much safer to use)  scratch directory which all such functions should use for temporary  files.

Perhaps it could be
 something like the following (untested and  probably badly folded):

do_motd()
{
        [ -n "$1" ] || err 3 "Usage: do_motd fix|check"

 if fgrep -i 'netbsd.org/Misc
/send-pr.html' ${DEST_DIR}/etc/motd > /  dev/null 2>&1; then
                result=1
                if [ "$1" = check ]; then
 msg 
"NetBSD.org bug reporting URL needs updating to replace /Misc/  with /support/"
                else
 sed 's|/Misc/|/su
pport/|' < ${DEST_DIR}/etc/motd > ${SCRATCHDIR}/  motd.newURL
                        mv ${SCRATCHDIR}/motd.newURL ${DEST_DIR}/etc/motd && 
result=0
                fi
        else
                result=0
        fi

        return ${result}
}


--
                                        Greg A. Woods; Planix, Inc.
                                        <woods%planix.ca@localhost>





References:

postinstall and motd check
From: Jeremy C. Reed




Prev by Date: postinstall and motd check

Next by Date: libedit/makelist, editrc manpage, document default key bindings

Previous by Thread: postinstall and motd check

Next by Thread: libedit/makelist, editrc manpage, document default key bindings

Indexes:

reverse Date

reverse Thread

Old Index



Home | Main Index | Thread Index | Old Index