Results 1 to 4 of 4

Thread: Knoppix.clean script

Hybrid View

  1. #1
    Senior Member registered user
    Join Date
    May 2003
    Posts
    981

    Knoppix.clean script

    I've been going through Klaus Knopper's original script for cleaning up prior the making the compressed file system
    (posted here http://www.knoppix.net/forum/viewtopic.php?t=3314)
    & I have some questions as I'm not very good at figuring out scripting.

    (This was commented out but obviously was used at one time....
    # echo "Updating package lists..."
    # pump; sleep 2
    # perl -pi -e 's/^deb/#deb/g' /etc/apt/sources.list
    # apt-get update >/dev/null 2>&1
    # perl -pi -e 's/^#deb/deb/g' /etc/apt/sources.list
    Apt-get update I understand but what are the perl lines?

    rmdir /mnt/cdrom?* /mnt/hd?* /mnt/sd?* 2>/dev/null
    rm -f /etc/ifstate /etc/X11/XF86Config /etc/X11/XF86Config-4 \
    * * * /etc/XF86Config /etc/XF86Config-4 /etc/sysconfig/* \
    * * * /etc/ssh/*key* \
    * * * /etc/samba/*.SID /var/lib/samba/* /var/cache/samba/* /etc/samba/*.tdb \
    * * * /dev/mouse* /dev/cdrom* /dev/cdwriter* \
    * * * /var/run/*/* /var/run/* /var/log/ksymoops/* /var/lock/*/* /var/lock/* \
    * * * /var/state/*/* /var/state/* /var/log/nessus/* /var/lib/nessus/* \
    * * * /halt /reboot /ash.static /etc/dhcpc/*.info /etc/dhcpc/resolv* \
    * * * /etc/resolv.conf /etc/*passwd- /etc/*shadow- /etc/*group- 2>/dev/null
    Why rm /halt & /reboot??

    mkdir -p /etc/sysconfig/network-scripts /etc/sysconfig/provider
    What is this? I see there is a /etc/sysconfig/provider file on the system, it appears to have specifics about somebody's (Klaus'?) ISP. But why are these directories being made in this cleanup script?

    rm -rf /tmp/* /var/tmp/* /var/backups/* /root/.??* /.??* /home/root/.??* \
    * */home/*/.ssh /home/*/.bash_history \
    * * * */home/knoppix/* /home/knoppix/.??* /var/lib/texmf/ls-R \
    * * * */var/spool/texmf/ls-R /var/run/screen/* /var/spool/squid/* \
    * * * */usr/share/applnk/System/Nessus.desktop
    nuke /var/log /var/cache /var/spool/texmf
    zero /var/local /var/log /var/spool /var/mail \
    * * */var/lib/games /var/cache/man /var/lib/wine \
    * * */var/lib/nfs /var/lib/xkb
    Why zero /var/log et al when they has just been nuked?....also note /home/knoppix is cleared here so Mzilikazi's addition shouldn't be needed.

    for i in `find /usr/*/man -name \*.\[0-9ln\]` ; do
    [ -f "$i".gz -o -f "$i".bz2 ] && rm -f "$i"
    done
    It looks like this will remove expanded manpages if there is a zipped version on the system. Am I reading this right?

    # (This will have to be edited, I don't have a Knoppix.build directory)
    updatedb --prunepaths="/KNOPPIX.build /mnt/hd /mnt/cdrom /tmp /usr/tmp /var/tmp"
    update-dlocatedb
    echo "* *Done."
    Man updatedb says it updates the slocate dateabase used for locating files. but what is dlocatedb...there is no man entry. Is it possibly a misprint & should read 'update -locatedb' ? Also, man updatedb says nothing about a --prunepaths option but seems to accept it if you try it.

    Thanks.

  2. #2
    Senior Member registered user
    Join Date
    Mar 2004
    Posts
    900
    Quote Originally Posted by CrashedAgain

    Apt-get update I understand but what are the perl lines?
    It simply comments each line in sources.list

    Why rm /halt & /reboot??
    Presumably to restore the proper state of the system but not really sure on that as I have no such directories. Do you?

    What is this? I see there is a /etc/sysconfig/provider file on the system, it appears to have specifics about somebody's (Klaus'?) ISP. But why are these directories being made in this cleanup script?
    Needed for the ISDN config tool from RH. Not sure if it's still necessary or not.

    Why zero /var/log et al when they has just been nuked?..
    Well 'nuke' is not a bash command so I have no idea what that does. Of course zero is to set the length of files to zero.

    It looks like this will remove expanded manpages if there is a zipped version on the system. Am I reading this right?
    Indeed

    Man updatedb says it updates the slocate dateabase used for locating files. but what is dlocatedb...there is no man entry. Is it possibly a misprint & should read 'update -locatedb' ? Also, man updatedb says nothing about a --prunepaths option but seems to accept it if you try it.

    Thanks.
    Nope not a misprint, dlocate is an alternative to dpkg -L and dpkg -S
    From man updatedb:
    --prunepaths='path1 path2...'
    Directories to not put in the database, which would otherwise
    be. The environment variable PRUNEPATHS also sets this value.
    Default is /tmp /usr/tmp /var/tmp /afs.

  3. #3
    Senior Member registered user
    Join Date
    May 2003
    Posts
    981
    Thanks for the help.

    I don't have a /halt or a /reboot either, but wasn't sure if I should have.
    Nuke is a function created earlier in the script which rm -f "$i" a list of filenames i, thus I thought it should remove the files & zeroing them should not be needed.
    Don't know how I could have missed the prunepaths manpage entry...blind moment I guess.

    In your remaster procedure you preserve /home/knoppix as /etc/skel:

    TWEAK THE DESKTOP
    #Your configurations are saved in /home/knoppix
    #which eventually becomes /etc/skel
    #When you are COMPLETELY FINISHED tweaking the desktop
    su
    mv /home/knoppix /etc/skel
    touch /home/knoppix
    chown knoppix:knoppix /home/knoppix
    chown -R root:root /etc/skel
    updatedb
    ldconfig
    update-modules
    Why is nothing done to preserve /home/root?

    Thanks again.

  4. #4
    Senior Member registered user
    Join Date
    Mar 2004
    Posts
    900
    Well /home/root is actually just /root so it's already taken care of.

Similar Threads

  1. Clean up KDE and the menus...
    By tommydl in forum Ideas
    Replies: 1
    Last Post: 09-24-2004, 07:57 PM
  2. "Clean" Knoppix Boot on a preinstalled Windows XP
    By ruymbeke in forum Hdd Install / Debian / Apt
    Replies: 1
    Last Post: 07-30-2004, 06:52 AM
  3. Clean knoppix install
    By konfused in forum Hdd Install / Debian / Apt
    Replies: 7
    Last Post: 04-28-2004, 11:31 PM
  4. Clean installation without any 'knoppix stuff' remaining?
    By tr in forum Hdd Install / Debian / Apt
    Replies: 2
    Last Post: 04-19-2004, 08:15 PM
  5. has anyone ever put out a clean base image?
    By Dr_Blackross in forum The Lounge
    Replies: 2
    Last Post: 01-20-2003, 12:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Gigabyte 4U AI Server 10x Nvidia GPU 2x Xeon Gold 6150 36 Core 2.7GHz DDR4 RAM picture

Gigabyte 4U AI Server 10x Nvidia GPU 2x Xeon Gold 6150 36 Core 2.7GHz DDR4 RAM

$1499.00



Dell EMC PowerEdge R440 Xeon silver 4215 2.5GHz 16 GB ram  2x 550W PSU No HDD picture

Dell EMC PowerEdge R440 Xeon silver 4215 2.5GHz 16 GB ram 2x 550W PSU No HDD

$275.00



Dell PowerEdge R240 Intel Xeon E-2224 3.50GHz 8GB DDR4 ECC NO HDD 250W picture

Dell PowerEdge R240 Intel Xeon E-2224 3.50GHz 8GB DDR4 ECC NO HDD 250W

$285.97



867959-B21 HPE ProLiant DL360 G10 CTO Server W/ 2x 865414-B21 1x 840140-001 picture

867959-B21 HPE ProLiant DL360 G10 CTO Server W/ 2x 865414-B21 1x 840140-001

$245.00



Dell PowerEdge R730XD 28 Core Server 2X Xeon E5-2680 V4 H730 32GB RAM No HDD picture

Dell PowerEdge R730XD 28 Core Server 2X Xeon E5-2680 V4 H730 32GB RAM No HDD

$378.93



Dell PowerEdge C4130 1U AI GPU Server | 2x E5-2680 v3 | 32gb Ram | 2x 1600W picture

Dell PowerEdge C4130 1U AI GPU Server | 2x E5-2680 v3 | 32gb Ram | 2x 1600W

$409.99



Dell PowerEdge C4130 1U AI GPU Server | 2x E5-2690 v3 | 64gb Ram | 2x 1600W picture

Dell PowerEdge C4130 1U AI GPU Server | 2x E5-2690 v3 | 64gb Ram | 2x 1600W

$524.99



Dell PowerEdge C4130 1U AI GPU Server | 2x E6-2699 v3 | 128gb RAM | 2x 1600W picture

Dell PowerEdge C4130 1U AI GPU Server | 2x E6-2699 v3 | 128gb RAM | 2x 1600W

$899.99



Dell PowerEdge R530 2x E5-2630v4 H330 iDRAC8 Port Card Riser No PSU/RAM/HDD picture

Dell PowerEdge R530 2x E5-2630v4 H330 iDRAC8 Port Card Riser No PSU/RAM/HDD

$99.99



Dell PowerEdge FX2s + 8x FC430 Blades 16x E5-2630v4 160 Cores Rails No PSU/RAM picture

Dell PowerEdge FX2s + 8x FC430 Blades 16x E5-2630v4 160 Cores Rails No PSU/RAM

$699.00