summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2008-12-18 16:43:07 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2008-12-18 16:43:07 +0100
commitaa963b8ddb844383346aaa70bf49f4417896d693 (patch)
treed6139b041c03a379f7e568815297b48a6c3efcde /src/core
parent08faa188dfabb9db06f835a7034874569c8919fb (diff)
quickinst very early WIP
Diffstat (limited to 'src/core')
-rw-r--r--src/core/procedures/quickinst108
1 files changed, 106 insertions, 2 deletions
diff --git a/src/core/procedures/quickinst b/src/core/procedures/quickinst
index 9e92c03..314569c 100644
--- a/src/core/procedures/quickinst
+++ b/src/core/procedures/quickinst
@@ -1,7 +1,111 @@
#!/bin/sh
+depend_procedure core base
-quickinst_finished ()
+# This is a port of the original /arch/quickinst script.
+
+# TODO: nowhere rely on /tmp
+
+
+# TODO: find a way to make profilespecific arguments and usage function work (see src/aif.sh)
+usage() {
+ echo "quickinst <install_mode> <destdir> <package_directory|server_url>"
+ echo
+ echo "This script is for users who would rather partition/mkfs/mount their target"
+ echo "media manually than go through the routines in the setup script."
+ echo
+ echo "First make sure you have all your filesystems mounted under <destdir>."
+ echo "e.g. mount -t iso9660 /dev/sdc or /dev/sr0 (for new naming sheme) /src "
+ echo "Then run this script to install all base packages to <destdir>."
+ echo
+ if [ -e /usr/bin/wget ]; then
+ echo "<install_mode> must be either 'ftp' or 'cd'"
+ else
+ echo "<install_mode> must be 'cd'"
+ fi
+ echo
+ echo "Examples:"
+ if [ -e /usr/bin/wget ]; then
+ if [ "$(uname -m)" = "x86_64" ]; then
+ echo " quickinst ftp /mnt ftp://ftp.archlinux.org/core/os/x86_64"
+ else
+ echo " quickinst ftp /mnt ftp://ftp.archlinux.org/core/os/i686"
+ fi
+ fi
+
+ echo " quickinst cd /mnt /src/core/pkg"
+ echo ""
+ exit 0
+}
+
+
+# TODO: implement correctly
+worker_configure ()
{
+# var_PKG_SOURCE_TYPE
+# var_TARGET_DIR
+# var_FILE_URL or var_SYNC_URL
+}
+
+# TODO: clean up everything below this
+
+PACMAN=
+[ -f /tmp/usr/bin/pacman.static ] && PACMAN=/tmp/usr/bin/pacman.static
+[ -f /usr/bin/pacman.static ] && PACMAN=/usr/bin/pacman.static
+if [ "$PACMAN" = "" ]; then
+ cd /tmp
+ if [ "$INSTMODE" = "ftp" ]; then
+ echo "Downloading pacman..."
+ wget $PKGARG/pacman*.pkg.tar.gz
+ if [ $? -gt 0 ]; then
+ echo "error: Download failed"
+ exit 1
+ fi
+ tar -xzf pacman*.pkg.tar.gz
+ elif [ "$INSTMODE" = "cd" ]; then
+ echo "Unpacking pacman..."
+ tar -xzf $PKGARG/pacman*.pkg.tar.gz
+ fi
+fi
+[ -f /tmp/usr/bin/pacman.static ] && PACMAN=/tmp/usr/bin/pacman.static
+if [ "$PACMAN" = "" ]; then
+ echo "error: Cannot find the pacman.static binary!"
+ exit 1
+fi
+
+if [ "$INSTMODE" = "ftp" ]; then
+ echo "[core]" >/tmp/pacman.conf
+ echo "Server = $PKGARG" >>/tmp/pacman.conf
+ mkdir -p $DESTDIR/var/cache/pacman/pkg /var/cache/pacman >/dev/null 2>&1
+ rm -f /var/cache/pacman/pkg >/dev/null 2>&1
+ ln -sf $DESTDIR/var/cache/pacman/pkg /var/cache/pacman/pkg >/dev/null 2>&1
+fi
+
+if [ "$INSTMODE" = "cd" ]; then
+ echo "[core]" >/tmp/pacman.conf
+ echo "Server = file://$PKGARG" >>/tmp/pacman.conf
+ mkdir -p $DESTDIR/var/cache/pacman/pkg /var/cache/pacman >/dev/null 2>&1
+ rm -f /var/cache/pacman/pkg >/dev/null 2>&1
+ ln -sf $PKGARG /var/cache/pacman/pkg >/dev/null 2>&1
+fi
+
+! [ -d $DESTDIR/var/lib/pacman ] && mkdir -p $DESTDIR/var/lib/pacman
+! [ -d /var/lib/pacman ] && mkdir -p /var/lib/pacman
+# mount proc/sysfs first, so mkinitrd can use auto-detection if it wants
+! [ -d $DESTDIR/proc ] && mkdir $DESTDIR/proc
+! [ -d $DESTDIR/sys ] && mkdir $DESTDIR/sys
+! [ -d $DESTDIR/dev ] && mkdir $DESTDIR/dev
+mount -t proc none $DESTDIR/proc
+mount -t sysfs none $DESTDIR/sys
+mount -o bind /dev $DESTDIR/dev
+$PACMAN -r $DESTDIR --config /tmp/pacman.conf -Sy base
+umount $DESTDIR/proc $DESTDIR/sys $DESTDIR/dev
+if [ $? -gt 0 ]; then
+ echo
+ echo "Package installation FAILED."
+ echo
+ exit 1
+fi
+
echo
echo "Package installation complete."
echo
@@ -37,4 +141,4 @@ echo
echo "Then exit your chroot shell, edit $DESTDIR/etc/fstab and"
echo "$DESTDIR/etc/rc.conf, and reboot!"
echo
-}
+exit 0