Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (6) </ 1 [2] 3 4 5 6 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: dsl2unc, .unc extensions made easy< Next Oldest | Next Newest >
WDef Offline





Group: Members
Posts: 798
Joined: Sep. 2005
Posted: Sep. 21 2006,16:16 QUOTE

v0.2 - Testers wanted.

Now converts multiple dsls.
(Indenting seems to get lost when posting unfortunately).
==========================================

Code Sample
#!/bin/bash

# dsl2unc v0.2

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

# Changelog v0.2

# Handles symlinks, opt and empty directories in user.tar.gz.
# Current working directory is assumed if path to argument extension is not given.
# Runs in batch mode: converts all argument .dsls to .uncs
#- eg to process somedirectory full of extensions, if dsl2unc is in PATH:
#- cd somedirectory; dsl2unc *
# Directory $DIR for $WORK and output is now settable.
# More lurid coloring :=)

#==========================// USER SETTING//===============================

# Put DIR on a hard drive partition if insufficient room in /ramdisk/home/dsl
DIR=/home/dsl

#==========================// FNS //========================================

help(){
cat <<"EOF"
dsl2unc v0.2 - convert .dsl extension to .unc
Usage: dsl2unc </path/to/ext1.dsl /path/to/ext2.dsl ..>
Creates a work dir in $DIR
New unc(s) is output in $DIR
Default DIR=/home/dsl
EOF
exit
}


dir_filter(){
# Filter out non-empty dir lines from stdin
while read LM; do
if [ -d "${WORK}/$LM" ]; then
if [ $(ls -1A ${WORK}/$LM| wc -l) -eq 0 ]; then
# empty dir - ok
echo ${LM}
fi
else
# files, symlinks - ok
echo ${LM}
fi
done
}

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


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

results=/tmp/dsl2unc_results

rm -f ${results}

if [ "${1}" = -h ] || [ "${1}" = --help ] || [ $# -eq 0 ]; then help; fi

CURRENTD="${PWD}"
APP=""

for APP in $*; do

# If no path supplied, assume current working dir
[ $(echo ${APP} | tr '/' ' '| wc -w) -eq 1 ] && APP="${CURRENTD}/${APP}"

if [ ! -e "${APP}" ]; then
echo "${RED}Can't find ${APP}${NORMAL}" >>${results}
continue
fi

if [ ${APP##*.} != dsl ]; then echo "${RED}${APP} is not a .dsl extension.${NORMAL}" >>${results}; continue; fi

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

if [ -e "${WORK}" ]; then echo "${RED}${WORK} already exists.${NORMAL}" >>${results}; continue; fi

mkdir ${WORK}

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

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

cd ..

mkisofs -R -hide-rr-moved -cache-inodes -pad ${WORK} | create_compressed_fs - 65536 >$NAME.unc
if [ $? -ne 0 ]; then echo "${RED}Error making $NAME.unc" >>${results}; continue; fi
echo
echo "${GREEN}Now test your new ${YELLOW}$NAME.unc!${NORMAL}"

echo "${YELLOW}$NAME.dsl${WHITE} --> ${GREEN}$NAME.unc${NORMAL}" >>${results}
done

echo
echo "======================================================================"
echo
echo "${WHITE}DSL2UNC ${WHITE}RESULTS:${NORMAL}"
echo
cat ${results}
echo
echo "======================================================================"
echo "${GREEN}Finished.${NORMAL}"

exit 0
Back to top
Profile PM 
curaga Offline





Group: Members
Posts: 2163
Joined: Feb. 2007
Posted: Mar. 23 2007,06:13 QUOTE

I had trouble with this (v2)
It had many errors and created a 2.6k unc from a 160k .dsl..
It also managed to !change! the md5sum of the .dsl!!

So improvement requested....


--------------
There's no such thing as life. Those mean little jocks invented it ;)
-
Windows is not a virus. A virus does something!
Back to top
Profile PM 
WDef Offline





Group: Members
Posts: 798
Joined: Sep. 2005
Posted: Mar. 23 2007,12:59 QUOTE

Pls provide some more information viz.
which extension were you trying to convert?
Back to top
Profile PM 
curaga Offline





Group: Members
Posts: 2163
Joined: Feb. 2007
Posted: Mar. 23 2007,16:16 QUOTE

grub-splash. About half of the errors were from tar, but I don't remember them anymore..
Though it works when installing it..

The result unc only had one file, /sbin/grub-floppy (that's what read there) and the working dir also had only that..


--------------
There's no such thing as life. Those mean little jocks invented it ;)
-
Windows is not a virus. A virus does something!
Back to top
Profile PM 
WDef Offline





Group: Members
Posts: 798
Joined: Sep. 2005
Posted: Mar. 23 2007,19:17 QUOTE

I don't think that's posted yet.

Can you email it to me or upload it somewhere so I can attempt to replicate your issue?
Back to top
Profile PM 
25 replies since Sep. 14 2006,19:06 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (6) </ 1 [2] 3 4 5 6 >/
reply to topic new topic new poll
Quick Reply: dsl2unc

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code