galeb

Једноставна статичка дистрибуција заснована на musl-у
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување f8b9fdbecf66c5b71f96eaab875af379df49df4d
родитељ 1466d3538fc39024ea60163afa67b9905343e940
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Sat,  9 Jul 2022 13:28:41 +0200

Reorganize downloads: do everything at once, have TSV db of all downloads

Signed-off-by: Страхиња Радић <contact@strahinja.org>

Diffstat:
M01-cross.sh | 140++++++++++++++++++-------------------------------------------------------------
M02-prep-chroot.sh | 4++--
M03-chroot.sh | 17+++++++++++++++--
MTODO | 2+-
Mlib/fun.sh | 40++++++++++++++++++++--------------------
Alib/pkgs.tsv | 62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
измењених датотека: 6, додавања: 132(+), брисања: 133(-)

diff --git a/01-cross.sh b/01-cross.sh @@ -50,31 +50,35 @@ cp_or_fail -r ${WD}/${FLD}/* ${G_FIL}/ msg info "Copying patches to %s" ${G_PAT} cp_or_fail -r ${WD}/${PTD}/* ${G_PAT}/ -# begin_substep musl-cross-make -# msg info "Setting up musl-cross-make" -# if [ -x ${CT}/bin/${CT_TRI}-gcc ]; then -# msg info "%s exists" "${CT_TRI}-gcc" -# else -# git_clone ${pkg} https://github.com/richfelker/${pkg} -# ( -# cd_or_fail ${pkg} -# cat <<! > config.mak -# TARGET = ${CT_TRI} -# OUTPUT = ${CT} -# COMMON_CONFIG += CFLAGS="-g0 -Os" -# ! -# run_make -# run_make install -# ) -# fi -# end_substep +msg info "Fetching packages" +sed 1d ${WD}/lib/pkgs.tsv | \ +while read -r record +do +( + delay=2 # seconds + IFS=$(printf '\t') + cn=0 + for column in ${record}; do + case ${cn} in + 0) url=${column};; + 1) dir=${column};; + *) ;; + esac + cn=$((cn+1)) + done + case ${url} in + git:*|git+https:*) git_clone "${dir}" ${url##git+} ${delay};; + https:*) fetch_pkg ${url} "${dir}" ${delay};; + *) ;; + esac +) +done begin_substep linux-5.17.13 "Linux headers" if [ -e ${CT}/${G_TARGET}/include/linux/stddef.h ]; then msg info "%s exists, skipping %s" \ ${CT}/${G_TARGET}/include/linux/stddef.h "${substepname}" else - fetch_pkg https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.17.13.tar.xz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( cd_or_fail ${G_SRC}/${pkg} @@ -93,7 +97,6 @@ begin_substep binutils-2.38 if [ -x ${CT}/${G_TARGET}/bin/ar ]; then msg info "%s exists, skipping %s" "${CT}/${G_TARGET}/bin/ar" ${pkg} else - fetch_pkg https://ftp.gnu.org/gnu/binutils/binutils-2.38.tar.xz remove_dir ${G_SRC}/${pkg} extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( @@ -122,7 +125,6 @@ if [ -e ${CT}/gcc-static ]; then msg info "%s exists, skipping %s" "${CT}/gcc-static" "${substepname}" else :>${CT}/gcc-static -fetch_pkg https://gcc.gnu.org/pub/gcc/snapshots/11-20220101/gcc-11-20220101.tar.xz remove_dir ${G_SRC}/${pkg} extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( @@ -132,9 +134,7 @@ extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz if [ -d gmp ]; then msg info "Subpackage %s exists" "${subpkg}" else - fetch_pkg https://ftp.gnu.org/gnu/gmp/${subpkg##lib}.tar.xz \ - ${subpkg} - extract_pkg ${G_SRC}/${pkg} ${subpkg} ${subpkg}.tar.xz + extract_pkg ${G_SRC} ${subpkg} ${subpkg}.tar.xz mv_or_fail ${subpkg} gmp fi @@ -142,9 +142,7 @@ extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz if [ -d mpc ]; then msg info "Subpackage %s exists" "${subpkg}" else - fetch_pkg https://ftp.gnu.org/gnu/mpc/${subpkg##lib}.tar.gz \ - ${subpkg} - extract_pkg ${G_SRC}/${pkg} ${subpkg} ${subpkg}.tar.gz + extract_pkg ${G_SRC}/${subpkg} ${subpkg}.tar.gz mv_or_fail ${subpkg} mpc fi @@ -152,9 +150,7 @@ extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz if [ -d mpfr ]; then msg info "Subpackage %s exists" "${subpkg}" else - fetch_pkg https://ftp.gnu.org/gnu/mpfr/${subpkg##lib}.tar.xz \ - ${subpkg} - extract_pkg ${G_SRC}/${pkg} ${subpkg} ${subpkg}.tar.xz + extract_pkg ${G_SRC}/${subpkg} ${subpkg}.tar.xz mv_or_fail ${subpkg} mpfr fi @@ -210,7 +206,6 @@ if [ -e ${CT}/lib/ld-musl-${G_ARCH_EXT_ALT}.so.1 ]; then msg info "%s exists, skipping %s" \ ${CT}/lib/ld-musl-${G_ARCH_EXT_ALT}.so.1 ${pkg} else - fetch_pkg https://musl.libc.org/releases/${pkg}.tar.gz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz ( cd_or_fail ${G_SRC}/${pkg} @@ -304,7 +299,6 @@ begin_substep file-5.41 if [ -x ${CT}/bin/file ]; then msg info "%s exists, skipping %s" ${CT}/bin/file ${pkg} else - fetch_pkg https://astron.com/pub/file/${pkg}.tar.gz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz ( cd_or_fail ${G_SRC}/${pkg} @@ -331,7 +325,6 @@ if [ -e ${TL}/lib/ld-musl-${G_ARCH_EXT_ALT}.so.1 ]; then msg info "%s exists, skipping %s" \ ${TL}/lib/ld-musl-${G_ARCH_EXT_ALT}.so.1 ${pkg} else - fetch_pkg https://musl.libc.org/releases/${pkg}.tar.gz remove_dir ${G_SRC}/${pkg} extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz ( @@ -399,7 +392,6 @@ begin_substep binutils-2.38 if [ -x ${TL}/${G_TARGET}/bin/ar ]; then msg info "%s exists, skipping %s" ${TL}/${G_TARGET}/bin/ar ${pkg} else - fetch_pkg https://ftp.gnu.org/gnu/binutils/binutils-2.38.tar.xz remove_dir ${G_SRC}/${pkg} extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( @@ -428,7 +420,6 @@ begin_substep gcc-11-20220101 if [ -x /${TLD}/bin/gcc ]; then msg info "%s exists, skipping %s" "/${TLD}/bin/gcc" ${pkg} else -fetch_pkg https://gcc.gnu.org/pub/gcc/snapshots/11-20220101/gcc-11-20220101.tar.xz remove_dir ${G_SRC}/${pkg} extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( @@ -438,7 +429,6 @@ extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz if [ -d gmp ]; then msg info "Subpackage %s exists" "${subpkg}" else - fetch_pkg https://ftp.gnu.org/gnu/gmp/${subpkg}.tar.xz extract_pkg ${G_SRC}/${pkg} ${subpkg} ${subpkg}.tar.xz mv_or_fail ${subpkg} gmp fi @@ -447,7 +437,6 @@ extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz if [ -d mpc ]; then msg info "Subpackage %s exists" "${subpkg}" else - fetch_pkg https://ftp.gnu.org/gnu/mpc/${subpkg}.tar.gz extract_pkg ${G_SRC}/${pkg} ${subpkg} ${subpkg}.tar.gz mv_or_fail ${subpkg} mpc fi @@ -456,7 +445,6 @@ extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz if [ -d mpfr ]; then msg info "Subpackage %s exists" "${subpkg}" else - fetch_pkg https://ftp.gnu.org/gnu/mpfr/${subpkg}.tar.xz extract_pkg ${G_SRC}/${pkg} ${subpkg} ${subpkg}.tar.xz mv_or_fail ${subpkg} mpfr fi @@ -562,7 +550,6 @@ if [ -e /${TLD}/include/linux/stddef.h ]; then msg info "%s exists, skipping %s" \ /${TLD}/include/linux/stddef.h "${substepname}" else - fetch_pkg https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.17.13.tar.xz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( cd_or_fail ${G_SRC}/${pkg} @@ -644,7 +631,6 @@ begin_substep make-4.3 if [ -x ${TL}/bin/make ]; then msg info "%s exists, skipping %s" ${TL}/bin/make ${pkg} else - fetch_pkg https://ftp.gnu.org/gnu/make/${pkg}.tar.gz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz ( cd_or_fail ${G_SRC}/${pkg} @@ -664,7 +650,6 @@ begin_substep tcl8.6.12 if [ -e ${TL}/lib/libtcl8.6.so ]; then msg info "%s exists, skipping %s" ${TL}/lib/libtcl8.6.so ${pkg} else - fetch_pkg https://sourceforge.net/projects/tcl/files/Tcl/8.6.12/${pkg}-src.tar.gz extract_pkg ${G_SRC} ${pkg} ${pkg}-src.tar.gz ( cd_or_fail ${G_SRC}/${pkg} @@ -695,7 +680,6 @@ begin_substep m4-1.4.19 if [ -x ${TL}/bin/m4 ]; then msg info "%s exists, skipping %s" ${TL}/bin/m4 ${pkg} else - fetch_pkg https://ftp.gnu.org/gnu/m4/${pkg}.tar.xz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( cd_or_fail ${G_SRC}/${pkg} @@ -714,7 +698,6 @@ begin_substep bzip2-1.0.8 if [ -x ${TL}/bin/bzip2 ]; then msg info "%s exists, skipping %s" ${TL}/bin/bzip2 ${pkg} else - fetch_pkg https://sourceware.org/pub/bzip2/${pkg}.tar.gz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz ( cd_or_fail ${G_SRC}/${pkg} @@ -738,7 +721,6 @@ begin_substep byacc-20220128 if [ -x ${TL}/bin/yacc ]; then msg info "%s exists, skipping %s" ${TL}/bin/yacc ${pkg} else - fetch_pkg https://invisible-island.net/archives/byacc/${pkg}.tgz extract_pkg ${G_SRC} ${pkg} ${pkg}.tgz ( cd_or_fail ${G_SRC}/${pkg} @@ -757,7 +739,6 @@ begin_substep diffutils-3.8 if [ -x ${TL}/bin/diff ]; then msg info "%s exists, skipping %s" ${TL}/bin/diff ${pkg} else - fetch_pkg https://ftp.gnu.org/gnu/diffutils/${pkg}.tar.xz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( cd_or_fail ${G_SRC}/${pkg} @@ -776,7 +757,6 @@ begin_substep file-5.41 if [ -x ${TL}/bin/file ]; then msg info "%s exists, skipping %s" ${TL}/bin/file ${pkg} else - fetch_pkg https://astron.com/pub/file/${pkg}.tar.gz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz ( cd_or_fail ${G_SRC}/${pkg} @@ -797,7 +777,6 @@ begin_substep findutils-4.9.0 if [ -x ${TL}/bin/find ]; then msg info "%s exists, skipping %s" ${TL}/bin/find ${pkg} else - fetch_pkg https://ftp.gnu.org/gnu/findutils/${pkg}.tar.xz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( cd_or_fail ${G_SRC}/${pkg} @@ -820,7 +799,6 @@ begin_substep gettext-tiny-0.3.2 if [ -x ${TL}/bin/msgfmt ]; then msg info "%s exists, skipping %s" ${TL}/bin/msgfmt ${pkg} else - fetch_pkg https://ftp.barfooze.de/pub/sabotage/tarballs/${pkg}.tar.xz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( cd_or_fail ${G_SRC}/${pkg} @@ -835,7 +813,6 @@ begin_substep grep-3.7 if [ -x ${TL}/bin/fgrep ]; then msg info "%s exists, skipping %s" ${TL}/bin/fgrep ${pkg} else - fetch_pkg https://ftp.gnu.org/gnu/${pkg%%-*}/${pkg}.tar.xz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( cd_or_fail ${G_SRC}/${pkg} @@ -854,7 +831,6 @@ begin_substep gzip-1.12 if [ -x ${TL}/bin/gzip ]; then msg info "%s exists, skipping %s" ${TL}/bin/gzip ${pkg} else - fetch_pkg https://ftp.gnu.org/gnu/gzip/${pkg}.tar.xz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( cd_or_fail ${G_SRC}/${pkg} @@ -873,7 +849,6 @@ begin_substep netbsd-curses-0.3.2 if [ -e ${TL}/lib/libncurses.so ]; then msg info "%s exists, skipping %s" ${TL}/lib/libncurses.so ${pkg} else - fetch_pkg https://ftp.barfooze.de/pub/sabotage/tarballs/${pkg}.tar.xz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( cd_or_fail ${G_SRC}/${pkg} @@ -917,7 +892,6 @@ begin_substep bash-5.1 if [ -x ${TL}/bin/bash ]; then msg info "%s exists, skipping %s" ${TL}/bin/bash ${pkg} else - fetch_pkg https://ftp.gnu.org/gnu/bash/${pkg}.tar.gz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz ( cd_or_fail ${G_SRC}/${pkg} @@ -954,7 +928,6 @@ begin_substep patch-2.7.6 if [ -x ${TL}/bin/patch ]; then msg info "%s exists, skipping %s" ${TL}/bin/patch ${pkg} else - fetch_pkg https://ftp.gnu.org/gnu/patch/${pkg}.tar.xz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( cd_or_fail ${G_SRC}/${pkg} @@ -973,7 +946,6 @@ begin_substep reflex-20210808 if [ -x ${TL}/bin/flex ]; then msg info "%s exists, skipping %s" ${TL}/bin/flex ${pkg} else - fetch_pkg https://invisible-island.net/archives/reflex/${pkg}.tgz extract_pkg ${G_SRC} ${pkg} ${pkg}.tgz ( cd_or_fail ${G_SRC}/${pkg} @@ -989,13 +961,12 @@ else fi end_substep -begin_substep awk +begin_substep awk-20220709 if [ -x ${TL}/bin/awk ]; then msg info "%s exists, skipping %s" ${TL}/bin/awk ${pkg} else ( cd_or_fail ${G_SRC} - git_clone ${pkg} https://github.com/onetrueawk/${pkg} cd_or_fail ${pkg} run_make mv_or_fail a.out ${TL}/bin/awk @@ -1007,7 +978,6 @@ begin_substep coreutils-9.1 if [ -x ${TL}/bin/ls ]; then msg info "%s exists, skipping %s" ${TL}/bin/ls ${pkg} else - fetch_pkg https://ftp.gnu.org/gnu/coreutils/${pkg}.tar.xz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( cd_or_fail ${G_SRC}/${pkg} @@ -1036,7 +1006,6 @@ begin_substep sed-4.8 if [ -x ${TL}/bin/sed ]; then msg info "%s exists, skipping %s" ${TL}/bin/sed ${pkg} else - fetch_pkg https://ftp.gnu.org/gnu/sed/${pkg}.tar.xz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( cd_or_fail ${G_SRC}/${pkg} @@ -1052,14 +1021,13 @@ else fi end_substep -# begin_substep sbase +# begin_substep sbase-20220709 # if [ -x ${TL}/bin/ls ]; then # msg info "%s exists, skipping %s" ${TL}/bin/ls ${pkg} # else # ( # CC=tcc # export CC -# git_clone ${pkg} git://git.suckless.org/sbase # cd_or_fail ${G_SRC}/${pkg} # /bin/sed -i -e 's,/usr/local,/'${TLD}',g;s, \<cc\>, '${CC}',g' \ # -e 's, \<ar\>, '${AR}',g' \ @@ -1072,14 +1040,13 @@ end_substep # fi # end_substep # -# begin_substep ubase +# begin_substep ubase-20220709 # if [ -x ${TL}/bin/id ]; then # msg info "%s exists, skipping %s" ${TL}/bin/id ${pkg} # else # ( # CC=tcc # export CC -# git_clone ${pkg} git://git.suckless.org/ubase # cd_or_fail ${G_SRC}/${pkg} # /bin/sed -i -z 's,<sys/types.h>\n,&#include <sys/sysmacros.h>\n,' \ # mknod.c @@ -1104,7 +1071,6 @@ begin_substep tar-1.34 if [ -x ${TL}/bin/tar ]; then msg info "%s exists, skipping %s" ${TL}/bin/tar ${pkg} else - fetch_pkg https://ftp.gnu.org/gnu/tar/${pkg}.tar.xz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( cd_or_fail ${G_SRC}/${pkg} @@ -1123,7 +1089,6 @@ begin_substep xz-5.2.5 if [ -x ${TL}/bin/xz ]; then msg info "%s exists, skipping %s" ${TL}/bin/xz ${pkg} else - fetch_pkg https://tukaani.org/xz/${pkg}.tar.xz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( cd_or_fail ${G_SRC}/${pkg} @@ -1142,9 +1107,6 @@ begin_substep perl-5.32.1 if [ -x ${TL}/bin/perl ]; then msg info "%s exists, skipping %s" ${TL}/bin/perl ${pkg} else - fetch_pkg https://github.com/arsv/perl-cross/releases/download/1.4/\ -perl-cross-1.4.tar.gz - fetch_pkg https://www.cpan.org/src/5.0/${pkg}.tar.xz extract_pkg ${G_SRC} perl-cross-1.4 perl-cross-1.4.tar.gz extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz ( @@ -1177,12 +1139,11 @@ begin_step utilities totalsubsteps=2 substep=1 -begin_substep mksh +begin_substep mksh-20220709 if [ -x ${TL}/bin/mksh ]; then msg info "%s exists, skipping %s" ${TL}/bin/mksh ${pkg} else ( - git_clone mksh https://github.com/mirbsd/mksh cd_or_fail ${G_SRC}/${pkg} CFLAGS='-static --static -fcommon' LDSTATIC='-static' @@ -1228,12 +1189,12 @@ else fi end_substep -begin_substep sled +begin_substep sled-0.10.8 if [ -x ${TL}/bin/sled ]; then msg info "%s exists, skipping %s" ${TL}/bin/sled ${pkg} else + extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz ( - git_clone ${pkg} https://git.sr.ht/~strahinja/sled cd_or_fail ${G_SRC}/${pkg} SLED_CC=${CC}' -O2 -Wall -static -fcommon' PREFIX=/${TLD} @@ -1245,43 +1206,6 @@ end_substep end_step # utilities -msg info "Fetching the rest of the packages" -fetch_pkg https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/\ -man-pages-5.13.tar.xz -fetch_pkg https://dev.alpinelinux.org/archive/posixtz/posixtz-0.5.tar.xz -fetch_pkg https://www.iana.org/time-zones/repository/releases/tzdata2022a.tar.gz -fetch_pkg https://www.iana.org/time-zones/repository/releases/tzcode2022a.tar.gz -fetch_pkg https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.6.tar.gz \ - zlib-ng-2.0.6.tar.gz -fetch_pkg https://ftp.gnu.org/gnu/readline/readline-8.1.tar.gz -git_clone 9base-20220706 git://git.suckless.org/9base -fetch_pkg https://libisl.sourceforge.io/isl-0.24.tar.xz libisl-0.24.tar.xz -fetch_pkg https://github.com/shadow-maint/shadow/releases/download/v4.11.1/\ -shadow-4.11.1.tar.xz -git_clone tinycc-20220708 git://repo.or.cz/tinycc.git -fetch_pkg https://github.com/facebook/zstd/releases/download/v1.5.0/\ -zstd-1.5.0.tar.gz -fetch_pkg https://download.savannah.gnu.org/releases/attr/attr-2.5.1.tar.gz -fetch_pkg https://download.savannah.gnu.org/releases/acl/acl-2.3.1.tar.xz -fetch_pkg https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/\ -libcap-2.62.tar.xz -fetch_pkg https://sourceforge.net/projects/psmisc/files/psmisc/psmisc-23.4.tar.xz -fetch_pkg https://github.com/Mic92/iana-etc/releases/download/20210611/\ -iana-etc-20210611.tar.gz -fetch_pkg https://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.xz -fetch_pkg https://dev.gentoo.org/~xen0n/distfiles/pax-utils-1.3.4.tar.xz -fetch_pkg https://www.greenwoodsoftware.com/less/less-590.tar.gz -fetch_pkg https://ftp.gnu.org/gnu/gdbm/gdbm-1.20.tar.gz -fetch_pkg https://ftp.gnu.org/gnu/gperf/gperf-3.1.tar.gz -fetch_pkg https://prdownloads.sourceforge.net/expat/expat-2.4.8.tar.xz - -fetch_pkg https://mandoc.bsd.lv/snapshots/mdocml-1.14.1.tar.gz -fetch_pkg https://mandoc.bsd.lv/snapshots/mandoc-1.14.6.tar.gz -fetch_pkg https://ftp.gnu.org/gnu/texinfo/texinfo-6.8.tar.xz -fetch_pkg https://distfiles.dereferenced.org/pkgconf/pkgconf-1.8.0.tar.xz -fetch_pkg https://github.com/ericonr/argp-standalone/archive/refs/tags/\ -1.4.1.tar.gz argp-standalone-1.4.1.tar.gz - msg info "Cleaning up environment" export PATH=${OLDPATH} unset OLDPATH CC CXX AR AS RANLIB LD STRIP diff --git a/02-prep-chroot.sh b/02-prep-chroot.sh @@ -5,8 +5,6 @@ WD=${PWD} -cat art/galeb.ansi - usage() { cat <<! @@ -31,6 +29,8 @@ if [ "$(id -u)" -ne 0 ]; then exit 1 fi +cat art/galeb.ansi + check_dir ${GR}/bin check_dir ${GR}/boot check_dir ${GR}/dev diff --git a/03-chroot.sh b/03-chroot.sh @@ -1,8 +1,21 @@ -. /src/lib/env.sh -. /src/lib/fun.sh +if [ -d /src/lib ]; then + . /src/lib/env.sh + . /src/lib/fun.sh +else + . ./lib/env.sh + . ./lib/fun.sh +fi trap exit_cleanup HUP PIPE INT QUIT TERM EXIT +if [ ! -d /sucks ]; then + msg err "You must run this script from inside chroot" + exit 1 +elif [ "$(id -u)" -ne 0 ]; then + msg err "You must run this script as root" + exit 1 +fi + cat /etc/issue totalsteps=1 diff --git a/TODO b/TODO @@ -3,7 +3,7 @@ TODO [ ] Add || exit 1 to mkpk_install scripts; revise () || exit 1 -[ ] Organize downloads better: TSV db, fetch all at once at the start +[x] Organize downloads better: TSV db, fetch all at once at the start [x] /share/legal diff --git a/lib/fun.sh b/lib/fun.sh @@ -85,7 +85,7 @@ cd_or_fail() check_dir() { if [ -d "$1" ]; then - msg info "Directory %s exists" "$1" + #msg info "Directory %s exists" "$1" return fi msg info "Creating %s" "$1" @@ -105,7 +105,7 @@ check_mknod() minor=$1 shift if [ -e "${name}" ]; then - msg info "Node %s exists" "${name}" + #msg info "Node %s exists" "${name}" return fi msg info "Creating %s" "${name}" @@ -174,10 +174,10 @@ extract_pkg() cd_or_fail ${parent_dir} if [ -n "${realdir}" ] && [ -d "${realdir}" ]; then - msg info "Directory %s exists" "${realdir}" + #msg info "Directory %s exists" "${realdir}" return elif [ -n "${dir}" ] && [ -d "${dir}" ]; then - msg info "Directory %s exists" "${dir}" + #msg info "Directory %s exists" "${dir}" return fi msg info "Extract %s" "${tarball}" @@ -199,16 +199,16 @@ extract_pkg() fetch_pkg() { - local pkg=${1##*/} realpkg=$2 + local pkg=${1##*/} realpkg=$2 delay=$3 - cd_or_fail ${G_PKG} - if [ -n "${realpkg}" ] && [ -f "${realpkg}" ]; then - msg info "Package %s exists" "${realpkg}" + if [ -n "${realpkg}" ] && [ -f "${G_PKG}/${realpkg}" ]; then + #msg info "Package %s exists" "${realpkg}" return - elif [ -f "${pkg}" ]; then - msg info "Package %s exists" "${pkg}" + elif [ -f "${G_PKG}/${pkg}" ]; then + #msg info "Package %s exists" "${pkg}" return fi + cd_or_fail ${G_PKG} msg info "wget %s" "$1" if ! wget -c $1; then msg err "Fetching package %s failed" "${pkg}" @@ -217,34 +217,34 @@ fetch_pkg() if [ -n "${realpkg}" ]; then mv_or_fail "${pkg}" "${realpkg}" fi + sleep ${delay} } git_clone() { - local dir=$1 repo - shift - repo=${1##*/} + local dir=$1 repo=${2##*/} delay=$3 - cd_or_fail ${G_SRC} - if [ -d "${dir}" ]; then - msg info "Directory %s exists" "${dir}" + if [ -d "${G_SRC}/${dir}" ]; then + #msg info "Directory %s exists" "${dir}" return fi - msg info "git clone %s" "$*" + cd_or_fail ${G_SRC} + msg info "git clone %s" "${repo}" setup_fifo - if ! git clone $* >${G_FIFO} 2>&1; then - msg err "git clone %s failed" "$*" + if ! git clone ${repo} >${G_FIFO} 2>&1; then + msg err "git clone %s failed" "${repo}" exit 1 fi mv_or_fail "${repo%%.git}" "${dir}" rm ${G_FIFO} + sleep ${delay} } link_if_ne() { eval dest=\$$# if [ -L "${dest}" ]; then - msg info "Symlink %s exists" "${dest}" + #msg info "Symlink %s exists" "${dest}" return fi msg info "Symlinking %s" "${dest}" diff --git a/lib/pkgs.tsv b/lib/pkgs.tsv @@ -0,0 +1,62 @@ +URL Directory +git+https://github.com/mirbsd/mksh mksh-20220709 +git+https://github.com/onetrueawk/awk awk-20220709 +git://git.suckless.org/9base 9base-20220706 +git://git.suckless.org/sbase sbase-20220709 +git://git.suckless.org/ubase ubase-20220709 +git://repo.or.cz/tinycc.git tinycc-20220708 +https://astron.com/pub/file/file-5.41.tar.gz +https://dev.alpinelinux.org/archive/posixtz/posixtz-0.5.tar.xz +https://dev.gentoo.org/~xen0n/distfiles/pax-utils-1.3.4.tar.xz +https://distfiles.dereferenced.org/pkgconf/pkgconf-1.8.0.tar.xz +https://download.savannah.gnu.org/releases/acl/acl-2.3.1.tar.xz +https://download.savannah.gnu.org/releases/attr/attr-2.5.1.tar.gz +https://ftp.barfooze.de/pub/sabotage/tarballs/gettext-tiny-0.3.2.tar.xz +https://ftp.barfooze.de/pub/sabotage/tarballs/netbsd-curses-0.3.2.tar.xz +https://ftp.gnu.org/gnu/bash/bash-5.1.tar.gz +https://ftp.gnu.org/gnu/binutils/binutils-2.38.tar.xz +https://ftp.gnu.org/gnu/coreutils/coreutils-9.1.tar.xz +https://ftp.gnu.org/gnu/diffutils/diffutils-3.8.tar.xz +https://ftp.gnu.org/gnu/findutils/findutils-4.9.0.tar.xz +https://ftp.gnu.org/gnu/gdbm/gdbm-1.20.tar.gz +https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz libgmp-6.2.1.tar.xz +https://ftp.gnu.org/gnu/gperf/gperf-3.1.tar.gz +https://ftp.gnu.org/gnu/grep/grep-3.7.tar.xz +https://ftp.gnu.org/gnu/gzip/gzip-1.12.tar.xz +https://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.xz +https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.xz +https://ftp.gnu.org/gnu/make/make-4.3.tar.gz +https://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz libmpc-1.2.1.tar.gz +https://ftp.gnu.org/gnu/mpfr/mpfr-4.1.0.tar.xz libmpfr-4.1.0.tar.xz +https://ftp.gnu.org/gnu/patch/patch-2.7.6.tar.xz +https://ftp.gnu.org/gnu/readline/readline-8.1.tar.gz +https://ftp.gnu.org/gnu/sed/sed-4.8.tar.xz +https://ftp.gnu.org/gnu/tar/tar-1.34.tar.xz +https://ftp.gnu.org/gnu/texinfo/texinfo-6.8.tar.xz +https://gcc.gnu.org/pub/gcc/snapshots/11-20220101/gcc-11-20220101.tar.xz +https://git.sr.ht/~strahinja/sled/archive/v0.10.8.tar.gz sled-0.10.8.tar.gz +https://github.com/Mic92/iana-etc/releases/download/20210611/iana-etc-20210611.tar.gz +https://github.com/arsv/perl-cross/releases/download/1.4/perl-cross-1.4.tar.gz +https://github.com/ericonr/argp-standalone/archive/refs/tags/1.4.1.tar.gz argp-standalone-1.4.1.tar.gz +https://github.com/facebook/zstd/releases/download/v1.5.0/zstd-1.5.0.tar.gz +https://github.com/shadow-maint/shadow/releases/download/v4.11.1/shadow-4.11.1.tar.xz +https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.6.tar.gz zlib-ng-2.0.6.tar.gz +https://invisible-island.net/archives/byacc/byacc-20220128.tgz +https://invisible-island.net/archives/reflex/reflex-20210808.tgz +https://libisl.sourceforge.io/isl-0.24.tar.xz libisl-0.24.tar.xz +https://mandoc.bsd.lv/snapshots/mandoc-1.14.6.tar.gz +https://mandoc.bsd.lv/snapshots/mdocml-1.14.1.tar.gz +https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/man-pages-5.13.tar.xz +https://musl.libc.org/releases/musl-1.2.3.tar.gz +https://prdownloads.sourceforge.net/expat/expat-2.4.8.tar.xz +https://sourceforge.net/projects/psmisc/files/psmisc/psmisc-23.4.tar.xz +https://sourceforge.net/projects/tcl/files/Tcl/8.6.12/tcl8.6.12-src.tar.gz +https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz +https://tukaani.org/xz/xz-5.2.5.tar.xz +https://www.cpan.org/src/5.0/perl-5.32.1.tar.xz +https://www.greenwoodsoftware.com/less/less-590.tar.gz +https://www.iana.org/time-zones/repository/releases/tzcode2022a.tar.gz +https://www.iana.org/time-zones/repository/releases/tzdata2022a.tar.gz +https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.17.13.tar.xz +https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.17.13.tar.xz +https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.62.tar.xz