DSL Tips and Tricks :: dsl2unc



This evening I found myself making a unc extension from Robert's instructions and thought - why not a little script?

And 10 minutes or so later ... dsl2unc ! (With apologies to CBagger's deb2dsl).

Again, this is just an automated version of the instructions that Robert posted a while back, no creativity on my part required.

This seemed to convert the .dsl extensions I tried it on ok.  

Code Sample
#!/bin/bash

# dsl2unc
# Just automates Robert's instructions for making a unc extension from a dsl.
# WDef Sept `06

help(){
cat <<"EOF"
Usage: dsl2unc /PATH/TO/EXTENSION
Creates a work dir in /home/dsl
New unc is output in /home/dsl
EOF
exit
}

#==================================================================

. /etc/init.d/dsl-functions # for ANSI colors

APP=${1}

if [ "$APP" = -h ] || [ "$APP" = --help ] || [ $# -ne 1 ];then help; fi
if [ ! -e "${APP}" ]; then echo "Can't find ${APP}"; exit 1; fi

if [ ${APP##*.} != dsl ]; then echo "${APP} is not a .dsl extension."; exit 1; fi

NAME=$(basename ${APP} .dsl)
WORK=${HOME}/$NAME

if [ -e "${WORK}" ]; then echo "${WORK} already exists."; exit 1; fi

mkdir ${WORK}

echo
echo "${WHITE}Making ${GREEN}$NAME.unc${WHITE} from ${YELLOW}$NAME.dsl ..${NORMAL}"
echo

cd ${WORK}
tar -zxvf ${APP}
find home tmp -type f 2>/dev/null | xargs tar -czvf user.tar.gz 2>/dev/null
rm -rf home tmp

cd ..

mkisofs -R -hide-rr-moved -cache-inodes -pad ${WORK} | create_compressed_fs - 65536 >$NAME.unc || exit 1
echo
echo "${GREEN}Finished. Now test your new ${YELLOW}$NAME.unc!${NORMAL}"


exit 0

Stony silence,  ok, it's not rocket science, but it beats typing the same commands over and over again.

That 'find' line and 'rm' line following should include the opt directory if it's to work on all .dsl's, since a few have install-type scripts lurking in opt ie

Code Sample
find home opt tmp -type f 2>/dev/null | xargs tar -czvf user.tar.gz 2>/dev/null
rm -rf home opt tmp

Your work is appreciated =o)

Personally I don't have great interest in unc, as long as unc changes are not easily reversible...uci are more than adequate.

Your tar creation interests me, however.  I've never really done anything with xargs, since i still don't understand how it works, but this method at least saves having to write a file list.

One thing I've wondered about, though -- not just in this script but in general -- if using "-type -f" might limit or even break some extensions. If an extension includes one or more symlinks, or even an empty directory, would those be excluded?

It is a shame that it seems that uncs and not that well understood.
As far as reversible let me address that...

Ucis are self contained and therefore easiy and dynamatically "loaded" and "unloaded".

dsls are memory hungry and "install" into the base (ramdisk) filesystem that has been made writeable. They, dsls cannot be "uninstalled". They can and do "uninstall" in a frugal/liveCD environment because they were in ram (ramdisk) so upon a shutdown/reboot they are gone.

Uncs are like ucis in that they are mounted under /opt. However they use unionfs to overlay the base filesystem. So you get extrememly low memory requirements to get the same benefits as a dsl.

Like dsls uncs are not self-contained and because they overlay the base filesystem many other processes could be using some or all of the overlayed resources. For example gtk2 and the latest gtk2 apps. Each is not self contained and as dsls they occupy much memory and on low memory machines they are often not possible to run. As uncs they can. But trying to "unload" gtk2 while they system is running a gtk2 app would be disaster. And on the other hand, to include gtk2 into each and every gtk2 apps would be much wasted space and download time.

Uncs also have the same benefit as ucis as upon shutdown/reboot their mounts go away, you always start with a pristine known system. A simple script could be used to "install" a unc onto a traditional hard drive install. But, I would wonder why it would even be necessasy or desireable.

Change is always resisted. Perhaps moving forward and with contributions such as dsl2unc, some of the many benefits of unc type extensions will become realized.

I known I am using cups.unc and XFree86.unc on a machine that could not otherwise use their dsl conterparts.

All DSL extensions use the same procedure to persist via the mydsl boot option and mydsl directory.

Quote
with contributions such as dsl2unc
One reason I posted this simple convenience is I know people enjoy using little tools (especially with ANSI colors, or pop-up boxes, I know I do). Rows of command line stuff is intimidating to newbies, so I'm hoping this will get people making some more uncs.  I made 6 uncs effortlessly within minutes of finishing this. Psychologically, deb2dsl is more satisfying because the user has to type things into boxes (ie participates more => more ownership). Probably should add a few boxes ;=)

Uncs are great, a huge improvment on dsls (thanks to Robert). Ucis will probably (?) remain the "queen" of extensions - they don't require unionfs and they don't put anything irreversibly on the system filesystem.

But some things will never be ucis alone.  An example is gnupg. I built a gnupg.uci that works (haven't got round to sending it to the repo). However, some applications that use gnupg-encrypted keys (an example is aespipe, another is loop-aes) expect to find gpg in one and only one place: /usr/bin/gpg.  Whether or not gpg is in PATH anyway is irrelevant to these apps.  I suspect there are other similar examples about. So there will remain a technical need to have gnupg.dsl or a gnupg.unc in addition to gnupg.uci.   (You could run a wrapper to set up the symlink gpg -> /usr/bin/gpg, but this means running /etc/init.d/mkwriteable. Actually, the loop-aes author says you must physically *move* the gpg binary to /bin and then do a symlink /bin/gpg -> /usr/bin/gpg - who am I to argue with someone like Jari Russu?)

Quote
if using "-type -f" might limit or even break some extensions. If an extension includes one or more symlinks, or even an empty directory


Good point.  Without that -type f, will get clobbering directories like /opt/bin passed into the unc (clang!).  There's ways around that.  I wrote an unrelated script (buried on my hd somewhere) with some bash that removed clobberers - I'll dig it up.

Next Page...
original here.