]> git.mdlowis.com Git - proto/aardvark-linux.git/commitdiff
Base system is now complete enough to successfully bootstrap the pkgsrc utilities...
authorMike Lowis <mike.lowis@gentex.com>
Thu, 28 Jan 2016 12:08:06 +0000 (12:08 +0000)
committerMike Lowis <mike.lowis@gentex.com>
Thu, 28 Jan 2016 12:08:06 +0000 (12:08 +0000)
bin/install [new file with mode: 0755]
build.sh
clean.sh
enter-chroot.sh
etc/group [new file with mode: 0644]
etc/passwd [new file with mode: 0644]
patches/sbase-touch-f.diff [new file with mode: 0644]

diff --git a/bin/install b/bin/install
new file mode 100755 (executable)
index 0000000..d83ed52
--- /dev/null
@@ -0,0 +1,110 @@
+#!/bin/sh
+
+# Print the usage and exit
+function usage(){
+    echo "Usage: install [OPTION]... [-T] SOURCE DEST"
+    echo "  or:  install [OPTION]... SOURCE... DIRECTORY"
+    echo "  or:  install [OPTION]... -t DIRECTORY SOURCE..."
+    echo "  or:  install [OPTION]... -d DIRECTORY..."
+    exit 1
+}
+
+# Global flags that affect behavior
+dirmode=0
+mkdirmode=0
+group=
+mode=
+owner=
+sources=
+destination=
+
+echo "Install received the following command line:"
+echo "    $@"
+# Parse command-line args
+while getopts bcCdDg:m:o:psS:t:Tv name; do
+    case $name in
+        d) dirmode=1 ;;
+        D) mkdirmode=1 ;;
+        g) group="$OPTARG" ;;
+        m) owner="$OPTARG" ;;
+        o) mode="$OPTARG" ;;
+
+        # Unsupported for  now
+        t) destination="$OPTARG" ;;
+
+        # These options don't do anything
+        p) ;;
+        b) ;;
+        c) ;;
+        C) ;;
+        s) ;;
+        S) ;;
+        T) ;;
+        v) ;;
+        Z) ;;
+
+        # Catch all errors and report them
+        ?) usage;;
+    esac
+done
+# remove the parsed flags from the positional arguments array
+shift $((OPTIND-1))
+
+if [ $dirmode -ne 1 ]; then
+    # Normal mode requires at least two positional args
+    if [ "$destination" == "" ] && [ $# -lt 2 ]; then
+        usage
+    fi
+fi
+
+# All forms require at least one positional arg
+if [ "$destination" != "" ] && [ $# -lt 1 ]; then
+    usage
+fi
+
+#------------------------------------------------------------------------------
+# Helper Functions
+#------------------------------------------------------------------------------
+function setgroup(){
+    if [ "$group" != "" ]; then
+        chgrp "$group" "$@"
+    fi
+}
+
+function setmode(){
+    if [ "$mode" != "" ]; then
+        chmod "$mode" "$@"
+    fi
+}
+
+function setowner(){
+    if [ "$owner" != "" ]; then
+        chown "$owner" "$@"
+    fi
+}
+
+#------------------------------------------------------------------------------
+# Main Routine
+#------------------------------------------------------------------------------
+if [ $dirmode -eq 1 ]; then
+    while [ $# -gt 0 ]; do
+        mkdir -p $1
+        shift
+    done
+else
+    # Decide if the last arg is the target dir or a source
+    stopcount=1
+    if [ "$destination" != "" ]; then
+        stopcount=0
+    fi
+    # get the sources
+    while [ $# -gt $stopcount ]; do
+        sources="$sources $1"
+        shift
+    done
+    if [ $# -eq  1 ]; then
+        destination="$1"
+    fi
+    cp $sources $destination
+fi
+
index 6069978545dc44a5cf61b83280da218e50370e24..c0ac5e0f5f686156423a85f10eaab4f3a86393c4 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -38,11 +38,25 @@ fetch crossx86-x86_64-linux-musl-1.1.12.tar.xz \
       https://e82b27f594c813a5a4ea5b07b06f16c3777c3b8c.googledrive.com/host/0BwnS5DMB0YQ6bDhPZkpOYVFhbk0/musl-1.1.12/ \
       "$AL_TOOLS"
 rm -f "$AL_TOOLS/$AL_TGT/lib/libc.so"
+[ ! -L "$AL_ROOT/sbin" ] && ln -sfv bin "$AL_ROOT/sbin"
+[ ! -L "$AL_ROOT/usr" ] && ln -sfv . "$AL_ROOT/usr"
+mkdir -pv "$AL_ROOT/bin"
+mkdir -pv "$AL_ROOT/dev"
+mkdir -pv "$AL_ROOT/etc"
+mkdir -pv "$AL_ROOT/proc"
+mkdir -pv "$AL_ROOT/sys"
+mkdir -pv "$AL_ROOT/tmp"
+mkdir -pv "$AL_ROOT/root"
+mkdir -pv "$AL_ROOT/var"
+cp etc/* "$AL_ROOT/etc/"
+cp bin/* "$AL_ROOT/bin/"
 
 # Install sbase
 gitclone http://git.suckless.org/sbase "$AL_SOURCES/sbase"
 if [ ! -f "$AL_ROOT/bin/ls" ]; then
     cd "$AL_SOURCES/sbase"
+    git checkout .
+    git apply ../../patches/sbase-touch-f.diff
     make $MAKEFLAGS CC="$CC" LD="$LD" LDFLAGS="$LDFLAGS"
     make $MAKEFLAGS PREFIX=$AL_ROOT install
     rm -f "$AL_ROOT/bin/grep"
@@ -104,18 +118,54 @@ if [ ! -f "$AL_ROOT/bin/gawk" ]; then
     cd $AL
 fi
 
-# Install GNU make
-fetch make-4.1.tar.gz http://ftp.gnu.org/gnu/make/ "$AL_SOURCES/make"
-if [ ! -f "$AL_ROOT/bin/make" ]; then
-    cd "$AL_SOURCES/make"
-    ./configure              \
-        LDFLAGS="--static"   \
-        --prefix="$AL_ROOT"  \
-        --without-guile
+# Install shadow
+fetch shadow-4.2.1.tar.xz http://pkg-shadow.alioth.debian.org/releases/ "$AL_SOURCES/shadow"
+if [ ! -f "$AL_ROOT/bin/groups" ]; then
+    cd "$AL_SOURCES/shadow"
+    ./configure             \
+        LDFLAGS="--static"  \
+        --prefix="$AL_ROOT" \
+        --exec-prefix="$AL_ROOT" \
+        --sysconfdir="$AL_ROOT/etc"   \
+        --with-group-name-max-length=32
     make $MAKEFLAGS install
+    sed -i 's/yes/no/; s/bash/sh/' "$AL_ROOT/etc/default/useradd"
     cd $AL
 fi
 
+# Install GNU diffutils
+fetch diffutils-3.3.tar.xz http://ftp.gnu.org/gnu/diffutils/ "$AL_SOURCES/diffutils"
+if [ ! -f "$AL_ROOT/bin/diff" ]; then
+    cd "$AL_SOURCES/diffutils"
+    ./configure \
+        --prefix="$AL_ROOT"
+    make $MAKEFLAGS install
+    cd $AL
+fi
+
+## Install GNU make
+#fetch make-4.1.tar.gz http://ftp.gnu.org/gnu/make/ "$AL_SOURCES/make"
+#if [ ! -f "$AL_ROOT/bin/make" ]; then
+#    cd "$AL_SOURCES/make"
+#    ./configure              \
+#        LDFLAGS="--static"   \
+#        --prefix="$AL_ROOT"  \
+#        --without-guile
+#    make $MAKEFLAGS install
+#    cd $AL
+#fi
+
+
+## Install GNU inetutils
+#fetch inetutils-1.9.4.tar.xz http://ftp.gnu.org/gnu/inetutils/ "$AL_SOURCES/inetutils"
+#if [ ! -f "$AL_ROOT/bin/diff" ]; then
+#    cd "$AL_SOURCES/inetutils"
+#    ./configure \
+#        --prefix="$AL_ROOT"
+#    make $MAKEFLAGS install
+#    cd $AL
+#fi
+
 ## Install GNU bc
 #fetch bc-1.06.tar.gz http://ftp.gnu.org/gnu/bc/ "$AL_SOURCES/bc"
 #if [ ! -f "$AL_ROOT/bin/bc" ]; then
@@ -154,7 +204,7 @@ fi
 #    cd $AL
 #fi
 #/tools/bin/../lib/gcc/x86_64-linux-musl/5.3.0/include
-
+#
 ## Install Perl
 #fetch perl-5.22.0.tar.bz2 http://www.cpan.org/src/5.0/ "$AL_SOURCES/perl"
 #if [ ! -f "$AL_ROOT/bin/perl" ]; then
@@ -167,13 +217,15 @@ fi
 ###############################################################################
 # Install Sources
 ###############################################################################
-fetch    musl-1.1.12.tar.gz  http://www.musl-libc.org/releases/            "$AL_ROOT/src/musl"
-gitclone                     http://git.suckless.org/sbase                 "$AL_ROOT/src/sbase"
-gitclone                     http://git.suckless.org/ubase                 "$AL_ROOT/src/ubase"
-fetch    mksh-R52b.tgz       https://www.mirbsd.org/MirOS/dist/mir/mksh/   "$AL_ROOT/src/mksh"
-fetch    make-4.1.tar.gz     http://ftp.gnu.org/gnu/make/                  "$AL_ROOT/src/make"
-fetch    grep-2.9.tar.xz     http://ftp.gnu.org/gnu/grep/                  "$AL_ROOT/src/grep"
-fetch    gawk-4.1.3.tar.xz   http://ftp.gnu.org/gnu/gawk/                  "$AL_ROOT/src/gawk"
+fetch    pkgsrc.tar.bz2      http://ftp.netbsd.org/pub/pkgsrc/stable/      "$AL_ROOT/pkgsrc/"
+
+#fetch    musl-1.1.12.tar.gz  http://www.musl-libc.org/releases/            "$AL_ROOT/src/musl"
+#gitclone                     http://git.suckless.org/sbase                 "$AL_ROOT/src/sbase"
+#gitclone                     http://git.suckless.org/ubase                 "$AL_ROOT/src/ubase"
+#fetch    mksh-R52b.tgz       https://www.mirbsd.org/MirOS/dist/mir/mksh/   "$AL_ROOT/src/mksh"
+#fetch    make-4.1.tar.gz     http://ftp.gnu.org/gnu/make/                  "$AL_ROOT/src/make"
+#fetch    grep-2.9.tar.xz     http://ftp.gnu.org/gnu/grep/                  "$AL_ROOT/src/grep"
+#fetch    gawk-4.1.3.tar.xz   http://ftp.gnu.org/gnu/gawk/                  "$AL_ROOT/src/gawk"
 #fetch    bc-1.06.tar.gz      http://ftp.gnu.org/gnu/bc/                    "$AL_ROOT/src/bc"
 #fetch    gzip-1.6.tar.xz     http://ftp.gnu.org/gnu/gzip/                  "$AL_ROOT/src/gzip"
 #fetch    ncurses-6.0.tar.gz  http://ftp.gnu.org/gnu/ncurses/               "$AL_ROOT/src/ncurses"
@@ -183,11 +235,6 @@ fetch    gawk-4.1.3.tar.xz   http://ftp.gnu.org/gnu/gawk/                  "$AL_
 ###############################################################################
 # Finalize the Chroot
 ###############################################################################
-mkdir -pv "$AL_ROOT/dev"
-mkdir -pv "$AL_ROOT/proc"
-mkdir -pv "$AL_ROOT/sys"
-mkdir -pv "$AL_ROOT/tmp"
-mkdir -pv "$AL_ROOT/root"
 ln -sfv "$AL_TGT-addr2line"  "$AL_TOOLS/bin/addr2line"
 ln -sfv "$AL_TGT-ar"         "$AL_TOOLS/bin/ar"
 ln -sfv "$AL_TGT-as"         "$AL_TOOLS/bin/as"
index 0e35f670cc04e791775ba0aa38678cbb27dcdc84..cc9f15dcf1dc9b0bb7885a49db097e05d0e1fcfa 100755 (executable)
--- a/clean.sh
+++ b/clean.sh
@@ -1,6 +1,10 @@
 #!/bin/sh
 . ./config.sh
-echo rm -r "$AL_ROOT"
-rm -rf "$AL_ROOT"
+echo rm "$AL_ROOT/sbin"
+rm "$AL_ROOT/sbin"
+echo rm "$AL_ROOT/usr"
+rm "$AL_ROOT/usr"
 echo rm -r "$AL_SOURCES"
 rm -rf "$AL_SOURCES"
+echo rm -r "$AL_ROOT"
+rm -rf "$AL_ROOT"
index f7e52ceb9ce9c8f6d70599c52c20a574100869ba..062cf773f058b067abef2a5225371440ee766746 100755 (executable)
@@ -12,6 +12,7 @@ mount --make-rslave "$AL_ROOT/dev"
 
 # Setup env variables
 export PATH=/bin:/tools/bin
+export MAKEFLAGS=
 
 # Enter the chroot
 chroot "$AL_ROOT" /bin/sh
diff --git a/etc/group b/etc/group
new file mode 100644 (file)
index 0000000..ae2dcd2
--- /dev/null
+++ b/etc/group
@@ -0,0 +1,29 @@
+root:x:0:root
+bin:x:1:root,bin,daemon
+daemon:x:2:root,bin,daemon
+sys:x:3:root,bin,adm
+adm:x:4:root,adm,daemon
+tty:x:5:
+disk:x:6:root,adm
+lp:x:7:lp
+mem:x:8:
+kmem:x:9:
+wheel:x:10:root
+floppy:x:11:root
+news:x:13:news
+uucp:x:14:uucp
+console:x:17:
+audio:x:18:
+cdrom:x:19:
+tape:x:26:root
+video:x:27:root
+cdrw:x:80:
+usb:x:85:
+users:x:100:
+utmp:x:406:
+nogroup:x:65533:
+nobody:x:65534:
+man:x:15:
+input:x:249:
+messagebus:x:248:
+polkitd:x:246:
diff --git a/etc/passwd b/etc/passwd
new file mode 100644 (file)
index 0000000..a3bf6e6
--- /dev/null
@@ -0,0 +1,12 @@
+root:x:0:0:root:/root:/bin/sh
+bin:x:1:1:bin:/bin:/bin/false
+daemon:x:2:2:daemon:/sbin:/bin/false
+adm:x:3:4:adm:/var/adm:/bin/false
+lp:x:4:7:lp:/var/spool/lpd:/bin/false
+sync:x:5:0:sync:/sbin:/bin/sync
+shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
+halt:x:7:0:halt:/sbin:/sbin/halt
+news:x:9:13:news:/var/spool/news:/bin/false
+uucp:x:10:14:uucp:/var/spool/uucp:/bin/false
+operator:x:11:0:operator:/root:/bin/sh
+nobody:x:65534:65534:nobody:/var/empty:/bin/false
diff --git a/patches/sbase-touch-f.diff b/patches/sbase-touch-f.diff
new file mode 100644 (file)
index 0000000..d0037fb
--- /dev/null
@@ -0,0 +1,13 @@
+diff --git a/touch.c b/touch.c
+index b957fa5..4217dfb 100644
+--- a/touch.c
++++ b/touch.c
+@@ -146,6 +146,8 @@ main(int argc, char *argv[])
+       case 'T':
+               times[0].tv_sec = estrtonum(EARGF(usage()), 0, LLONG_MAX);
+               break;
++      case 'f':
++          break;
+       default:
+               usage();
+       } ARGEND