[Bug 349181] New: propose new functions for images (for image.sh script)
https://bugzilla.novell.com/show_bug.cgi?id=349181 Summary: propose new functions for images (for image.sh script) Product: openSUSE.org Version: unspecified Platform: Other OS/Version: Other Status: NEW Severity: Enhancement Priority: P5 - None Component: System Imaging AssignedTo: ms@novell.com ReportedBy: postadal@novell.com QAContact: adrian@novell.com Found By: --- Hi Marcus, I'd like to propose some new functions for kiwi-head (or similar) that we used in SLEPOS10 in images.sh script for stripping, installing... 1. we used some striping functions in SLEPOS to reduce our images, could you add similar functions to kiwi-head? (I inspired by your implementation in KIWIConfig.sh:baseStripLocales) 2. function for easier installing busybox 3. I'd like to add some debug support to logging removed files and rpms see bellow: ---------- function SleposDebug { if test "$DEBUG" = 1; then echo "$@" >> "$DEBUG_LOGFILE" fi } # call rm -rf $@ and log debug records function SleposRmrf { SleposDebug "rm -rf $@" rm -rf $@ } # helper function for Strip* functions # stdin lines of files to check for removing # params - files which should be keep function strip_check_remove { local keepFiles="$@" while read file; do local baseFile=`/usr/bin/basename $file` local found="no" for keep in $keepFiles;do if echo $baseFile | grep -q $keep; then found="yes" break fi done if test $found = "no";then SleposRmrf $file fi done } # remove all documentation, except one given as parametr # params - name of package of which doc to keep function SleposStripDocs { local keepDocs="$@" local directories=" /opt/gnome/share/doc/packages /usr/share/doc/packages /opt/kde3/share/doc/packages " for dir in $directories; do find $dir -mindepth 1 -maxdepth 1 -type d 2>/dev/null | strip_check_remove $keepDocs done } # remove all locales files, except one given as parametr # params - name of keep locales function SleposStripLocales { local keepLocales="$@" local directories=" /opt/gnome/share/locale /usr/share/locale /opt/kde3/share/locale /usr/lib/locale /opt/gnome/share/man /usr/share/man /usr/local/man " for dir in $directories; do find $dir -mindepth 1 -maxdepth 1 -type d ! -name "man*" 2>/dev/null | strip_check_remove $keepLocales done } function SleposDebug { if test "$DEBUG" = 1; then echo "$@" >> "$DEBUG_LOGFILE" fi } # call rm -rf $@ and log debug records function SleposRmrf { SleposDebug "rm -rf $@" rm -rf $@ } # helper function for Strip* functions # stdin lines of files to check for removing # params - files which should be keep function strip_check_remove { local keepFiles="$@" while read file; do local baseFile=`/usr/bin/basename $file` local found="no" for keep in $keepFiles;do if echo $baseFile | grep -q $keep; then found="yes" break fi done if test $found = "no";then SleposRmrf $file fi done } # remove all documentation, except one given as parametr # params - name of package of which doc to keep function SleposStripDocs { local keepDocs="$@" local directories=" /opt/gnome/share/doc/packages /usr/share/doc/packages /opt/kde3/share/doc/packages " for dir in $directories; do find $dir -mindepth 1 -maxdepth 1 -type d 2>/dev/null | strip_check_remove $keepDocs done } # remove all locales files, except one given as parametr # params - name of keep locales function SleposStripLocales { local keepLocales="$@" local directories=" /opt/gnome/share/locale /usr/share/locale /opt/kde3/share/locale /usr/lib/locale /opt/gnome/share/man /usr/share/man /usr/local/man " for dir in $directories; do find $dir -mindepth 1 -maxdepth 1 -type d ! -name "man*" 2>/dev/null | strip_check_remove $keepLocales done } # remove all manual pages, except one given as parametr # params - name of keep man pages function SleposStripMans { local keepMans="$@" local directories=" /opt/gnome/share/man /usr/local/man /usr/share/man /opt/kde3/share/man/packages " for dir in $directories; do find $dir/man* -mindepth 1 -maxdepth 1 -type f 2>/dev/null | strip_check_remove $keepMans done } # remove all info files, except one given as parametr # params - name of keep info files function SleposStripInfos { local keepInfos="$@" local directories=" /usr/share/info " for dir in $directories; do find $dir -mindepth 1 -maxdepth 1 -type f 2>/dev/null | strip_check_remove $keepInfos done } # call rpm -e --nodeps for every param and log it function SleposRpme { for i in "$@";do SleposDebug "rpm -e --nodeps $i" rpm -e --nodeps $i done } # remove uneeded packages defined in packeg for deletion # see session <packages type="delete"> in config.xml function SleposStripRpms { SleposRpme `baseGetPackagesForDeletion` } # remove uneeded packages defined in packeg for deletion # see session <packages type="delete"> in config.xml function SleposStripRpms { SleposRpme `baseGetPackagesForDeletion` } # install busybox if is installed for all links from busybox/busybox.links # params - you can choose custom apps to install # use "-f" as the first param to replaced existing program by link to busybox # example: SleposInstallBusybox -f /bin/zcat /bin/vi function SleposInstallBusybox { local applets="" local force="no" local busyboxlinks="/usr/share/busybox/busybox.links" if ! rpm -q --quiet busybox; then return 0; fi if [ $# -gt 0 ] && [ "$1" = "-f" ]; then force="yes" shift fi if [ $# -gt 0 ]; then for i in "$@"; do if grep -q "^$i$" "$busyboxlinks"; then applets="${applets} $i" fi done else applets=`cat "$busyboxlinks"` fi for applet in $applets; do if [ ! -f "$applet" ] || [ "$force" = "yes" ]; then SleposDebug "ln -sf /usr/bin/busybox $applet" ln -sf /usr/bin/busybox "$applet" fi done } ====================== then I can easy call in image image.sh scrip e.g. following # Strips doc files, keep only listed SleposStripDocs # Strip locales, keep only listed SleposStripLocales en # Strip man pages SleposStripMans # Strip info files SleposStripInfos # Remove rest of evolution SleposRmrf /opt/gnome/lib/evolution-data-server-1.2 SleposRmrf /opt/gnome/share/evolution-data-server-1.6 # created links for all supported busybox apps if it was installed SleposInstallBusybox SleposStripRpms # Remove all YaST2 modules, when yast2-core is missing if ! rpm -q --quiet yast2-core; then SleposRmrf /usr/lib*/YaST2/plugin fi # Remove libzypp cache if libzypp is not installed if ! rpm -q --quiet libzypp; then SleposRmrf /var/lib/zypp fi -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 Marcus Schaefer <ms@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|propose new functions for images (for image.sh |kiwi: propose new functions for images (for |script) |image.sh script) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User ms@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c1 --- Comment #1 from Marcus Schaefer <ms@novell.com> 2007-12-18 10:46:46 MST --- That's a nice set of functions. Well I can't import the slepos specific functions but I'm interested in that busybox function. Thanks -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User ms@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c2 Marcus Schaefer <ms@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #2 from Marcus Schaefer <ms@novell.com> 2007-12-18 10:59:31 MST --- added the busybox code to the head branch Thanks -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User postadal@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c3 Petr Ostadal <postadal@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | --- Comment #3 from Petr Ostadal <postadal@novell.com> 2008-01-04 06:02:39 MST --- Marcus, stripping functions are not slepos specific, anyone can want to strip documentation, man or info pages. If there is problem with renaming functions (name prevents collision with kiwi standart functions), I can prepare patch with unified name for kiwi head. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User ms@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c4 Marcus Schaefer <ms@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|ms@novell.com |postadal@novell.com Status|REOPENED |NEW --- Comment #4 from Marcus Schaefer <ms@novell.com> 2008-01-05 08:05:12 MST --- you are right but your implementations currently looks like slepos specific. If you could provide a patch which is more standardized i will include it immediately ;) for kiwi I name functions which are FHS compliant and should work on all linux operating systems with the prefix base... function which are suse specific I name suse... functions which are product specific shouldn't be part of kiwi I will hand over the bug to you please assign it back to me if you finished the patch Thanks for your effort -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User pnemec@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c5 Pavel Nemec <pnemec@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pnemec@novell.com AssignedTo|postadal@novell.com |pnemec@novell.com Status|NEW |ASSIGNED --- Comment #5 from Pavel Nemec <pnemec@novell.com> 2008-11-26 09:03:09 MST --- I will takeover this one from Peter. I will prepare functions and create patch. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User pnemec@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c6 --- Comment #6 from Pavel Nemec <pnemec@novell.com> 2008-12-02 03:15:47 MST --- Created an attachment (id=257187) --> (https://bugzilla.novell.com/attachment.cgi?id=257187) patch for kiwi head I prepare "our" SLEPOS function and renamed them accoarding to your comments. I also add some debug function for deleting rpms, files and logging. It is very usefull, if you use DEBUG=1 in you images.sh, you will get nice and informative output: +++++> (caller:Rm:main ) rm -rf +++++> (caller:Rm:main ) rm -rf /usr/include/* +++++> (caller:Rpm:baseStripRPM ) rpm -e --nodeps cracklib Please take look at diff, it`s against head. Your comments are welcome. If you will agree to those function we can document their usage in kiwi.pdf and in SLEPOS documentation so user wouldn`t had to guest what they are actually doing -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 Pavel Nemec <pnemec@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEEDINFO Info Provider| |ms@novell.com -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User ms@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c7 Marcus Schaefer <ms@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ms@novell.com Status|NEEDINFO |ASSIGNED Info Provider|ms@novell.com | --- Comment #7 from Marcus Schaefer <ms@novell.com> 2008-12-02 04:24:51 MST --- looks very good to me. Would you mind to change the function style to: #====================================== # functionName #-------------------------------------- function functionName { # /.../ # some information if needed # ---- } that way it goes conform with the rest of the functions in that file If you could document the functions in the doc/ source too that would be perfect. I'm fine committing it then Thanks a lot for your effort -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User pnemec@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c8 Pavel Nemec <pnemec@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEEDINFO Info Provider| |ms@novell.com --- Comment #8 from Pavel Nemec <pnemec@novell.com> 2008-12-02 04:38:41 MST --- Not sure if I get It right. You want me to put comments to the very start of the function right? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User ms@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c9 Marcus Schaefer <ms@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |ASSIGNED Info Provider|ms@novell.com | --- Comment #9 from Marcus Schaefer <ms@novell.com> 2008-12-02 05:54:57 MST --- I'll give you an example: #====================================== # baseStripMans # - remove all manual pages, except # one given as parametr # - params - name of keep man pages #-------------------------------------- function baseStripMans { local keepMans="$@" local directories=" /opt/gnome/share/man /usr/local/man /usr/share/man /opt/kde3/share/man/packages " find $directories -mindepth 1 -maxdepth 2 -type f 2>/dev/null |\ baseStripAndKeep ${keepMans} } could you change it to: #====================================== # baseStripMans #-------------------------------------- function baseStripMans { # /.../ # remove all manual pages, except # one given as parametr # params - name of keep man pages # ---- local keepMans="$@" local directories=" /opt/gnome/share/man /usr/local/man /usr/share/man /opt/kde3/share/man/packages " find $directories -mindepth 1 -maxdepth 2 -type f 2>/dev/null |\ baseStripAndKeep ${keepMans} } Thanks -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User pnemec@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c10 Pavel Nemec <pnemec@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #257187|0 |1 is obsolete| | --- Comment #10 from Pavel Nemec <pnemec@novell.com> 2008-12-02 05:59:18 MST --- Created an attachment (id=257242) --> (https://bugzilla.novell.com/attachment.cgi?id=257242) reworked patch Ok, I got it. You are putting comments into the function...perl style. I redone patch. Please take a look. (btw it is against sles11 kiwi) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User pnemec@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c11 --- Comment #11 from Pavel Nemec <pnemec@novell.com> 2008-12-02 06:06:53 MST --- one more note useage of function baseStripTools can be replaced by baseStripAndKeep I didn`t want to do it, because you are using it little bit differently. But they actually do exactly same. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User pnemec@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c12 Pavel Nemec <pnemec@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEEDINFO Info Provider| |ms@novell.com --- Comment #12 from Pavel Nemec <pnemec@novell.com> 2008-12-03 02:32:54 MST --- Marcus? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User ms@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c13 --- Comment #13 from Marcus Schaefer <ms@novell.com> 2008-12-03 02:52:58 MST --- patch looks great now. I will check it in today thanks -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User ms@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c14 Marcus Schaefer <ms@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |ASSIGNED Info Provider|ms@novell.com | --- Comment #14 from Marcus Schaefer <ms@novell.com> 2008-12-03 04:59:17 MST --- functions added -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User pnemec@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c15 Pavel Nemec <pnemec@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEEDINFO Info Provider| |ms@novell.com --- Comment #15 from Pavel Nemec <pnemec@novell.com> 2008-12-05 03:03:26 MST --- Marcus could you please add this patch also to SLES11 SDK? I think we can close this bug as fixed then. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User ms@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c16 Marcus Schaefer <ms@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |ASSIGNED Info Provider|ms@novell.com | --- Comment #16 from Marcus Schaefer <ms@novell.com> 2008-12-05 03:55:33 MST --- sure this is done automatically as cthiel told me. Everything which is checked in to STABLE goes to SDK too. Christoph is in CC -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=349181 User pnemec@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=349181#c17 Pavel Nemec <pnemec@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #17 from Pavel Nemec <pnemec@novell.com> 2008-12-15 06:39:34 MST --- Setting as fixed. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com