morpheus

suckless linux distro
git clone git://git.2f30.org/morpheus
Log | Files | Refs | Submodules | README | LICENSE

commit 5bc8a553e2efc0d075d1535ed3dfab5cdfbc384e
parent 9b32747c657f90d13a7b505a16b6e3a029c81f26
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun, 13 Jul 2014 20:51:18 +0000

install-*: allow to override root with first argument

Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>

Diffstat:
Mmisc/install-alpine | 17+++++++++--------
Mmisc/install-crux | 21+++++++++++----------
Mmisc/install-debian | 5+++--
Mmisc/install-morpheus | 1+
Mmisc/install-slackware | 17+++++++++--------
5 files changed, 33 insertions(+), 28 deletions(-)

diff --git a/misc/install-alpine b/misc/install-alpine @@ -15,8 +15,9 @@ set -e -x mirror="http://nl.alpinelinux.org/alpine/" -installdir="/ns/alpine" -tmpdir="${installdir}/tmp" +root="/ns/alpine" +test x"$1" != x"" && root="$1" +tmpdir="${root}/tmp" # fetch apk package tools. mkdir -p "${tmpdir}/sbin" @@ -30,13 +31,13 @@ if ! test -f "sbin/apk.static"; then fi # install in chroot. -"$tmpdir/sbin/apk.static" -X "${mirror}/v3.0/main" -U --allow-untrusted --root "${installdir}" --initdb add alpine-base +"$tmpdir/sbin/apk.static" -X "${mirror}/v3.0/main" -U --allow-untrusted --root "${root}" --initdb add alpine-base # copy etc/resolv.conf -mkdir -p "${installdir}/etc" -cp /etc/resolv.conf "${installdir}/etc/resolv.conf" -chmod 644 "${installdir}/etc/resolv.conf" +mkdir -p "${root}/etc" +cp /etc/resolv.conf "${root}/etc/resolv.conf" +chmod 644 "${root}/etc/resolv.conf" # write used mirror as apk repository. -mkdir -p "${installdir}/etc/apk" -echo "${mirror}/v3.0/main" > ${installdir}/etc/apk/repositories +mkdir -p "${root}/etc/apk" +echo "${mirror}/v3.0/main" > ${root}/etc/apk/repositories diff --git a/misc/install-crux b/misc/install-crux @@ -16,7 +16,8 @@ set -e -x iso="crux-3.0.iso" mnt="/mnt/crux" -installdir="/ns/crux" +root="/ns/crux" +test x"$1" != x"" && root="$1" # mount dev=$(losetup -f) @@ -25,22 +26,22 @@ mkdir -p "${mnt}" mount -t iso9660 -o ro "${dev}" "${mnt}" # install -mkdir -p "${installdir}" -cd "${installdir}" +mkdir -p "${root}" +cd "${root}" tar -xJf "${mnt}/rootfs.tar.xz" # copy packages (core only). -#mkdir -p "${installdir}/pkg/" -#cp -a "${mnt}/crux/core" "${installdir}/pkg/" +#mkdir -p "${root}/pkg/" +#cp -a "${mnt}/crux/core" "${root}/pkg/" # make package dir needed by crux. -mkdir -p "${installdir}/var/lib/pkg" -touch "${installdir}/var/lib/pkg/db" +mkdir -p "${root}/var/lib/pkg" +touch "${root}/var/lib/pkg/db" # copy etc/resolv.conf -mkdir -p "${installdir}/etc" -cp /etc/resolv.conf "${installdir}/etc/resolv.conf" -chmod 644 "${installdir}/etc/resolv.conf" +mkdir -p "${root}/etc" +cp /etc/resolv.conf "${root}/etc/resolv.conf" +chmod 644 "${root}/etc/resolv.conf" # unmount cd / diff --git a/misc/install-debian b/misc/install-debian @@ -4,7 +4,8 @@ set -x -e arch="amd64" release="wheezy" -installdir="/ns/debian-$release" +root="/ns/debian-$release" +test x"$1" != x"" && root="$1" tmpdir="/tmp/debian" mirror="http://ftp.nl.debian.org" @@ -29,4 +30,4 @@ tar -czf ../devices.tar.gz . cd ../ export DEBOOTSTRAP_DIR="$(pwd)" -./debootstrap --arch "$arch" --no-check-gpg "$release" "$installdir" "$mirror/debian/" +./debootstrap --arch "$arch" --no-check-gpg "$release" "$root" "$mirror/debian/" diff --git a/misc/install-morpheus b/misc/install-morpheus @@ -3,6 +3,7 @@ set -e -x root="/ns/morpheus" +test x"$1" != x"" && root="$1" tmpdir="$root/tmp/morpheus_install" pkgdir="$tmpdir/pkgs" diff --git a/misc/install-slackware b/misc/install-slackware @@ -8,7 +8,8 @@ url="$mirror/$release/slackware64" # "slackware", "slackware64" filelist="$url/FILE_LIST" pkgtools="pkgtools-14.1-noarch-2.tgz" pkgtoolsurl="$url/a/$pkgtools" -installdir="/ns/$release" +root="/ns/$release" +test x"$1" != x"" && root="$1" tmpdir="/tmp/slackware/$release" pkgdir="$tmpdir/pkgs" @@ -71,18 +72,18 @@ wget "$filelist" -q -O - | grep -E -o '[^ ]*$' | grep -E '\.(txz|tgz|txt|asc)$' done # install package sets in order. -mkdir -p "$installdir" +mkdir -p "$root" cd "$pkgdir" for pset in *; do find "$pset" -name "*.t?z" | while read -r f; do - "$installpkg" --terse --root "$installdir" "$f" + "$installpkg" --terse --root "$root" "$f" done done # fix symlink references for libs. -libdir="$installdir/lib64" +libdir="$root/lib64" if ! test -d "$libdir"; then - libdir="$installdir/lib" + libdir="$root/lib" fi cd "$libdir" for i in *; do @@ -95,6 +96,6 @@ for i in *; do done # copy /etc/resolv.conf -mkdir -p "${installdir}/etc" -cp /etc/resolv.conf "${installdir}/etc/resolv.conf" -chmod 644 "${installdir}/etc/resolv.conf" +mkdir -p "${root}/etc" +cp /etc/resolv.conf "${root}/etc/resolv.conf" +chmod 644 "${root}/etc/resolv.conf"