Date: Sat, 16 Oct 2004 14:25:02 +0200 From: Alexander Leidinger <Alexander@Leidinger.net> To: current@freebsd.org Subject: RFC: automated way of removing old base system files (only for a recent 6-current!) Message-ID: <20041016142502.6362d396@Magellan.Leidinger.net>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --Multipart=_Sat__16_Oct_2004_14_25_02_+0200_fa0wt.u_FDjLyQ4j Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hi, attached is a Makefile which removes old bases system files (WARNINIG: don't run this if you don't have a backup!). To test it run: make -f Makefile.obsoletefiles delete-old make -f Makefile.obsoletefiles delete-old-libs DO NOT USE THIS ON 5.x! DO NOT USE IT ON A NOT SO RECENT 6-CURRENT (20041002 or later should be safe)! When you test it, you will be asked for each file if you want to remove it (better safe than sorry). If you do this for e.g. a lot of jails (the targets know how to deal with DESTDIR=/path/to/jail) and you're sure all files can be removed, you can define BATCH_DELETE_OLD_FILES ("make -f Makefile.obsoletefiles -DBATCH_DELETE_OLD_FILES delete-old"). Then you will not be prompted for confirmation. WARNING: I may have typos in there, or I added a wrong file by accident, so look at each file and make sure it can be removed. If you trashed your system by testing this, you will be on your own (but please tell me about it, so I can fix the Makefile). If you know about a file which needs to be removed, but isn't by this Makefile, tell me about it please. For those who look at the code: the dates don't seem to be correct, further research needs to be done. But since the dates are not essential for the main feature of the Makefile, I decided to provide the actual snapshot for review. Corrections, hints, ideas and patches are welcome. Bye, Alexander. -- The best things in life are free, but the expensive ones are still worth a look. http://www.Leidinger.net Alexander @ Leidinger.net GPG fingerprint = C518 BC70 E67F 143F BE91 3365 79E2 9C60 B006 3FE7 --Multipart=_Sat__16_Oct_2004_14_25_02_+0200_fa0wt.u_FDjLyQ4j Content-Type: text/plain; name="Makefile.obsoletefiles" Content-Disposition: attachment; filename="Makefile.obsoletefiles" Content-Transfer-Encoding: 8bit # # $FreeBSD$ # # This files lists old files (OLD_FILES), libraries (OLD_LIBS) and # directories (OLD_DIRS) which should get removed at an update. Recently # removed entries first (with the date as a comment). Dynamic libraries are # special cased (OLD_LIBS). Static libraries or the generic links to # the dynamic libraries (lib*.so) should be viewed as normal files # (OLD_FILES). # # In case of a complete directory hierarchy the sorting is in depth first # order. # # 20040925: bind9 import OLD_FILES+=usr/bin/dnskeygen OLD_FILES+=usr/bin/dnsquery OLD_FILES+=usr/lib/libisc.a OLD_FILEs+=usr/lib/libisc.so OLD_FILES+=usr/lib/libisc_p.a OLD_FILES+=usr/libexec/named-xfer OLD_FILES+=usr/sbin/named.restart OLD_FILES+=usr/sbin/ndc OLD_FILES+=usr/sbin/nslookup OLD_FILES+=usr/sbin/nsupdate # 2004XXYY: OS internal libs, no ports use them, no need to use OLD_LIBS OLD_FILES+=lib/geom/geom_concat.so.1 OLD_FILES+=lib/geom/geom_label.so.1 OLD_FILES+=lib/geom/geom_nop.so.1 OLD_FILES+=lib/geom/geom_stripe.so.1 .if ${MACHINE_ARCH} != "alpha" && ${MACHINE_ARCH} != "sparc64" # 20040130: libkse renamed to libpthread OLD_FILES+=usr/lib/libkse.a OLD_FILES+=usr/lib/libkse.so .endif # 200XYYZZ, /lib transition clitches OLD_FILES+=lib/libalias.so OLD_FILES+=lib/libatm.so OLD_FILES+=lib/libbsdxml.so OLD_FILES+=lib/libc.so OLD_FILES+=lib/libcam.so OLD_FILES+=lib/libcrypt.so OLD_FILES+=lib/libcrypto.so OLD_FILES+=lib/libdevstat.so OLD_FILES+=lib/libedit.so OLD_FILES+=lib/libgeom.so OLD_FILES+=lib/libipsec.so OLD_FILES+=lib/libipx.so OLD_FILES+=lib/libkvm.so OLD_FILES+=lib/libm.so OLD_FILES+=lib/libmd.so OLD_FILES+=lib/libncurses.so OLD_FILES+=lib/libreadline.so OLD_FILES+=lib/libsbuf.so OLD_FILES+=lib/libufs.so OLD_FILES+=lib/libz.so # 200304XX OLD_FILES+=usr/lib/libcipher.a OLD_FILES+=usr/lib/libcipher.so OLD_FILES+=usr/lib/libcipher_p.a OLD_FILES+=usr/lib/libgmp.a OLD_FILES+=usr/lib/libgmp.so OLD_FILES+=usr/lib/libgmp_p.a OLD_FILES+=usr/lib/libperl.a OLD_FILES+=usr/lib/libperl.so OLD_FILES+=usr/lib/libperl_p.a OLD_FILES+=usr/lib/libposix1e.a OLD_FILES+=usr/lib/libposix1e.so OLD_FILES+=usr/lib/libposix1e_p.a OLD_FILES+=usr/lib/libskey.a OLD_FILES+=usr/lib/libskey.so OLD_FILES+=usr/lib/libskey_p.a # 200303XX OLD_FILES+=usr/lib/libacl.so OLD_FILES+=usr/lib/libdescrypt.so OLD_FILES+=usr/lib/libf2c.so OLD_FILES+=usr/lib/libg++.so OLD_FILES+=usr/lib/libkdb.so OLD_FILES+=usr/lib/librsaINTL.so OLD_FILES+=usr/lib/libscrypt.so OLD_FILES+=usr/lib/libss.so # 200302XX OLD_FILES+=usr/lib/libacl.a OLD_FILES+=usr/lib/libacl_p.a OLD_FILES+=usr/lib/libkadm.a OLD_FILES+=usr/lib/libkadm.so OLD_FILES+=usr/lib/libkadm_p.a OLD_FILES+=usr/lib/libkafs.a OLD_FILES+=usr/lib/libkafs.so OLD_FILES+=usr/lib/libkafs_p.a OLD_FILES+=usr/lib/libkdb.a OLD_FILES+=usr/lib/libkdb_p.a OLD_FILES+=usr/lib/libkrb.a OLD_FILES+=usr/lib/libkrb.so OLD_FILES+=usr/lib/libkrb_p.a # 200206XX OLD_FILES+=usr/lib/libpam_ssh.a OLD_FILES+=usr/lib/libpam_ssh_p.a # 200203XX OLD_FILES+=usr/lib/libss.a OLD_FILES+=usr/lib/libss_p.a OLD_FILES+=usr/lib/libtelnet.a OLD_FILES+=usr/lib/libtelnet_p.a OLD_FILES+=usr/lib/libusb.a OLD_FILES+=usr/lib/libusb.so OLD_FILES+=usr/lib/libusb_p.a # 200104XX OLD_FILES+=usr/lib/libdescrypt.a OLD_FILES+=usr/lib/libscrypt.a OLD_FILES+=usr/lib/libscrypt_p.a # 20001200 OLD_FILES+=usr/lib/libgcc_r_pic.a # 200009XX OLD_FILES+=usr/lib/libRSAglue.a OLD_FILES+=usr/lib/libRSAglue.so OLD_FILES+=usr/lib/librsaINTL.a OLD_FILES+=usr/lib/librsaUSA.a OLD_FILES+=usr/lib/librsaUSA.so # 200002XX ? OLD_FILES+=usr/lib/libf2c.a OLD_FILES+=usr/lib/libf2c_p.a OLD_FILES+=usr/lib/libg++.a OLD_FILES+=usr/lib/libg++_p.a # 20001006 OLD_FILES+=usr/bin/miniperl # 20000810 OLD_FILES+=usr/bin/sperl* # 199909XX OLD_FILES+=usr/lib/libdesrypt_p.a ## unsorted # do we still support aout builds? #OLD_FILES+=usr/lib/aout/c++rt0.o #OLD_FILES+=usr/lib/aout/crt0.o #OLD_FILES+=usr/lib/aout/gcrt0.o #OLD_FILES+=usr/lib/aout/scrt0.o #OLD_FILES+=usr/lib/aout/sgcrt0.o # 20041001: version bump OLD_LIBS+=lib/libreadline.so.4 OLD_LIBS+=usr/lib/libhistory.so.4 OLD_LIBS+=usr/lib/libopie.so.2 OLD_LIBS+=usr/lib/libpcap.so.2 # 20040925: bind9 import OLD_LIBS+=usr/lib/libisc.so.1 # 200408XX OLD_LIBS+=usr/lib/snmp_netgraph.so.1 # 200403XX OLD_LIBS+=usr/lib/libarchive.so.1 .if ${MACHINE_ARCH} != "alpha" && ${MACHINE_ARCH} != "sparc64" # 20040130: libkse renamed to libpthread OLD_LIBS+=usr/lib/libkse.so.1 .endif # 200404XX OLD_LIBS+=usr/lib/libsnmp.so.1 OLD_LIBS+=usr/lib/snmp_mibII.so.1 # 200309XX OLD_LIBS+=usr/lib/libasn1.so.6 OLD_LIBS+=usr/lib/libhdb.so.6 OLD_LIBS+=usr/lib/libkadm5clnt.so.6 OLD_LIBS+=usr/lib/libkadm5srv.so.6 OLD_LIBS+=usr/lib/libkrb5.so.6 OLD_LIBS+=usr/lib/libroken.so.6 # 200304XX OLD_LIBS+=usr/lib/libc.so.4 OLD_LIBS+=usr/lib/libc_r.so.4 OLD_LIBS+=usr/lib/libdevstat.so.2 OLD_LIBS+=usr/lib/libedit.so.3 OLD_LIBS+=usr/lib/libgmp.so.3 OLD_LIBS+=usr/lib/libmp.so.3 OLD_LIBS+=usr/lib/libpam.so.1 OLD_LIBS+=usr/lib/libposix1e.so.2 OLD_LIBS+=usr/lib/libskey.so.2 OLD_LIBS+=usr/lib/libusbhid.so.0 OLD_LIBS+=usr/lib/libvgl.so.2 # 200302XX OLD_LIBS+=usr/lib/libacl.so.3 OLD_LIBS+=usr/lib/libasn1.so.5 OLD_LIBS+=usr/lib/libcrypto.so.2 OLD_LIBS+=usr/lib/libgssapi.so.5 OLD_LIBS+=usr/lib/libhdb.so.5 OLD_LIBS+=usr/lib/libkadm.so.3 OLD_LIBS+=usr/lib/libkadm5clnt.so.5 OLD_LIBS+=usr/lib/libkadm5srv.so.5 OLD_LIBS+=usr/lib/libkafs.so.3 OLD_LIBS+=usr/lib/libkafs5.so.5 OLD_LIBS+=usr/lib/libkdb.so.3 OLD_LIBS+=usr/lib/libkrb.so.3 OLD_LIBS+=usr/lib/libroken.so. OLD_LIBS+=usr/lib/libssl.so.2 OLD_LIBS+=usr/lib/pam_kerberosIV.so # 200203XX OLD_LIBS+=usr/lib/libss.so.3 OLD_LIBS+=usr/lib/libusb.so.0 # 200112XX OLD_LIBS+=usr/lib/libfetch.so.2 # 200104XX OLD_LIBS+=usr/lib/libdescrypt.so.2 OLD_LIBS+=usr/lib/libscrypt.so.2 # 200102XX OLD_LIBS+=usr/lib/libcrypto.so.1 OLD_LIBS+=usr/lib/libssl.so.1 # 200009XX OLD_LIBS+=usr/lib/libRSAglue.so.1 OLD_LIBS+=usr/lib/librsaINTL.so.1 OLD_LIBS+=usr/lib/librsaUSA.so.1 # 200006XX OLD_LIBS+=usr/lib/libalias.so.3 OLD_LIBS+=usr/lib/libfetch.so.1 OLD_LIBS+=usr/lib/libipsec.so.0 # 200005XX OLD_LIBS+=usr/lib/libxpg4.so.2 # 200002XX OLD_LIBS+=usr/lib/libc.so.3 OLD_LIBS+=usr/lib/libcurses.so.2 OLD_LIBS+=usr/lib/libdialog.so.3 OLD_LIBS+=usr/lib/libedit.so.2 OLD_LIBS+=usr/lib/libf2c.so.2 OLD_LIBS+=usr/lib/libftpio.so.4 OLD_LIBS+=usr/lib/libg++.so.4 OLD_LIBS+=usr/lib/libhistory.so.3 OLD_LIBS+=usr/lib/libmytinfo.so.2 OLD_LIBS+=usr/lib/libncurses.so.3 OLD_LIBS+=usr/lib/libreadline.so.3 OLD_LIBS+=usr/lib/libss.so.2 OLD_LIBS+=usr/lib/libtermcap.so.2 OLD_LIBS+=usr/lib/libutil.so.2 OLD_LIBS+=usr/lib/libvgl.so.1 OLD_LIBS+=usr/lib/libwrap.so.2 # 199909XX OLD_LIBS+=usr/lib/libc_r.so.3 OLD_DIRS+= OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, else you may kill such an application. Consult UPDATING for more information." .if !defined(BATCH_DELETE_OLD_FILES) RM_I=-i .endif delete-old-files: .if defined(${TARGET_ARCH}) .error "You have to run this in a native environment!" .endif @echo ">>> Removing old files (only deletes safe to delete libs)" .for file in ${OLD_FILES} # Ask for every old file if the user really wants to remove it. # It's anoying, but beter safe than sorry. # This doesn't handle noschg files, an user should remove this on his # own. @[ ! -f "${DESTDIR}/${file}" ] || rm ${RM_I} "${DESTDIR}/${file}" .endfor @echo ">>> Old files removed" delete-old-libs: .if defined(${TARGET_ARCH}) .error "You have to run this in a native environment!" .endif @echo ">>> Removing old libraries" @echo "${OLD_LIBS_MESSAGE}" | fmt .for file in ${OLD_LIBS} @[ ! -f "${DESTDIR}/${file}" ] || rm ${RM_I} "${DESTDIR}/${file}" .endfor @echo ">>> Old libraries removed" delete-old-dirs: .if defined(${TARGET_ARCH}) .error "You have to run this in a native environment!" .endif @echo ">>> Removing old directories" .for dir in ${OLD_DIRS} # Don't fail if an old directory isn't empty. @[ ! -d "${DESTDIR}/${dir}" ] || (rmdir -v "${DESTDIR}/${dir}" || true) .endfor @echo ">>> Old directories removed" delete-old: delete-old-files delete-old-dirs @echo "To remove old libraries run 'make delete-old-libs'." --Multipart=_Sat__16_Oct_2004_14_25_02_+0200_fa0wt.u_FDjLyQ4j--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041016142502.6362d396>