On January i wrote a personal script to keep my package list and latest conf files on a backup-snapshot mechanism: abs4snap . Page on wiki: abs4snap for archlinux.
Today i wanted to delete some libraries from /usr/lib/ folder path!
And i did a little mistake :(
I wanted to write:
rm -f /usr/lib/libjsp*
but i wrote:
rm -f /usr/lib/lib*
Simple as that my distro (archlinux) becomes a jigsaw puzzles !
Just pieces here and there !
What the f@#$% i could do to save my distro ?
I am using archlinux, so my package manager is: pacman, but pacman uses libraries from /usr/lib folder path !
The solution was to reinstall my distro of course.
Or there is another way ?
A couple days before, i wrote a post how to build a static binary with: statifier. So i had my pacman package list and a pacman static binary file !
The solution was in front of me.
awk '{print "pacman-static -S --noconfirm " $1}' package-list | sh
And with in a few minutes my distro and /usr/lib was in perfect mode again !!!
So remember:
BACKUP your data.
A nice (but not perfect) tool to create a static package is: statifier
Here is a simple but useful mini how to:
(as root)
# echo -n 0 > /proc/sys/kernel/randomize_va_space
# ldd /usr/bin/pacman
linux-gate.so.1 => (0xb7fe1000)
libalpm.so.5 => /usr/lib/libalpm.so.5 (0xb7fa8000)
libc.so.6 => /lib/libc.so.6 (0xb7e5d000)
libfetch.so => /usr/lib/libfetch.so (0xb7e4f000)
libarchive.so.2 => /usr/lib/libarchive.so.2 (0xb7e0f000)
/lib/ld-linux.so.2 (0xb7fe2000)
libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0xb7dbd000)
libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0xb7c43000)
libacl.so.1 => /lib/libacl.so.1 (0xb7c3c000)
libattr.so.1 => /lib/libattr.so.1 (0xb7c37000)
libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb7c11000)
liblzma.so.0 => /usr/lib/liblzma.so.0 (0xb7bef000)
libbz2.so.1.0 => /lib/libbz2.so.1.0 (0xb7bde000)
libz.so.1 => /usr/lib/libz.so.1 (0xb7bc9000)
libdl.so.2 => /lib/libdl.so.2 (0xb7bc5000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb7bab000)
# statifier /usr/bin/pacman /tmp/pacman.static-3.4.0
# ldd /tmp/pacman.static-3.4.0
not a dynamic executable
# ls -l /usr/bin/pacman /tmp/pacman.static-3.4.0
-rwxr-xr-x 1 root root 4530176 2010-07-30 20:47 /tmp/pacman.static-3.4.0
-rwxr-xr-x 1 root root 70708 2010-06-21 15:54 /usr/bin/pacman
A simple python script to deduplicate a mailbox (mbox format).
#!/usr/bin/env python
# Created by Evaggelos Balaskas on Thu Jul 29 21:22:41 EEST 2010
# Remove duplicate mails from mbox using message-id
import sys
import mailbox
if len(sys.argv) == 2:
mid = []
for message in mailbox.mbox( sys.argv[1] ) :
s = message['message-id']
if s not in mid:
mid.append(s)
print message
else:
print "Usage should be: " + sys.argv[0] + " mbox > new.mbox"
You can take a look, also, on my other python script: How to remove specific mails from a mbox by subject