Tag: scripting

Fast appending files to tar archive is impossible.

Eventually, tar is very slow for appending files to the existing tarball. I’m particularly talking about following options:

-r – append files to the end of an archive
-u – only append files newer than copy in archive

Logically thinking, for -u to work, it should accomplish linear search through the archive. Than bigger the archive, than slower the search. Moreover, if you’ll try to append in the loop, it will accomplish search as many times as many iterations you loop has. I would advice to use in the most exceptional case ONLY. Try avoiding

# -u. slow inefficient approach of taring multiple files
for file in $(ls -A)
    tar -uf tarball.tar $file;		#traverses all archive to append the file.

You’d think that -r option usage forces tar application to append files to the end of the archive, getting the position of the archive’s end from archive’s index. It doesn’t. Tar format is designed in a way that it has no index.

# -r approach is also slow and inefficient
for file in $(ls -A)
    tar -rf tarball.tar $file;		#traverses all archive to append the file.

However, TAR supports several formats for its archive. But they are not well-documented. I had a brief overview of them, and looks like
–format=gnu is the most recent and featured one. And It still has no index. I no longer understand why tar is even used. Despite of that, below is a workaround, allowing for packing unlimited amounts of files right instant. I recommend to never use append function with tar format. Instead, get to know what are you going to archive, prepare necessary files, and archive them all.

# faster approach for taring multiple files. No appending
ls -A >> list.txt
tar -cT list.txt -f backup.tar

Fedora 10 Proprietary Soft Installation Script

When I Migrated to Fedora 10, I wrote small script, which was installing most common proprietary software I needed and updates system. I didn’t publish it, because I thought that it is useless and “do not publish all crap you think matters”. But this script was used more than twice by me, so Here it is. Just run it as Root.

su -c '
#Installing proprietary repositories
#rpm fusion
rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm;
rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm;
#installing software
yum -y install  kmod-nvidia stardict fusion-icon flash-plugin gnome-mplayer audacity xine-lib-extras-nonfree vlc libdvdread gstreamer-plugins* libmad libid3tag id3v2 xine-lib-extras-nonfree kdemultimedia-extras-nonfree wine unrar ida stardict azureus;
#updating sustem
yum -y update;
#healing fedora-after-update-bug
rm -rf /var/lib/rpm/__db.*;

UPDATE: I was pointed to a more robust script for additional soft installation for fedora.FedoMATIX