www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - linux install script

reply BCS <BCS pathlink.com> writes:
I wrote a script that downloads and installs dmd on linux

here it is for whatever it's worth:

#### get dmd.zip
ftp << E
open ftp.digitalmars.com
binary
get dmd.zip
bye
E

#### clear space for dmd (this can be dumped if you don't like it)
rm -rf dmd/

#### extract files
unzip -o -q dmd.zip

#### find where to put man files
MAND=` man -w | sed  "s/:.*//"`

#### get old version num.
DMDVER=`dmd | grep Comp | sed "s/.*v//"`

#### save old stuff (off by default)
# mv /usr/bin/dmd /usr/bin/dmd.$DMDVER
# mv /usr/lib/libphobos.a /usr/lib/libphobos.a.$DMDVER
# mv /usr/include/phobos /usr/include/phobos.$DMDVER
# mv $MAND/man1/dmd.1 $MAND/man1/dmd.$DMDVER.1

#### copy dmd to the correct place
cp dmd/bin/dmd /usr/bin/dmd
chmod 755 /usr/bin/dmd

#### copy libphobos.a
cp dmd/lib/libphobos.a /usr/lib/libphobos.a
chmod 644 /usr/lib/libphobos.a

#### copy phobos source
cp -r dmd/src/phobos /usr/include/phobos
chmod 755 /usr/include/phobos
find /usr/include/phobos -type d -exec chmod 755 "{}" ";"
find /usr/include/phobos -type f -exec chmod 644 "{}" ";"

#### copy
cp dmd/man/man1/dmd.1 $MAND/man1/dmd.1
chmod 644 $MAND/man1/dmd.1

#### save old dmd docs
# mv /var/www/html/dmd /var/www/html/dmd.$DMDVER

#### install dmd docs for httpd
# cp -r dmd/html/ /var/www/html/dmd
# chown apache:apache -R /var/www/html/dmd/
# find /var/www/html/dmd -type d -exec chmod 755 "{}" ";"
# find /var/www/html/dmd -type f -exec chmod 444 "{}" ";"
Jun 20 2007
next sibling parent BCS <ao pathlink.com> writes:
Reply to BCS,

 I wrote a script that downloads and installs dmd on linux
 
 here it is for whatever it's worth:
 

I forgot to point out: the script should be run as root
Jun 21 2007
prev sibling parent Bruno Medeiros <brunodomedeiros+spam com.gmail> writes:
BCS wrote:
 I wrote a script that downloads and installs dmd on linux
 
 here it is for whatever it's worth:

Let me share my install script for Windows as well. It downloads the latest dmd, unpacks it, copies the previous DMD version to an archive dir, and does a diff of the html doc. It requires MINGW/CYGWIN and tools like wget, grep, unzip, diff. I could improve this script (to clean some trivial html doc differences) if I knew a way to do multi-line regexp substitutions. What I know of sed only does substitutions inside each line. ------------------------------ #!/bin/sh # DMD install script, requires wget, grep, unzip, diff, DMDARCHIVEDIR="dmd-archive" DMDINSTALLDIR="." DMDBASEURL="http://www.digitalmars.com/d" # Use URL below for 1.0 series #DMDBASEURL="http://www.digitalmars.com/d/1.0" wget -nv $DMDBASEURL/changelog.html -O changelog.html URLKEY="ftp.digitalmars.com/dmd\.[1-4].[0-9][0-9][0-9]\.zip" DMDURL=`grep -G -o "$URLKEY" changelog.html | line -n 1` rm changelog.html # Uncomment the following to download a specific version #DMDURL=ftp.digitalmars.com/dmd.1.011.zip echo ">>" DMDURL: $DMDURL DMDVER=`echo $DMDURL | grep -G -o "[1-4].[0-9][0-9][0-9]"` DMDVERMAJOR=`echo $DMDVER | grep -G -o "[1-4]\\."` DMDVERMINOR=`echo $DMDVER | grep -G -o "[0-9][0-9][0-9]"` DMDVEROLD=`$DMDINSTALLDIR/dmd/bin/dmd | grep Compiler | sed "s/.*v//"` echo ">>" DMDVER: $DMDVER Major: $DMDVERMAJOR Minor: $DMDVERMINOR DMDVEROLD: $DMDVEROLD wget -nv http://$DMDURL -O dmd.$DMDVER.zip # copy to the archives mkdir -p $DMDARCHIVEDIR/dmd-$DMDVER unzip -o -q "dmd.$DMDVER.zip" -d $DMDARCHIVEDIR/dmd-$DMDVER # clean the old DMD, and install the new rm -R $DMDINSTALLDIR/dmd unzip -o -q "dmd.$DMDVER.zip" -d $DMDINSTALLDIR rm "dmd.$DMDVER.zip" if grep -q CYGWIN <<< `uname`; then echo ">>" Doing Windows fix for cygwin/mingw shells # Do Windows fix, the linux non .exe files confuse cygwin/mingw shells rm $DMDINSTALLDIR/dmd/bin/dmd rm $DMDINSTALLDIR/dmd/bin/rdmd rm $DMDINSTALLDIR/dmd/bin/obj2asm fi; ##### Diff analysis ##### DMDVERMINOR_NOZEROES=`sed -e "s/^0\+/ /" <<< $DMDVERMINOR` # use printf to pad DMDVERMINOR-1 with zeros # must have no trailing zeroes otherwise it's interpreted as an octal DMDVERPREV=$DMDVERMAJOR`printf %03i $[DMDVERMINOR_NOZEROES-1]` # Use (current_version - 1) as the old version for diff comparison #DMDVEROLD=DMDVERPREV echo ">>" Generating diff for $DMDVEROLD "->" $DMDVER DOCDIRNEW=$DMDARCHIVEDIR/dmd-$DMDVER/dmd/html/d DOCDIROLD=$DMDARCHIVEDIR/dmd-$DMDVEROLD/dmd/html/d echo ">>" Running diff -ruN $DOCDIROLD $DOCDIRNEW echo ">> Output: >" "$DMDARCHIVEDIR/dmd-$DMDVEROLD-$DMDVER.diff.txt" diff -ruN $DOCDIROLD $DOCDIRNEW > "$DMDARCHIVEDIR/dmd-$DMDVEROLD-$DMDVER.diff.txt" ############### Some regexp util ################## # -[0-9]*,7 \+[0-9]*,7 .*\n.*\n.*\n.*\n-.*lastupdate.*\n\+.*lastupdate.*\n.*\n.*\n.*\n #---.*\n\+\+\+.*\n--- #Index: .*\n=====.*\n---.*\n\+\+\+.*\nIndex # -[0-9]*,7 \+[0-9]*,7 .*\n.*\n.*\n.*\n-.*D Programming Language.*\n+.*D Programming Language 1.0.*\n.*\n.*\n.*\n -- Bruno Medeiros - MSc in CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
Jun 23 2007