Difference between revisions of "User:Lunaryn"

From CBLFS
Jump to navigationJump to search
(Initial page creation)
 
m (un-urling wget params)
Line 36: Line 36:
 
  FILENAME="$2"
 
  FILENAME="$2"
 
  cd /sources
 
  cd /sources
  wget "http://search.cpan.org/CPAN/authors/id/${PACKER:0:1}/${PACKER:0:2}/${PACKER}/${FILENAME}"
+
  wget "http://search.cpan.org/CPAN/authors/id/${PACKER:0:1}/${PACKER:0:2}/${PACKER}/${FILENAME}"
  
 
getgnome: (Segmented syntax only)
 
getgnome: (Segmented syntax only)
Line 49: Line 49:
 
  VER="$(echo ${VERSION} | awk -F. '{ print $1 "." $2 }')"
 
  VER="$(echo ${VERSION} | awk -F. '{ print $1 "." $2 }')"
 
  cd /sources
 
  cd /sources
  wget "http://ftp.gnome.org/pub/gnome/sources/${PACKAGE}/${VER}/${PACKAGE}-${VERSION}.${EXT}"
+
  wget "http://ftp.gnome.org/pub/gnome/sources/${PACKAGE}/${VER}/${PACKAGE}-${VERSION}.${EXT}"
  
 
getgnu: (Filename syntax -- NOTE: Does not work for gcc without a workaround)
 
getgnu: (Filename syntax -- NOTE: Does not work for gcc without a workaround)
Line 61: Line 61:
 
  fi
 
  fi
 
  cd /sources
 
  cd /sources
  wget "http://ftp.gnu.org/gnu/${PACKAGE}/${FILENAME}"
+
  wget "http://ftp.gnu.org/gnu/${PACKAGE}/${FILENAME}"
  
 
I recommend using the segmented syntax instead, but this option is provided since I did happen to make one. For gcc, specify the version subdir as part of the "package" name, e.g. getgnu gcc-4.4.1.tar.gz gcc/gcc-4.4.1
 
I recommend using the segmented syntax instead, but this option is provided since I did happen to make one. For gcc, specify the version subdir as part of the "package" name, e.g. getgnu gcc-4.4.1.tar.gz gcc/gcc-4.4.1
Line 75: Line 75:
 
  cd /sources
 
  cd /sources
 
  if [ "$PACKAGE" = "gcc" ]; then
 
  if [ "$PACKAGE" = "gcc" ]; then
    wget "http://ftp.gnu.org/gnu/gcc/gcc-${VERSION}/gcc-${VERSION}.${EXT}"
+
    wget "http://ftp.gnu.org/gnu/gcc/gcc-${VERSION}/gcc-${VERSION}.${EXT}"
 
  else
 
  else
    wget "http://ftp.gnu.org/gnu/${PACKAGE}/${PACKAGE}-${VERSION}.${EXT}"
+
    wget "http://ftp.gnu.org/gnu/${PACKAGE}/${PACKAGE}-${VERSION}.${EXT}"
 
  fi
 
  fi
 
  md5sum "${PACKAGE}-${VERSION}.${EXT}"
 
  md5sum "${PACKAGE}-${VERSION}.${EXT}"
Line 96: Line 96:
 
  fi
 
  fi
 
  cd /sources
 
  cd /sources
  wget "http://downloads.sourceforge.net/${PACKAGE}/${FILENAME}?use_mirror=${MIRROR}"
+
  wget "http://downloads.sourceforge.net/${PACKAGE}/${FILENAME}?use_mirror=${MIRROR}"
  
 
You may wish to change the default mirror based on your location (I think easynews may not be valid anymore anyway). Note that you will need to specify the "package" name (project) more often here than with most other scripted sites, but the majority of packages still 'guess' correctly.
 
You may wish to change the default mirror based on your location (I think easynews may not be valid anymore anyway). Note that you will need to specify the "package" name (project) more often here than with most other scripted sites, but the majority of packages still 'guess' correctly.
Line 122: Line 122:
 
  cd /sources
 
  cd /sources
 
  if [ "$BOOKVER" = cblfs ]; then
 
  if [ "$BOOKVER" = cblfs ]; then
    wget "http://svn.cross-lfs.org/svn/repos/patches/${PACKAGE}/${PACKAGE}-${VERSION}-${PATCHNAME}-${PATCHVER}.patch"
+
    wget "http://svn.cross-lfs.org/svn/repos/patches/${PACKAGE}/${PACKAGE}-${VERSION}-${PATCHNAME}-${PATCHVER}.patch"
 
  else
 
  else
    wget "http://patches.cross-lfs.org/${BOOKVER}/${PACKAGE}-${VERSION}-${PATCHNAME}-${PATCHVER}.patch"
+
    wget "http://patches.cross-lfs.org/${BOOKVER}/${PACKAGE}-${VERSION}-${PATCHNAME}-${PATCHVER}.patch"
 
  fi
 
  fi
 
  md5sum "${PACKAGE}-${VERSION}-${PATCHNAME}-${PATCHVER}.patch"
 
  md5sum "${PACKAGE}-${VERSION}-${PATCHNAME}-${PATCHVER}.patch"
Line 135: Line 135:
 
  cd /sources
 
  cd /sources
 
  if [ "$BOOKVER" = blfs ]; then
 
  if [ "$BOOKVER" = blfs ]; then
    wget "http://www.linuxfromscratch.org/patches/blfs/svn/$FILE"
+
    wget "http://www.linuxfromscratch.org/patches/blfs/svn/$FILE"
 
  else
 
  else
    wget "http://www.linuxfromscratch.org/patches/lfs/$BOOKVER/$FILE"
+
    wget "http://www.linuxfromscratch.org/patches/lfs/$BOOKVER/$FILE"
 
  fi
 
  fi
 
  md5sum "$FILE"
 
  md5sum "$FILE"
  
 
BLFS usage presumes using the dev trunk, which is probably the case for many users given how much the stable books lag behind LFS. If you do use this you may want to tweak it further. If you prefer segmented syntax, it should be trivial to modify the C[B]LFS version above to that end.
 
BLFS usage presumes using the dev trunk, which is probably the case for many users given how much the stable books lag behind LFS. If you do use this you may want to tweak it further. If you prefer segmented syntax, it should be trivial to modify the C[B]LFS version above to that end.

Revision as of 01:03, 8 January 2010

CLFS user for x86_64 multilib and formerly x86_64 pure64 (pure64 system was migrated back to LFS 6.5), also using CBLFS for LFS 6.5 systems.

Here are a small collection of scripts that have proven useful with [C][B]LFS. They are intended primarily for users who have their browsers on a different system/console than their software builds, and thus cannot download source packages by clicking links, nor copy/paste commands into the build shell.

docdir-inst:

#!/bin/bash
# This script assists in the manual install of documentation.
# The primary purpose is to avoid needing to type out the package name and version.
DIRNAME="$PWD"
while [ -z "$PACKAGE" ]; do
  TMPDN="$(basename "$DIRNAME")"
  DIRNAME="$(dirname "$DIRNAME")"
  if [[ "$TMPDN" =~ .*-.*\..* ]]; then
    PACKAGE="$TMPDN"
  elif [ "$DIRNAME" = "/" ]; then
    echo "Unable to discern package name. Try invoking as:"
    echo "PACKAGE=<package name> $0 [<files>]"
    exit 1
  fi
done
[ -n "$SUBDIR" ] && PACKAGE="$(PACKAGE}/${SUBDIR}"
install -v -m755 -d "/usr/share/doc/$PACKAGE"
until [ -z "$1" ]; do
  install -v -m644 "$1" "/usr/share/doc/$PACKAGE"
  shift
done

Invoke without parameters to create an empty directory for the package under /usr/share/doc, for the sake of shell completion in typing a later command. Specifying files as parameters causes those files to be installed in the directory as well. Setting the SUBDIR variable when invoking allows you to install into a subdirectory of the package doc directory, e.g. /usr/share/doc/package-#.#.#/html (SUBDIR=html docdir-inst doc/html/*)

getcpan:

#!/bin/bash
# Downloads packages from CPAN. Usage: getcpan <packer> <filename>
PACKER="$1"
FILENAME="$2"
cd /sources
wget "http://search.cpan.org/CPAN/authors/id/${PACKER:0:1}/${PACKER:0:2}/${PACKER}/${FILENAME}"

getgnome: (Segmented syntax only)

#!/bin/bash
# Downloads packages from ftp.gnome.org. Usage: getgnome <package> <version>
PACKAGE="$1"
VERSION="$2"
if [ -z "$EXT" ]; then
  EXT="tar.bz2"
fi
VER="$(echo ${VERSION} | awk -F. '{ print $1 "." $2 }')"
cd /sources
wget "http://ftp.gnome.org/pub/gnome/sources/${PACKAGE}/${VER}/${PACKAGE}-${VERSION}.${EXT}"

getgnu: (Filename syntax -- NOTE: Does not work for gcc without a workaround)

#!/bin/bash
# Downloads packages from ftp.gnu.org. Usage: getgnu <filename> [<package>]
PACKAGE="$2"
FILENAME="$1"
if [ -z "$PACKAGE" ]; then
  PACKAGE="$(echo ${FILENAME} | sed 's/-[0-9].*$//')"
fi
cd /sources
wget "http://ftp.gnu.org/gnu/${PACKAGE}/${FILENAME}"

I recommend using the segmented syntax instead, but this option is provided since I did happen to make one. For gcc, specify the version subdir as part of the "package" name, e.g. getgnu gcc-4.4.1.tar.gz gcc/gcc-4.4.1

getgnu: (Segmented syntax)

#!/bin/bash
# Downloads packages from ftp.gnu.org. Usage: getgnu <package> <version> [<extension>]
PACKAGE="$1"
VERSION="$2"
EXT="$3"
[ -z "$3" ] && EXT="tar.bz2"
cd /sources
if [ "$PACKAGE" = "gcc" ]; then
  wget "http://ftp.gnu.org/gnu/gcc/gcc-${VERSION}/gcc-${VERSION}.${EXT}"
else
  wget "http://ftp.gnu.org/gnu/${PACKAGE}/${PACKAGE}-${VERSION}.${EXT}"
fi
md5sum "${PACKAGE}-${VERSION}.${EXT}"

You may wish to change the default extension to tar.gz since most ftp.gnu.org packages are packaged as tar.gz, but I preferred to keep it as tar.bz2 for the sake of [C]LFS package verification when preparing for a new system build; any package that can be downloaded as tar.bz2 generally is there, so there's less chance of a mistake.

getsf: (Filename syntax only)

#!/bin/bash
# Downloads packages from sourceforge. Usage: getsf <filename> [<project>]
PACKAGE="$2"
FILENAME="$1"
if [ -z "$PACKAGE" ]; then
  PACKAGE="$(echo ${FILENAME} | sed 's/-[0-9].*$//')"
fi
if [ -z "$MIRROR" ]; then
  MIRROR="easynews"
fi
cd /sources
wget "http://downloads.sourceforge.net/${PACKAGE}/${FILENAME}?use_mirror=${MIRROR}"

You may wish to change the default mirror based on your location (I think easynews may not be valid anymore anyway). Note that you will need to specify the "package" name (project) more often here than with most other scripted sites, but the majority of packages still 'guess' correctly.

getsrc: (Only bother with this if you build sources in a different directory than you keep the tarballs)

#!/bin/bash
# Generic wrapper script for wget. This is used to make sure source packages
# end up in a central location.
cd /sources
wget "$1"

getpatch: (C[B]LFS version)

#!/bin/bash
# Downloads C[B]LFS patches. Usage: getpatch <package> <version> <patchname> <patchver>
PACKAGE="$1"
VERSION="$2"
PATCHNAME="$3"
PATCHVER="$4"
if [ -z "$PATCHVER" ]; then
  PATCHVER="1"
fi
[ -z "$BOOKVER" ] && BOOKVER=cblfs
cd /sources
if [ "$BOOKVER" = cblfs ]; then
  wget "http://svn.cross-lfs.org/svn/repos/patches/${PACKAGE}/${PACKAGE}-${VERSION}-${PATCHNAME}-${PATCHVER}.patch"
else
  wget "http://patches.cross-lfs.org/${BOOKVER}/${PACKAGE}-${VERSION}-${PATCHNAME}-${PATCHVER}.patch"
fi
md5sum "${PACKAGE}-${VERSION}-${PATCHNAME}-${PATCHVER}.patch"

getpatch: ([B]LFS version)

#!/bin/bash
[ -z "$BOOKVER" ] && BOOKVER=blfs
FILE="$1"
cd /sources
if [ "$BOOKVER" = blfs ]; then
  wget "http://www.linuxfromscratch.org/patches/blfs/svn/$FILE"
else
  wget "http://www.linuxfromscratch.org/patches/lfs/$BOOKVER/$FILE"
fi
md5sum "$FILE"

BLFS usage presumes using the dev trunk, which is probably the case for many users given how much the stable books lag behind LFS. If you do use this you may want to tweak it further. If you prefer segmented syntax, it should be trivial to modify the C[B]LFS version above to that end.