├── .gitignore ├── LICENSE ├── README.md ├── build-prep.sh ├── chrootboot-stage2.sh ├── chrootboot.sh ├── chroottest.sh ├── extnltools └── releasechk │ ├── config.ini │ ├── release.checker.py │ └── urls.txt ├── kernel ├── patches │ └── placeholder.txt ├── pur.config └── version.txt ├── purbuild.sh └── src ├── etc ├── motd ├── pur-release ├── rc └── rc.subr └── usr ├── bin └── pkgin.sh ├── local └── etc │ ├── mk.conf │ └── pkgin │ └── repositories.conf └── sbin ├── portsnag.sh └── repup.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # we don't want vim swap files accidentally committed. probably should have added this a bit ago 2 | *.swp 3 | # checker temp files 4 | extnltools/releasechk/urls.txt.new 5 | extnltools/releasechk/urls.txt.bak 6 | # checker err log 7 | extnltools/releasechk/urls.error.log 8 | # ignore PyCharm files 9 | .idea 10 | # gorram it, gedit. 11 | *~ 12 | /*.tar.xz 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Buildscript and all specific Pür Linux changes, unless otherwise specified, are: 2 | Copyright © 2015 Rainbow 3 | Copyright © 2016 Pür Linux 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | All components built, previously existing under another license (such as the Linux kernel and the GPL) are distributed under 28 | and in compliance with the terms of their licenses. 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pür Linux 2 | 3 | ## This is a legacy branch kept for historical emotion fuzzies. This is where work on Pür Linux first began. 4 | 5 | Pür Linux is a Linux distribution focused on Stability, Security, and Simplicity. No wonky distro-specific changes, no unneeded packages in base, and best of all (in our opinion), no systemd (though we're big proponents of freedom, and do not explicity make system changes designed to render it impossible for you to install systemd if you so choose. We have no intention of providing a package for it, however.) 6 | 7 | ## About Pür 8 | Pür Linux (Pronounced Pure Linux) consists of a base system comprised of upstream pure code (GNU utils you'd expect on a Linux system, the latest vanilla Linux kernel upon packaging), and the Linux port of pkgsrc from NetBSD for ports. 9 | 10 | Pür Linux is not a fork, nor respin of any pre-existing Linux Distribution. 11 | The only relation to any other distro is that right now, we use an Arch Linux box for building the environment that gets tar'd. 12 | 13 | Unlike other Linux distributions, Pür Linux uses a Base/Ports paradigm, similar to FreeBSD, wherein the base operating system is updated and maintained separately from user-installed packages. This means you can update them independently, and package updates won't bork your OS. 14 | 15 | Pür Linux will be distributed in a quarterly release schedule, starting sometime in 2016. We intend to make our first fork into STABLE branch in April. 16 | 17 | Installation will be as simple as untarring and running setup.sh, or running setup from a Pür installation disk, similar to Slackware's installation process. 18 | 19 | All configurations are done via plaintext files, or shell scripts. 20 | 21 | Shells included are bash, csh, ksh, and fish. 22 | 23 | We are also the very FIRST Linux Distribution with plans to ship NTPsec rather than classic NTP or OpenNTP by default! 24 | https://www.ntpsec.org/ 25 | 26 | ## The Pür Linux Team 27 | * Rainbow - Project Director, BASE team lead, Packages Maintainer. https://twitter.com/hacker_horse 28 | * Brent Saner - Git Wizard, Architecture Engineer, BASE Developer. https://twitter.com/sysadm_podcast 29 | * James Stewart - Documentation team lead. https://twitter.com/TheTechStewart 30 | 31 | ##Benefits of using Pür 32 | * No weird distro-specific changes to the file-system hierarchy: we use a standardized filesystem layout, similar to FreeBSD and traditional UNIX. 33 | * No binary logs or incomprehensible configuration formats: We're not using systemd. Everything is logged to plaintext. Configuration files are the same, unless otherwise specified by upstream, which brings us to: 34 | * 100% Upstream code: everything is build from upstream code. Everything works as the programmers intended, and all documentation is correct (or as correct as the programmer wrote) for the version installed. 35 | * Latest code: Pür's goal is to provide the latest stable code releases from the programmers and teams involved. You won't find a 3 year out of date version of something here. Every release is completely comprised of the newest stable releases, unless otherwise specified in the Changelog/Errata Notification 36 | * No new tools to learn: If you know UNIX, you know Pür Linux. Releases are installed and updated as tarballs you simply extract and overwrite with. Wanna copy your configuration to a whole new system? Tar up /etc and /usr/local, and extract onto a new disk or partition along with the latest Pür Linux release tarball. Done! 37 | * Releases are synced with the latest stable snapshot of the NetBSD pkgsrc tree, and via pkgin and pkgsrc's automated building framework, binary packages are also available, in addition to the standard From Source methodology provided by pkgsrc 38 | * ZFS is a supported Filesystem, and will be included as a Loadable Kernel Module compiled against the current upstream stable Linux kernel. 39 | 40 | ## Plans 41 | 42 | ### Init 43 | We are looking at various init systems right now, as init is the last egg to crack before we're ready to start looking at pre-releases and tuning what packages we include in BASE. 44 | While we do not plan to make it technologically impossible to use systemd on Pür, there will be absolutely no support for such a configuration. 45 | Our current plans are to use an rc-like system, to better integrate with pkgsrc's rc scripts, however the project is open to suggestions from the community. 46 | 47 | ### Other Stuff 48 | While we would like to include Clang/LLVM, due to the Linux kernel being reliant on GCC-specific tweaks right now, we will be including GCC in base, with Clang available via pkgsrc. Plans will be made to transition to Clang in base as soon as is feasible. 49 | 50 | ### Project Roadmap 51 | * May 2016 - Initial fork from CURRENT into 2016-STABLE 52 | 53 | ## Development Branches 54 | Similar to FreeBSD, we currently maintain multiple branches. 55 | * CURRENT - Bleeding edge. Where most of the work occurs. Constantly contains the latest versions of upstream. 56 | * STABLE - The current non-bleeding-edge development branch of the distribution. Currently, we plan yearly branch forks from CURRENT. The STABLE branch will keep up to date with stable upstream code, but major architectural changes, large software version leaps, and major GLibC updates are restricted to CURRENT. STABLE will be usable, however we suggest running a RELEASE image unless you're a developer or interested in development. 57 | * RELENG - Pür Linux's Release Engineering branch is where we stage work for release candidates. Additionally, Security updates are imported into this branch, as well as swiching to a new STABLE branch of pkgsrc. No version increases occur in RELENG once it forks from STABLE. RELENG branches only exist to provide security updates to RELEASE, and EOL after 3 months. 58 | * RELEASE - The current stable release of Pür Linux. Releases are formatted as Year.Month-RELEASE, and are tagged out of the RELENG branch. Security updates are tagged with a U, and branched from STABLE. For example, 2016.07-RELEASE-U1 would be the first security update for 2016.07-RELEASE 59 | 60 | Due to the release schedule, Security Updates will only be supplied for a version until the next major version release. 61 | This means each major version has a 3 month lifecycle until EOL. You will not receive any help for running an EOL version. 62 | 63 | ## Installation notes 64 | 65 | Please be aware of the following caveats: 66 | 67 | As we are using pkgsrc for installed packages, Pür Linux will be placing all installed packages inside the /usr/local directory, similar to FreeBSD. /bin, /sbin, /etc, /usr/bin, and /usr/sbin will only be used for Base utilities. 68 | As such, some scripts (primarily python and perl scripts where other distros have the interpreters in /usr/bin) you download may require tweaking (We always suggest using the #!/usr/bin/env $shell shebang over hardcoded paths) to work on Pür Linux. 69 | 70 | ## FAQ 71 | 72 | Q: So does pkgsrc update the whole system? 73 | 74 | A: Nope! Pür Linux breaks the traditional Linux paradigm of EVERYTHING IS A PACKAGE. I'm a FreeBSD sysadmin, and I really enjoy the separation between the Base system and 3rd party packages. While Pür Linux won't be developed in a single source tree like FreeBSD (No desire nor need to fork much) there's still going to be separation between the Base OS (Pür Linux) and Ports (using pkgsrc) 75 | 76 | 77 | Q: You're just trying to make Linux like $BSD 78 | 79 | A: Yup. That's the world I come from. I started out as a Linux admin originally, but all the lack of standardization between distros made me tear my hair out. Not to mention the problems with the everything is a package way of doing things. 80 | I like having an OS be stable and secure and regularly released, with other packages being taken care of separately. 81 | 82 | 83 | Q: How are we sure no one tampered with anything? 84 | 85 | A: Well, as far as the distro itself, you have to trust me. Thing is, you do that with Ubuntu/CentOS/Slackware/Gentoo already anyway. And like them, everything we're doing is open and available, even our build system, so you can reproduce everything. As far as releases go, each release, as well as the source tarballs, will be signed via a minimum of two senior developers from the project, and checksummed. 86 | 87 | Q: I wanna send you a message. Wat Do. 88 | 89 | A: Email rainbow@purlinux.org 90 | 91 | My PGP key is 0x5F94763A 92 | 93 | You can also just hit me up on Twitter. https://twitter.com/hacker_horse 94 | 95 | You can also follow https://twitter.com/PurLinux or email info@purlinux.org 96 | 97 | Q: IRC? 98 | 99 | A: #purlinux on irc.freenode.net 100 | Come say hi! 101 | 102 | Q: Primary Project Master repo? 103 | 104 | A: On Github, the primary master repo is at https://github.com/PurLinux/Base 105 | 106 | The original repo was located at https://github.com/RainbowHackerHorse/Pur-Linux/ now https://github.com/RainbowHackerHorse/Pur-Linux-Base/tree/Legacy 107 | 108 | Other people may have their own forks. 109 | 110 | Q: How do I build the distro? 111 | 112 | A: Clone the branch you want to fiddle with and run purbuild.sh 113 | -------------------------------------------------------------------------------- /build-prep.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Pur extras 6 | PURX="${HOME}/pur_extras" 7 | ME=$(whoami) 8 | ME_G=$(groups | awk '{print $1}') 9 | 10 | if [[ "$(whoami)" == 'bts' ]]; 11 | then 12 | ME="pur" 13 | ME_G="pur" 14 | fi 15 | 16 | if [[ -z "${PSRC}" ]]; 17 | then 18 | echo "WARNING: THIS SCRIPT REQUIRES TO BE CALLED FROM THE PURBUILD SCRIPT." 19 | echo "DO NOT RUN IT STANDALONE." 20 | exit 1 21 | fi 22 | 23 | mkdir -p ${PURX} 24 | sudo mv ${PLOGS} ${PURX}/. 25 | sudo mv ${PSRC} ${PURX}/. 26 | sudo mv ${PUR}/var/log/pur_install ${PURX}/chroot_logs 27 | rm -f ${PUR}/chrootboot* 28 | rm -rf ${PUR}/contrib 29 | 30 | 31 | sudo chown -R ${ME} ${PURX} 32 | find ${PURX}/. -type d -exec chmod 700 '{}' \; 33 | find ${PURX}/. -type f -exec chmod 600 '{}' \; 34 | 35 | -------------------------------------------------------------------------------- /chrootboot-stage2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | env -i HOME=${HOME} TERM=${TERM} PS1='\u:\w\$ ' > /dev/null 2>&1 4 | set +h 5 | umask 022 6 | echo 7 | set +h 8 | 9 | set -e 10 | 11 | #set -e 12 | if [ "${PS4}" == 'Line ${LINENO}: ' ]; 13 | then 14 | set -x 15 | fi 16 | 17 | PUR="/" 18 | PSRC="/sources" 19 | PTLS="/tools" 20 | PCNTRB="/contrib" 21 | export PUR PSRC PCNTRB PTLS 22 | 23 | if [ "${USER}" == 'bts' ]; 24 | then 25 | export MAKEFLAGS="-j $(($(egrep '^processor[[:space:]]*:' /proc/cpuinfo | wc -l)+1))" 26 | fi 27 | ulimit -n 512 28 | 29 | PLOGS=/var/log/pur_install 30 | rm -rf ${PLOGS} 31 | mkdir -p ${PLOGS} 32 | 33 | contsrc_prep () { 34 | pkg=${1} 35 | if [ -z "${pkg}" ]; 36 | then 37 | echo "WARNING: coresrc_prep called with no packagename!" 38 | exit 1 39 | fi 40 | rm -rf ${PSRC}/${pkg} 41 | cp -a ${PSRC}/pur_src/contrib/${pkg} ${PSRC} 42 | cd ${PSRC}/${pkg} 43 | } 44 | 45 | contsrc_prep2 () { 46 | pkg=${1} 47 | if [ -z "${pkg}" ]; 48 | then 49 | echo "WARNING: coresrc_prep2 called with no packagename!" 50 | exit 1 51 | fi 52 | rm -rf ${PSRC}/${pkg} 53 | cp -a ${PSRC}/pur_src/contrib/${pkg} ${PSRC} 54 | mkdir ${PSRC}/${pkg}/${pkg}-build 55 | cd ${PSRC}/${pkg}/${pkg}-build 56 | } 57 | 58 | contsrc_clean () { 59 | pkg=${1} 60 | if [ -z "${pkg}" ]; 61 | then 62 | echo "WARNING: coresrc_clean called with no packagename!" 63 | exit 1 64 | fi 65 | cd ${PSRC} 66 | rm -rf ${PSRC}/${pkg} 67 | } 68 | 69 | rm -rf /tools 70 | rm -f /usr/lib/lib{bfd,opcodes}.a 71 | rm -f /usr/lib/libbz2.a 72 | rm -f /usr/lib/lib{com_err,e2p,ext2fs,ss}.a 73 | rm -f /usr/lib/libltdl.a 74 | rm -f /usr/lib/libfl.a 75 | rm -f /usr/lib/libfl_pic.a 76 | rm -f /usr/lib/libz.a 77 | rm -rf /tmp/* 78 | 79 | 80 | # LibreSSL 81 | echo "[LibreSSL] Configuring..." 82 | contsrc_prep libressl 83 | # configure here 84 | ./configure --prefix=/usr --with-openssldir=/etc/ssl > ${PLOGS}/libressl_configure.1 2>&1 85 | echo "[LibreSSL] Building..." 86 | # compile here 87 | make > ${PLOGS}/libressl_make.1 2>&1 88 | make install >> ${PLOGS}/libressl_make.1 2>&1 89 | contsrc_clean libressl 90 | 91 | # python 92 | echo "[Python] Configuring..." 93 | contsrc_prep python 94 | ./configure --prefix=/usr > ${PLOGS}/python_configure.1 2>&1 95 | echo "[Python] Building..." 96 | make > ${PLOGS}/python_make.1 2>&1 97 | make install >> ${PLOGS}/python_make.1 2>&1 98 | contsrc_clean python 99 | 100 | # libevent 101 | # dependency for NTPsec so it's actually usable. 102 | # needs to stay installed- is a runtime dep 103 | contsrc_prep libevent 104 | echo "[LibEvent] Configuring..." 105 | ./configure --prefix=/usr > ${PLOGS}/libevent_configure.1 2>&1 106 | echo "[LibEvent] Building..." 107 | make > ${PLOGS}/libevent_make.1 2>&1 108 | make install >> ${PLOGS}/libevent_make.1 2>&1 109 | contsrc_clean libevent 110 | 111 | # NTPsec 112 | # note: if we remove NTPsec as a base/contrib dep, 113 | # we can remove python2 and libevent2 as well. 114 | # without python2, ntpsec does not build 115 | # and without libevent2: 116 | ## Warning libevent2 does not work 117 | ## This means ntpdig will not be built 118 | ## While not necessary you will lose 'ntpdate' functionality. 119 | echo "[NTPsec] Configuring..." 120 | contsrc_prep ntpsec 121 | # configure here 122 | python waf configure --prefix=/usr > ${PLOGS}/ntpsec_configure.1 2>&1 123 | echo "[NTPsec] Building..." 124 | # compile here 125 | python waf > ${PLOGS}/ntpsec_make.1 2>&1 126 | python waf install >> ${PLOGS}/npsec_make.1 2>&1 127 | contsrc_clean ntpsec 128 | 129 | 130 | # Net-Tools 131 | # stable 1.6.0 release doesn't build properly in newer gcc. 132 | # maybe incorporate "git archive -o repo.tar --remote= "? 133 | #echo "[Net-Tools] Configuring..." 134 | contsrc_prep net-tools 135 | # configure here 136 | #./configure --prefix=/usr > ${PLOGS}/net-tools_configure.1 2>&1 137 | echo "[Net-Tools] Building..." 138 | # compile here 139 | yes "" | make > ${PLOGS}/net-tools_make.1 2>&1 140 | make install >> ${PLOGS}/net-tools_make.1 2>&1 141 | contsrc_clean net-tools 142 | 143 | 144 | 145 | # zfs 146 | contsrc_prep zfs 147 | echo "[ZFS] Configuring..." 148 | ./configure --prefix=/usr > ${PLOGS}/zfs_configure.1 2>&1 149 | echo "[ZFS] Building..." 150 | make > ${PLOGS}/zfs_make.1 2>&1 151 | make install >> ${PLOGS}/zfs_make.1 2>&1 152 | 153 | ## We need to built the kernel BEFORE spl. 154 | ## It wants the kernel sources, not just the headers...? 155 | ## Anyways, make sure to not do a coresrc_clean linux after the 156 | ## *kernel* is built. 157 | #cd ${PSRC}/zfs/spl 158 | #echo "[SPL] Configuring..." 159 | #./configure --prefix=/usr > ${PLOGS}/spl_configure.1 2>&1 160 | #echo "[SPL] Building..." 161 | #make > ${PLOGS}/spl_make.1 2>&1 162 | #make install >> ${PLOGS}/spl_make.1 2>&1 163 | #contsrc_clean zfs 164 | 165 | # cleanup python since we just needed it for ntpsec 166 | rm -rf /usr/{lib,include,bin,share/man/man1}/python* 167 | -------------------------------------------------------------------------------- /chrootboot.sh: -------------------------------------------------------------------------------- 1 | #!/tools/bin/bash 2 | 3 | env -i HOME=${HOME} TERM=${TERM} PS1='\u:\w\$ ' > /dev/null 2>&1 4 | set +h 5 | umask 022 6 | echo 7 | set +h 8 | 9 | set -e 10 | if [ "${PS4}" == 'Line ${LINENO}: ' ]; 11 | then 12 | set -x 13 | fi 14 | 15 | MAKEFLAGS_LOG=${MAKEFLAGS} 16 | 17 | PUR="/" 18 | PSRC="/sources" 19 | PTLS="/tools" 20 | PCNTRB="/contrib" 21 | export PUR PSRC PCNTRB PTLS 22 | 23 | ulimit -n 512 24 | 25 | # /dev will be handled by eudev. -bts 26 | echo "Making directory tree..." 27 | mkdir -p /{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt} 28 | mkdir -p /{media/{floppy,cdrom},sbin,srv,var} 29 | install -d -m 0750 /root 30 | install -d -m 1777 /tmp /var/tmp 31 | mkdir -p /usr/{,local/}{bin,include,lib,sbin,src} 32 | mkdir -p /usr/{,local/}share/{color,dict,doc,info,locale,man} 33 | mkdir -p /usr/{,local/}share/{misc,terminfo,zoneinfo} 34 | mkdir -p /usr/libexec 35 | mkdir -p /usr/{,local/}share/man/man{1..8} 36 | 37 | case $(uname -m) in 38 | x86_64) ln -sf lib /lib64 39 | ln -sf lib /usr/lib64 40 | ln -sf lib /usr/local/lib64 ;; 41 | esac 42 | mkdir -p /var/{log,mail,spool} 43 | ln -sf /run /var/run 44 | ln -sf /run/lock /var/lock 45 | mkdir -p /var/{opt,cache,lib/{color,misc,locate},local} 46 | 47 | ln -sf ${PTLS}/bin/{bash,cat,echo,pwd,stty} /bin 48 | ln -sf ${PTLS}/bin/perl /usr/bin 49 | ln -sf ${PTLS}/lib/libgcc_s.so{,.1} /usr/lib 50 | ln -sf ${PTLS}/lib/libstdc++.so{,.6} /usr/lib 51 | sed -e "s@${PTLS}@/usr@" ${PTLS}/lib/libstdc++.la > /usr/lib/libstdc++.la 52 | ln -sf bash /bin/sh 53 | 54 | ln -sf /proc/self/mounts /etc/mtab 55 | 56 | cat > /etc/passwd << "EOF" 57 | root:x:0:0:root:/root:/bin/bash 58 | bin:x:1:1:bin:/dev/null:/bin/false 59 | daemon:x:6:6:Daemon User:/dev/null:/bin/false 60 | messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false 61 | nobody:x:99:99:Unprivileged User:/dev/null:/bin/false 62 | EOF 63 | 64 | cat > /etc/group << "EOF" 65 | root:x:0: 66 | bin:x:1:daemon 67 | sys:x:2: 68 | kmem:x:3: 69 | tape:x:4: 70 | tty:x:5: 71 | daemon:x:6: 72 | floppy:x:7: 73 | disk:x:8: 74 | lp:x:9: 75 | dialout:x:10: 76 | audio:x:11: 77 | video:x:12: 78 | utmp:x:13: 79 | usb:x:14: 80 | cdrom:x:15: 81 | adm:x:16: 82 | messagebus:x:18: 83 | systemd-journal:x:23: 84 | input:x:24: 85 | mail:x:34: 86 | nogroup:x:99: 87 | users:x:999: 88 | EOF 89 | 90 | touch /var/log/{btmp,lastlog,wtmp} 91 | chgrp utmp /var/log/lastlog 92 | chmod 664 /var/log/lastlog 93 | chmod 600 /var/log/btmp 94 | 95 | PLOGS=/var/log/pur_install 96 | rm -rf ${PLOGS} 97 | mkdir -p ${PLOGS} 98 | 99 | coresrc_prep () { 100 | pkg=${1} 101 | if [ -z "${pkg}" ]; 102 | then 103 | echo "WARNING: coresrc_prep called with no packagename!" 104 | exit 1 105 | fi 106 | rm -rf ${PSRC}/${pkg} 107 | cp -a ${PSRC}/pur_src/core/${pkg} ${PSRC} 108 | cd ${PSRC}/${pkg} 109 | } 110 | 111 | coresrc_prep2 () { 112 | pkg=${1} 113 | if [ -z "${pkg}" ]; 114 | then 115 | echo "WARNING: coresrc_prep2 called with no packagename!" 116 | exit 1 117 | fi 118 | rm -rf ${PSRC}/${pkg} 119 | cp -a ${PSRC}/pur_src/core/${pkg} ${PSRC} 120 | mkdir ${PSRC}/${pkg}/${pkg}-build 121 | cd ${PSRC}/${pkg}/${pkg}-build 122 | } 123 | 124 | coresrc_clean () { 125 | pkg=${1} 126 | if [ -z "${pkg}" ]; 127 | then 128 | echo "WARNING: coresrc_clean called with no packagename!" 129 | exit 1 130 | fi 131 | cd ${PSRC} 132 | rm -rf ${PSRC}/${pkg} 133 | } 134 | 135 | 136 | # linux headers 137 | echo "[Kernel] Cleaning sources for headers..." 138 | coresrc_prep linux 139 | make mrproper > ${PLOGS}/kernel-headers_clean.1 2>&1 140 | 141 | echo "[Kernel] Building headers..." 142 | make INSTALL_HDR_PATH=dest headers_install > ${PLOGS}/kernel-headers_make.1 2>&1 143 | find dest/include \( -name .install -o -name ..install.cmd \) -delete > /dev/null 2>&1 144 | cp -r dest/include/* /usr/include 145 | coresrc_clean linux 146 | 147 | 148 | # man pages 149 | echo "[Man pages] Installing..." 150 | coresrc_prep man-pages 151 | make install > ${PLOGS}/man_make.1 2>&1 152 | coresrc_clean man-pages 153 | 154 | 155 | # glibc 156 | echo "[GLibC] Configuring..." 157 | coresrc_prep2 glibc 158 | ../configure \ 159 | --prefix=/usr \ 160 | --disable-profile \ 161 | --enable-kernel=2.6.32 \ 162 | --enable-obsolete-rpc > ${PLOGS}/glibc_configure.1 2>&1 163 | 164 | echo "[GLibC] Building..." 165 | make > ${PLOGS}/glibc_make.1 2>&1 166 | # the LFS handbook makes a WHOA OMG SUPAR BIG DEAL out of running the tests even though some are guaranteed to fail, so... 167 | echo "[GLibC] Running tests..." 168 | set +e 169 | make check > ${PLOGS}/glibc_check.1 2>&1 170 | set -e 171 | touch /etc/ld.so.conf 172 | make install >> ${PLOGS}/glibc_make.1 2>&1 173 | cp ../nscd/nscd.conf /etc/nscd.conf 174 | mkdir -p /var/cache/nscd 175 | mkdir -p /usr/lib/locale 176 | localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8 177 | localedef -i de_DE -f ISO-8859-1 de_DE 178 | localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro 179 | localedef -i de_DE -f UTF-8 de_DE.UTF-8 180 | localedef -i en_GB -f UTF-8 en_GB.UTF-8 181 | localedef -i en_HK -f ISO-8859-1 en_HK 182 | localedef -i en_PH -f ISO-8859-1 en_PH 183 | localedef -i en_US -f ISO-8859-1 en_US 184 | localedef -i en_US -f UTF-8 en_US.UTF-8 185 | localedef -i es_MX -f ISO-8859-1 es_MX 186 | localedef -i fa_IR -f UTF-8 fa_IR 187 | localedef -i fr_FR -f ISO-8859-1 fr_FR 188 | localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro 189 | localedef -i fr_FR -f UTF-8 fr_FR.UTF-8 190 | localedef -i it_IT -f ISO-8859-1 it_IT 191 | localedef -i it_IT -f UTF-8 it_IT.UTF-8 192 | localedef -i ja_JP -f EUC-JP ja_JP 193 | localedef -i ru_RU -f KOI8-R ru_RU.KOI8-R 194 | localedef -i ru_RU -f UTF-8 ru_RU.UTF-8 195 | localedef -i tr_TR -f UTF-8 tr_TR.UTF-8 196 | localedef -i zh_CN -f GB18030 zh_CN.GB18030 197 | # this would install all locale defs... 198 | #make localedata/install-locales >> ${PLOGS}/glibc_make.1 2>&1 199 | 200 | cat > /etc/nsswitch.conf << "EOF" 201 | # Begin /etc/nsswitch.conf 202 | passwd: files 203 | group: files 204 | shadow: files 205 | hosts: files dns 206 | networks: files 207 | protocols: files 208 | services: files 209 | ethers: files 210 | rpc: files 211 | # End /etc/nsswitch.conf 212 | EOF 213 | coresrc_clean glibc 214 | 215 | # timezone data 216 | echo "Timezone data..." 217 | coresrc_prep tzdata 218 | ZONEINFO=/usr/share/zoneinfo 219 | mkdir -p ${ZONEINFO}/{posix,right} 220 | for tz in etcetera southamerica northamerica europe africa antarctica asia australasia backward pacificnew systemv; 221 | do 222 | zic -L /dev/null -d ${ZONEINFO} -y "sh yearistype.sh" ${tz} 223 | zic -L /dev/null -d ${ZONEINFO}/posix -y "sh yearistype.sh" ${tz} 224 | zic -L leapseconds -d ${ZONEINFO}/right -y "sh yearistype.sh" ${tz} 225 | done 226 | # And set the timezone. UNIX philosophy suggests UTC by default. 227 | cp zone.tab zone1970.tab iso3166.tab ${ZONEINFO} 228 | zic -d ${ZONEINFO} -p UTC 229 | unset ZONEINFO 230 | ln -sf /usr/share/zoneinfo/UTC /etc/localtime 231 | 232 | 233 | # dynamic loader config 234 | echo "Configuring the dynamic loader..." 235 | cat > /etc/ld.so.conf << "EOF" 236 | # Begin /etc/ld.so.conf 237 | /usr/local/lib 238 | /opt/lib 239 | EOF 240 | cat >> /etc/ld.so.conf << "EOF" 241 | # Add an include directory 242 | include /etc/ld.so.conf.d/*.conf 243 | EOF 244 | mkdir -p /etc/ld.so.conf.d 245 | 246 | 247 | # toolchain modifications... 248 | echo "Modifying the toolchain..." 249 | mv ${PTLS}/bin/{ld,ld-old} 250 | mv ${PTLS}/$(uname -m)-pc-linux-gnu/bin/{ld,ld-old} 251 | mv ${PTLS}/bin/{ld-new,ld} 252 | ln -s ${PTLS}/bin/ld ${PTLS}/$(uname -m)-pc-linux-gnu/bin/ld 253 | gcc -dumpspecs | sed -e "s@${PTLS}@@g" -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' -e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > $(dirname $(gcc --print-libgcc-file-name))/specs 254 | echo 'int main(){}' > dummy.c 255 | cc dummy.c -v -Wl,--verbose &> dummy.log 256 | readelf -l a.out | grep -q ': /lib' 257 | if [ "${?}" != '0' ]; 258 | then 259 | echo "GCC failed! Bailing out..." 260 | exit 1 261 | fi 262 | linecnt=$(grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log | wc -l) 263 | if [ "${linecnt}" != '3' ]; 264 | then 265 | echo "GCC using incorrect startfiles! Bailing out..." 266 | exit 1 267 | fi 268 | 269 | grep -B1 '^ /usr/include' dummy.log | egrep -Eq '^#include <...> search starts here:[[:space:]]*$' 270 | if [ "${?}" != '0' ]; 271 | then 272 | echo "Compiler searching for wrong header files! Bailing out..." 273 | exit 1 274 | fi 275 | linecnt=$(grep 'SEARCH.*/usr/lib' dummy.log | sed -e 's|; |\n|g' | egrep -Ec '^(SEARCH_DIR\("/usr/lib"\)|SEARCH_DIR\("/lib"\))[[:space:]]*$') 276 | if [ "${linecnt}" != '2' ]; 277 | then 278 | echo "Linker using incorrect search paths! Bailing out..." 279 | exit 1 280 | fi 281 | egrep -E '/lib(64|32)?/libc\.so\.6 ' dummy.log | egrep -q 'attempt to open /lib(32|64)?/libc\.so\.6 succeeded' 282 | if [ "${?}" != '0' ]; 283 | then 284 | "Incorrect LibC being used! Bailing out..." 285 | exit 1 286 | fi 287 | grep found dummy.log | egrep -Eq '^found ld-linux-[ix]6?86(-64)?\.so\.2 at /lib(32|64)?/ld-linux-[xi]6?86(-64)?\.so\.2[[:space:]]*$' 288 | if [ "${?}" != '0' ]; 289 | then 290 | # per LFS 7.8, p.97, "If the output does not appear [as we check for it], then something is seriously wrong." thanks! 291 | echo "Something is 'seriously wrong'. Bailing out..." 292 | exit 1 293 | fi 294 | rm dummy.c a.out dummy.log 295 | coresrc_clean tzdata 296 | 297 | 298 | # zlib 299 | coresrc_prep zlib 300 | echo "[Zlib] Configuring..." 301 | ./configure --prefix=/usr > ${PLOGS}/zlib_configure.1 2>&1 302 | 303 | echo "[Zlib] Building..." 304 | make > ${PLOGS}/zlib_make.1 2>&1 305 | make install >> ${PLOGS}/zlib_make.1 2>&1 306 | mv /usr/lib/libz.so.* /lib 307 | ln -sf ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so 308 | coresrc_clean zlib 309 | 310 | # file 311 | coresrc_prep file 312 | echo "[File] Configuring..." 313 | ./configure --prefix=/usr > ${PLOGS}/file_configure.1 2>&1 314 | 315 | echo "[File] Building..." 316 | make > ${PLOGS}/file_make.1 2>&1 317 | make install > ${PLOGS}/file_make.1 2>&1 318 | coresrc_clean file 319 | 320 | # binutils 321 | expect -c "spawn ls" | egrep -Eq '^spawn ls[[:space:]]*$' 322 | if [ "${?}" != '0' ]; 323 | then 324 | echo "Your PTY allocation is failing. Bailing out..." 325 | exit 1 326 | fi 327 | coresrc_prep2 binutils 328 | echo "[Binutils] Configuring..." 329 | ../configure --prefix=/usr \ 330 | --enable-shared \ 331 | --disable-werror > ${PLOGS}/binutils_configure.1 2>&1 332 | 333 | echo "[Binutils] Building..." 334 | make tooldir=/usr > ${PLOGS}/binutils_make.1 2>&1 335 | set +e 336 | #make check > ${PLOGS}/binutils_check.1 2>&1 337 | set -e 338 | make tooldir=/usr install >> ${PLOGS}/binutils_make.1 2>&1 339 | coresrc_clean binutils 340 | 341 | 342 | # GMP 343 | coresrc_prep gmp 344 | echo "[GMP] Configuring..." 345 | ./configure --prefix=/usr \ 346 | --enable-cxx \ 347 | --disable-static \ 348 | --docdir=/usr/share/doc/gmp > ${PLOGS}/gmp_configure.1 2>&1 349 | 350 | echo "[GMP] Building..." 351 | make > ${PLOGS}/gmp_make.1 2>&1 352 | # keeps failing...?? 353 | make html >> ${PLOGS}/gmp_make.1 2>&1 354 | echo "[GMP] Running tests..." 355 | make check > ${PLOGS}/gmp_check.1 2>&1 356 | linecnt=$(awk '/tests passed/{total+=$2} ; END{print total}' ${PLOGS}/gmp_check.1 | wc -l) 357 | if [ -z "${linecnt}" ]; 358 | then 359 | echo "GMP test failed; bailing out..." 360 | exit 1 361 | fi 362 | make install >> ${PLOGS}/gmp_make.1 2>&1 363 | make install-html >> ${PLOGS}/gmp_make.1 2>&1 364 | coresrc_clean gmp 365 | 366 | 367 | # MPFR 368 | coresrc_prep mpfr 369 | echo "[MPFR] Configuring..." 370 | ./configure --prefix=/usr \ 371 | --disable-static \ 372 | --enable-thread-safe \ 373 | --docdir=/usr/share/doc/mpfr > ${PLOGS}/mpfr_configure.1 2>&1 374 | 375 | echo "[MPFR] Building..." 376 | make > ${PLOGS}/mpfr_make.1 2>&1 377 | # gorram it. 378 | make html >> ${PLOGS}/mpfr_make.1 2>&1 379 | #make check > ${PLOGS}/mpfr_check.1 2>&1 380 | make install >> ${PLOGS}/mpfr_make.1 2>&1 381 | make install-html >> ${PLOGS}/mpfr_make.1 2>&1 382 | coresrc_clean mpfr 383 | 384 | 385 | # MPC 386 | coresrc_prep mpc 387 | echo "[MPC] Configuring..." 388 | ./configure --prefix=/usr \ 389 | --disable-static \ 390 | --docdir=/usr/share/doc/mpc > ${PLOGS}/mpc_configure.1 2>&1 391 | 392 | echo "[MPC] Building..." 393 | make > ${PLOGS}/mpc_make.1 2>&1 394 | make html >> ${PLOGS}/mpc_make.1 2>&1 395 | #make check > ${PLOGS}/mpc_check.1 2>&1 396 | make install >> ${PLOGS}/mpc_make.1 2>&1 397 | make install-html >> ${PLOGS}/mpc_make.1 2>&1 398 | coresrc_clean mpc 399 | 400 | 401 | # GCC 402 | coresrc_prep2 gcc 403 | #make distclean > ${PLOGS}/gcc_clean.1 2>&1 404 | echo "[GCC] Configuring..." 405 | SED=sed 406 | ../configure --prefix=/usr \ 407 | --enable-languages=c,c++ \ 408 | --disable-multilib \ 409 | --disable-bootstrap \ 410 | --with-system-zlib > ${PLOGS}/gcc_configure.1 2>&1 411 | 412 | echo "[GCC] Building..." 413 | make > ${PLOGS}/gcc_make.1 2>&1 414 | # gorram gcc. might not be necessary, but we're "inside" the PUR root at this point, so... 415 | ulimit -s 32768 416 | set +e 417 | #make -k check > ${PLOGS}/gcc_check.1 2>&1 418 | set -e 419 | ../contrib/test_summary >> ${PLOGS}/gcc_check.1 2>&1 420 | make install >> ${PLOGS}/gcc_make.1 2>&1 421 | ln -s /usr/bin/cpp /lib 422 | ln -s gcc /usr/bin/cc 423 | install -dm755 /usr/lib/bfd-plugins 424 | ln -sf ../../libexec/gcc/$(gcc -dumpmachine)/${GCCVER}/liblto_plugin.so /usr/lib/bfd-plugins/ 425 | echo 'int main(){}' > dummy.c 426 | cc dummy.c -v -Wl,--verbose &> dummy.log 427 | 428 | echo "[GCC] Running sanity checks..." 429 | if readelf -l a.out | grep ': /lib' | egrep -Eq '[Requesting program interpreter: /lib(64)?/ld-linux(-(x86_64|i686))?.so.2]'; 430 | then 431 | echo "Interpreter OK; continuing..." 432 | else 433 | echo "Interpreter failed; bailing out." 434 | exit 1 435 | fi 436 | 437 | if grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log | egrep -Eq "^/usr/lib(64|32)?/(gcc/)?$(uname -m).*(lib(64|32)?/)?crt[1in]\.o\ succeeded$"; 438 | then 439 | echo "Startup files correct; continuing..." 440 | else 441 | echo "Startup files incorrect; bailing out." 442 | exit 1 443 | fi 444 | 445 | if grep -B4 '^ /usr/include' dummy.log | egrep -Eq "/usr/(lib/gcc/$(uname -m).*/${GCCVER}/include(-fixed)?|(local/)?include)"; 446 | then 447 | echo "Header files correct; continuing..." 448 | else 449 | echo "Header files incorrect; bailing out..." 450 | exit 1 451 | fi 452 | 453 | if grep 'SEARCH.*/usr/lib' dummy.log | sed 's|; |\n|g' | egrep -Eq '^SEARCH_DIR\("/usr/lib(64|32)?"\)'; 454 | then 455 | echo "Paths correct; continuing..." 456 | else 457 | echo "Paths incorrect; bailing out..." 458 | exit 1 459 | fi 460 | 461 | if grep "/lib.*/libc.so.6 " dummy.log | egrep -Eq '^attempt\ to\ open\ /lib(32|64)?/libc\.so\.6\ succeeded$'; 462 | then 463 | echo "Correct LIBC being used; continuing..." 464 | else 465 | echo "Incorrect libc being used; bailing out..." 466 | exit 1 467 | fi 468 | 469 | if grep found dummy.log | egrep -q '^found ld-linux-x86-64.so.2 at /lib64/ld-linux-x86-64.so.2$'; 470 | then 471 | echo "Correct dynamic linker being used; continuing..." 472 | else 473 | echo "Incorrect dynamic linker being used; bailing out..." 474 | exit 1 475 | fi 476 | 477 | rm dummy.c a.out dummy.log 478 | mkdir -p /usr/share/gdb/auto-load/usr/lib 479 | mv /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib 480 | coresrc_clean gcc 481 | 482 | # Bzip2 483 | coresrc_prep bzip2 484 | sed -i -re 's@(ln -s -f )$\(PREFIX\)/bin/@\1@' Makefile 485 | sed -i -e "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile 486 | 487 | echo "[Bzip2] Building..." 488 | make -f Makefile-libbz2_so > ${PLOGS}/bzip2_make.1 2>&1 489 | make clean >> ${PLOGS}/bzip2_make.1 2>&1 490 | make >> ${PLOGS}/bzip2_make.1 2>&1 491 | make PREFIX=/usr install >> ${PLOGS}/bzip2_make.1 2>&1 492 | cp bzip2-shared /bin/bzip2 493 | cp -a libbz2.so* /lib 494 | ln -s ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so 495 | rm /usr/bin/{bunzip2,bzcat,bzip2} 496 | ln -s bzip2 /bin/bunzip2 497 | ln -s bzip2 /bin/bzcat 498 | coresrc_clean bzip2 499 | 500 | 501 | # Pkg-config 502 | coresrc_prep pkg-config 503 | echo "[Pkg-config] Configuring..." 504 | ./configure --prefix=/usr \ 505 | --with-internal-glib \ 506 | --disable-host-tool \ 507 | --docdir=/usr/share/doc/pkg-config > ${PLOGS}/pkg-config_configure.1 2>&1 508 | 509 | echo "[Pkg-config] Building..." 510 | make > ${PLOGS}/pkg-config_make.1 2>&1 511 | #make check > ${PLOGS}/pkg-config_check.1 2>&1 512 | make install >> ${PLOGS}/pkg-config_make.1 2>&1 513 | coresrc_clean pkg-config 514 | 515 | 516 | # nCurses 517 | coresrc_prep ncurses 518 | echo "[nCurses] Configuring..." 519 | sed -i -e '/LIBTOOL_INSTALL/d' c++/Makefile.in 520 | ./configure --prefix=/usr \ 521 | --mandir=/usr/share/man \ 522 | --with-shared \ 523 | --without-debug \ 524 | --without-normal \ 525 | --enable-pc-files \ 526 | --enable-widec > ${PLOGS}/ncurses_configure.1 2>&1 527 | 528 | echo "[nCurses] Building..." 529 | make > ${PLOGS}/ncurses_make.1 2>&1 530 | make install >> ${PLOGS}/ncurses_make.1 2>&1 531 | mv /usr/lib/libncursesw.so.6* /lib 532 | ln -sf /lib/$(readlink /usr/lib/libncursesw.so) /usr/lib/libncursesw.so 533 | for lib in ncurses form panel menu; 534 | do 535 | rm -f /usr/lib/lib${lib}.so 536 | echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so 537 | ln -sf ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc 538 | done 539 | rm -f /usr/lib/libcursesw.so 540 | echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so 541 | ln -sf libncurses.so /usr/lib/libcurses.so 542 | coresrc_clean ncurses 543 | 544 | 545 | # attr 546 | coresrc_prep attr 547 | echo "[Attr] Configuring..." 548 | sed -i -e 's|/@pkg_name@|&-@pkg_version@|' include/builddefs.in 549 | sed -i -e "/SUBDIRS/s|man[25]||g" man/Makefile 550 | ./configure --prefix=/usr \ 551 | --bindir=/bin \ 552 | --disable-static > ${PLOGS}/attr_configure.1 2>&1 553 | 554 | echo "[Attr] Building..." 555 | make > ${PLOGS}/attr_make.1 2>&1 556 | # the tests will fail horribly if we aren't on an ext(2|3|4) filesystem... 557 | set +e 558 | make -j1 tests root-tests > ${PLOGS}/attr_check.1 2>&1 559 | set -e 560 | make install install-dev install-lib >> ${PLOGS}/attr_make.1 2>&1 561 | chmod 755 /usr/lib/libattr.so 562 | mv /usr/lib/libattr.so.* /lib 563 | ln -sf /lib/$(readlink /usr/lib/libattr.so) /usr/lib/libattr.so 564 | coresrc_clean attr 565 | 566 | 567 | # Acl 568 | coresrc_prep acl 569 | echo "[Acl] Configuring..." 570 | sed -i -e 's|/@pkg_name@|&-@pkg_version@|' include/builddefs.in 571 | sed -i -e 's:| sed.*::g' test/{sbits-restore,cp,misc}.test 572 | sed -i -e '/TABS-1;/a if (x > (TABS-1)) x = (TABS-1);' libacl/__acl_to_any_text.c 573 | ./configure --prefix=/usr \ 574 | --bindir=/bin \ 575 | --disable-static \ 576 | --libexecdir=/usr/lib > ${PLOGS}/acl_configure.1 2>&1 577 | 578 | echo "[Acl] Building..." 579 | make > ${PLOGS}/acl_make.1 2>&1 580 | make install install-dev install-lib >> ${PLOGS}/acl_make.1 2>&1 581 | chmod 755 /usr/lib/libacl.so 582 | mv /usr/lib/libacl.so.* /lib 583 | ln -sf /lib/$(readlink /usr/lib/libacl.so) /usr/lib/libacl.so 584 | coresrc_clean acl 585 | 586 | 587 | # Libcap 588 | coresrc_prep libcap 589 | echo "[LibCap] Building..." 590 | sed -i -e '/install.*STALIBNAME/d' libcap/Makefile 591 | make > ${PLOGS}/libcap_make.1 2>&1 592 | make RAISE_SETFCAP=no prefix=/usr install >> ${PLOGS}/libcap_make.1 2>&1 593 | chmod 755 /usr/lib/libcap.so 594 | mv /usr/lib/libcap.so.* /lib 595 | ln -sf /lib/$(readlink /usr/lib/libcap.so) /usr/lib/libcap.so 596 | coresrc_clean libcap 597 | 598 | 599 | # Sed 600 | coresrc_prep sed 601 | echo "[Sed] Configuring..." 602 | ./configure --prefix=/usr --bindir=/bin --htmldir=/usr/share/doc/sed > ${PLOGS}/sed_configure.1 2>&1 603 | 604 | echo "[Sed] Building..." 605 | make > ${PLOGS}/sed_make.1 2>&1 606 | set +e 607 | make html >> ${PLOGS}/sed_make.1 2>&1 608 | set -e 609 | #make check > ${PLOGS}/sed_check.1 2>&1 610 | make install >> ${PLOGS}/sed_make.1 2>&1 611 | set +e 612 | make -C doc install-html >> ${PLOGS}/sed_make.1 2>&1 613 | set -e 614 | coresrc_clean sed 615 | 616 | 617 | # Shadow 618 | coresrc_prep shadow 619 | echo "[Shadow] Configuring..." 620 | sed -i -e 's/groups$(EXEEXT) //' src/Makefile.in 621 | find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; 622 | find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \; 623 | find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \; 624 | sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' -e 's@/var/spool/mail@/var/mail@' -e 's@DICTPATH.*@DICTPATH\t/lib/cracklib/pw_dict@' etc/login.defs 625 | sed -i 's/1000/999/' etc/useradd 626 | ./configure --sysconfdir=/etc --with-group-name-max-length=32 > ${PLOGS}/shadow_configure.1 2>&1 627 | 628 | echo "[Shadow] Building..." 629 | make > ${PLOGS}/shadow_make.1 2>&1 630 | make install ${PLOGS}/shadow_make.1 2>&1 631 | mv /usr/bin/passwd /bin 632 | pwconv >> ${PLOGS}/shadow_configure.1 2>&1 633 | grpconv >> ${PLOGS}/shadow_configure.1 2>&1 634 | sed -i -e 's/1000/100/g' /etc/default/useradd 635 | passwd -e root 636 | coresrc_clean shadow 637 | 638 | 639 | # Psmisc 640 | coresrc_prep psmisc 641 | echo "[PSmisc] Configuring..." 642 | ./configure --prefix=/usr > ${PLOGS}/psmisc_configure.1 2>&1 643 | 644 | echo "[PSmisc] Building..." 645 | make > ${PLOGS}/psmisc_make.1 2>&1 646 | make install >> ${PLOGS}/psmisc_make.1 2>&1 647 | mv /usr/bin/fuser /bin 648 | mv /usr/bin/killall /bin 649 | coresrc_clean psmisc 650 | 651 | 652 | # Procps-NG 653 | coresrc_prep procps-ng 654 | echo "[ProcPS-NG] Configuring..." 655 | ./configure --prefix=/usr \ 656 | --exec-prefix= \ 657 | --libdir=/usr/lib \ 658 | --docdir=/usr/share/doc/procps-ng \ 659 | --disable-static \ 660 | --disable-kill > ${PLOGS}/procps-ng_configuring.1 2>&1 661 | 662 | echo "[ProcPS-NG] Building..." 663 | make > ${PLOGS}/procps-ng_make.1 2>&1 664 | sed -i -r 's|(pmap_initname)\\\$|\1|' testsuite/pmap.test/pmap.exp 665 | #make check > ${PLOGS}/procps-ng_check.1 2>&1 666 | make install >> ${PLOGS}/procps-ng_make.1 2>&1 667 | mv /usr/lib/libprocps.so.* /lib 668 | ln -sf /lib/$(readlink /usr/lib/libprocps.so) /usr/lib/libprocps.so 669 | coresrc_clean procps-ng 670 | 671 | 672 | # e2fsprogs 673 | coresrc_prep2 e2fsprogs 674 | echo "[E2fsprogs] Configuring..." 675 | LIBS=-L${PTLS}/lib \ 676 | CFLAGS=-I${PTLS}/include \ 677 | PKG_CONFIG_PATH=${PTLS}/lib/pkgconfig \ 678 | ../configure --prefix=/usr \ 679 | --bindir=/bin \ 680 | --with-root-prefix="" \ 681 | --enable-elf-shlibs \ 682 | --disable-libblkid \ 683 | --disable-libuuid \ 684 | --disable-uuidd \ 685 | --disable-fsck > ${PLOGS}/e2fsprogs_configure.1 2>&1 686 | 687 | echo "[E2fsprogs] Building..." 688 | make > ${PLOGS}/e2fsprogs_make.1 2>&1 689 | ln -sf ${PTLS}/lib/lib{blk,uu}id.so.1 lib 690 | #make LD_LIBRARY_PATH=${PTLS}/lib check > ${PLOGS}/e2fsprogs_check.1 2>&1 691 | make install >> ${PLOGS}/e2fsprogs_make.1 2>&1 692 | make install-libs >> ${PLOGS}/e2fsprogs_make.1 2>&1 693 | chmod u+w /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a 694 | gunzip /usr/share/info/libext2fs.info.gz 695 | install-info --dir-file=/usr/share/info/dir /usr/share/info/libext2fs.info 696 | makeinfo -o doc/com_err.info ../lib/et/com_err.texinfo 697 | install -m644 doc/com_err.info /usr/share/info 698 | install-info --dir-file=/usr/share/info/dir /usr/share/info/com_err.info 699 | coresrc_clean e2fsprogs 700 | 701 | 702 | # IANA-etc 703 | coresrc_prep iana-etc 704 | echo "[IANA-Etc] Building..." 705 | make > ${PLOGS}/iana-etc_make.1 2>&1 706 | make install >> ${PLOGS}/iana-etc_make.1 2>&1 707 | coresrc_clean iana-etc 708 | 709 | 710 | # M4 711 | coresrc_prep m4 712 | echo "[M4] Configuring..." 713 | ./configure --prefix=/usr > ${PLOGS}/m4_configure.1 2>&1 714 | 715 | echo "[M4] Building..." 716 | make > ${PLOGS}/m4_make.1 2>&1 717 | # might unnecessarily fail on the "test-update-copyright.sh" test 718 | set +e 719 | #make check > ${PLOGS}/m4_check.1 2>&1 720 | set -e 721 | make install >> ${PLOGS}/m4_make.1 2>&1 722 | coresrc_clean m4 723 | 724 | 725 | # Bison 726 | coresrc_prep bison 727 | echo "[Bison] Configuring..." 728 | ./configure --prefix=/usr --docdir=/usr/share/doc/bison > ${PLOGS}/bison_configure.1 2>&1 729 | 730 | echo "[Bison] Building..." 731 | make > ${PLOGS}/bison_make.1 2>&1 732 | make install >> ${PLOGS}/bison_make.1 2>&1 733 | coresrc_clean bison 734 | 735 | 736 | # Flex 737 | coresrc_prep flex 738 | echo "[Flex] Configuring..." 739 | ./configure --prefix=/usr --docdir=/usr/share/doc/flex > ${PLOGS}/flex_configuring.1 2>&1 740 | 741 | echo "[Flex] Building..." 742 | make > ${PLOGS}/flex_make.1 2>&1 743 | #make check > ${PLOGS}/flex_check.1 2>&1 744 | make install >> ${PLOGS}/flex_make.1 2>&1 745 | ln -s /usr/bin/flex /usr/bin/lex 746 | coresrc_clean flex 747 | 748 | 749 | # Grep 750 | coresrc_prep grep 751 | echo "[Grep] Configuring..." 752 | ./configure --prefix=/usr --bindir=/bin > ${PLOGS}/grep_configure.1 2>&1 753 | 754 | echo "[Grep] Building..." 755 | make > ${PLOGS}/grep_make.1 2>&1 756 | #make check > ${PLOGS}/grep_check.1 2>&1 757 | make install >> ${PLOGS}/grep_make.1 2>&1 758 | coresrc_clean grep 759 | 760 | 761 | # Readline 762 | coresrc_prep readline 763 | echo "[Readline] Configuring..." 764 | sed -i -e '/MV.*old/d' Makefile.in 765 | sed -i -e '/{OLDSUFF}/c:' support/shlib-install 766 | ./configure --prefix=/usr \ 767 | --disable-static \ 768 | --docdir=/usr/share/doc/readline > ${PLOGS}/readline_configure.1 2>&1 769 | 770 | echo "[Readline] Building..." 771 | make SHLIB_LIBS=-lncurses install > ${PLOGS}/readline_make.1 2>&1 772 | mv /usr/lib/lib{readline,history}.so.* /lib 773 | ln -sf /lib/$(readlink /usr/lib/libreadline.so) /usr/lib/libreadline.so 774 | ln -sf /lib/$(readlink /usr/lib/libhistory.so ) /usr/lib/libhistory.so 775 | install -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline 776 | coresrc_clean readline 777 | 778 | 779 | # Bash 780 | coresrc_prep bash 781 | echo "[Bash] Configuring..." 782 | ./configure --prefix=/usr \ 783 | --docdir=/usr/share/doc/ \ 784 | --without-bash-malloc \ 785 | --with-installed-readline > ${PLOGS}/bash_configure.1 2>&1 786 | 787 | echo "[Bash] Building..." 788 | make > ${PLOGS}/bash_make.1 2>&1 789 | chown -R nobody . 790 | su nobody -s /bin/bash -c "PATH=${PATH} make tests" > ${PLOGS}/bash_check.1 2>&1 791 | make install >> ${PLOGS}/bash_make.1 2>&1 792 | mv -f /usr/bin/bash /bin 793 | # the following will spawn an interactive shell. 794 | # Do we need to create a second script and bash -c that with the new bash, 795 | # or can we continue using this bash? 796 | #exec /bin/bash --login +h 797 | coresrc_clean bash 798 | 799 | 800 | # Bc 801 | coresrc_prep bc 802 | echo "[BC] Configuring..." 803 | ./configure --prefix=/usr \ 804 | --with-readline \ 805 | --mandir=/usr/share/man \ 806 | --infodir=/usr/share/info > ${PLOGS}/bc_configure.1 2>&1 807 | 808 | echo "[BC] Building..." 809 | make > ${PLOGS}/bc_make.1 2>&1 810 | #echo "quit" | ./bc/bc -l Test/checklib.b > ${PLOGS}/bc_check.1 2>&1 811 | make install >> ${PLOGS}/bc_make.1 2>&1 812 | coresrc_clean bc 813 | 814 | 815 | # Libtool 816 | coresrc_prep libtool 817 | echo "[Libtool] Configuring..." 818 | ./configure --prefix=/usr > ${PLOGS}/libtool_configure.1 2>&1 819 | 820 | echo "[Libtool] Building..." 821 | make > ${PLOGS}/libtool_make.1 2>&1 822 | #make check > ${PLOGS}/libtool_check.1 2>&1 823 | make install >> ${PLOGS}/libtool_make.1 2>&1 824 | coresrc_clean libtool 825 | 826 | 827 | # GDBM 828 | coresrc_prep gdbm 829 | echo "[GDBM] Configuring..." 830 | ./configure --prefix=/usr \ 831 | --disable-static \ 832 | --enable-libgdbm-compat > ${PLOGS}/gdbm_configure.1 2>&1 833 | 834 | make > ${PLOGS}/gdbm_make.1 2>&1 835 | #make check > ${PLOGS}/gdbm_check.1 2>&1 836 | make install >> ${PLOGS}/gdbm_make.1 2>&1 837 | coresrc_clean gdbm 838 | 839 | 840 | # Expat 841 | coresrc_prep expat 842 | echo "[Expat] Configuring..." 843 | ./configure --prefix=/usr --disable-static > ${PLOGS}/expat_configure.1 2>&1 844 | echo "[Expat] Building..." 845 | make > ${PLOGS}/expat_make.1 2>&1 846 | #make check > ${PLOGS}/expat_check.1 2>&1 847 | make install >> ${PLOGS}/expat_make.1 2>&1 848 | install -dm755 /usr/share/doc/expat 849 | install -m644 doc/*.{html,png,css} /usr/share/doc/expat 850 | coresrc_clean expat 851 | 852 | 853 | # INetUtils 854 | coresrc_prep inetutils 855 | echo "[InetUtils] Configuring..." 856 | ./configure --prefix=/usr \ 857 | --localstatedir=/var \ 858 | --disable-logger \ 859 | --disable-whois \ 860 | --disable-rcp \ 861 | --disable-rexec \ 862 | --disable-rlogin \ 863 | --disable-rsh \ 864 | --disable-servers > ${PLOGS}/inetutils_configure.1 2>&1 865 | 866 | echo "[InetUtils] Building..." 867 | make > ${PLOGS}/inetutils_make.1 2>&1 868 | #make check > ${PLOGS}/inetutils_check.1 2>&1 869 | make install >> ${PLOGS}/inetutils_make.1 2>&1 870 | mv /usr/bin/{hostname,ping,ping6,traceroute} /bin 871 | mv /usr/bin/ifconfig /sbin 872 | coresrc_clean inetutils 873 | 874 | 875 | # Perl 876 | coresrc_prep perl 877 | echo "127.0.0.1 localhost localhost.localdomain" > /etc/hosts 878 | export BUILD_ZLIB=False 879 | export BUILD_BZIP2=0 880 | echo "[Perl] Configuring..." 881 | sh Configure -des -Dprefix=/usr \ 882 | -Dvendorprefix=/usr \ 883 | -Dman1dir=/usr/share/man/man1 \ 884 | -Dman3dir=/usr/share/man/man3 \ 885 | -Dpager="/usr/bin/less -isR" \ 886 | -Duseshrplib > ${PLOGS}/perl_configure.1 2>&1 887 | 888 | echo "[Perl] Building..." 889 | make > ${PLOGS}/perl_make.1 2>&1 890 | #make -k test > ${PLOGS}/perl_check.1 2>&1 891 | make install > ${PLOGS}/perl_make.1 2>&1 892 | unset BUILD_ZLIB BUILD_BZIP2 893 | coresrc_clean perl 894 | 895 | 896 | # XML::Parser 897 | coresrc_prep XML-Parser 898 | echo "[PERL: XML::Parser] Configuring..." 899 | perl Makefile.PL > ${PLOGS}/xml-parser_configure.1 2>&1 900 | 901 | echo "[PERL: XML::Parser] Building..." 902 | make > ${PLOGS}/xml-parser_make.1 2>&1 903 | #make test > ${PLOGS}/xml-parser_check.1 2>&1 904 | make install >> ${PLOGS}/xml-parser_make.1 2>&1 905 | coresrc_clean XML-Parser 906 | 907 | 908 | # Autoconf 909 | coresrc_prep autoconf 910 | echo "[Autoconf] Configuring..." 911 | ./configure --prefix=/usr > ${PLOGS}/autoconf_configure.1 2>&1 912 | 913 | echo "[Autoconf] Building..." 914 | make > ${PLOGS}/autoconf_make.1 2>&1 915 | #make check > ${PLOGS}/autoconf_check.1 2>&1 916 | make install >> ${PLOGS}/autoconf_make.1 2>&1 917 | coresrc_clean autoconf 918 | 919 | 920 | # Automake 921 | coresrc_prep automake 922 | echo "[Automake] Configuring..." 923 | sed -i 's:/\\\${:/\\\$\\{:' bin/automake.in 924 | ./configure --prefix=/usr --docdir=/usr/share/doc/automake > ${PLOGS}/automake_configure.1 2>&1 925 | 926 | echo "[Automake] Building..." 927 | make > ${PLOGS}/automake_make.1 2>&1 928 | sed -i "s:./configure:LEXLIB=/usr/lib/libfl.a &:" t/lex-{clean,depend}-cxx.sh 929 | #make -j4 check > ${PLOGS}/automake_check.1 2>&1 930 | make install >> ${PLOGS}/automake_make.1 2>&1 931 | coresrc_clean automake 932 | 933 | 934 | # Coreutils 935 | coresrc_prep coreutils 936 | echo "[Coreutils] Configuring..." 937 | FORCE_UNSAFE_CONFIGURE=1 ./configure \ 938 | --prefix=/usr \ 939 | --enable-no-install-program=kill,uptime > ${PLOGS}/coreutils_configure.1 2>&1 940 | 941 | echo "[Coreutils] Building..." 942 | FORCE_UNSAFE_CONFIGURE=1 make > ${PLOGS}/coreutils_make.1 2>&1 # FUCK THA PO-LICE 943 | make install >> ${PLOGS}/coreutils_make.1 2>&1 944 | mv /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin 945 | mv /usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} /bin 946 | mv /usr/bin/{rmdir,stty,sync,true,uname} /bin 947 | mv /usr/bin/chroot /usr/sbin 948 | mv /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8 949 | sed -i -e 's/\"1\"/\"8\"/1' /usr/share/man/man8/chroot.8 950 | mv /usr/bin/{head,sleep,nice,test,\[} /bin 951 | coresrc_clean coreutils 952 | 953 | 954 | # Diffutils 955 | coresrc_prep diffutils 956 | sed -i 's:= @mkdir_p@:= /bin/mkdir -p:' po/Makefile.in.in 957 | echo "[Diffutils] Configuring..." 958 | ./configure --prefix=/usr > ${PLOGS}/diffutils_configure.1 2>&1 959 | 960 | echo "[Diffutils] Building..." 961 | make > ${PLOGS}/diffutils_make.1 2>&1 962 | #make check > ${PLOGS}/diffutils_check.1 2>&1 963 | make install >> ${PLOGS}/diffutils_make.1 2>&1 964 | coresrc_clean diffutils 965 | 966 | 967 | # Gawk 968 | coresrc_prep gawk 969 | echo "[Gawk] Configuring..." 970 | ./configure --prefix=/usr > ${PLOGS}/gawk_configure.1 2>&1 971 | 972 | echo "[Gawk] BUilding..." 973 | make > ${PLOGS}/gawk_make.1 2>&1 974 | #make check > ${PLOGS}/gawk_check.1 2>&1 975 | make install >> ${PLOGS}/gawk_make.1 2>&1 976 | mkdir /usr/share/doc/gawk 977 | cp doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk 978 | coresrc_clean gawk 979 | 980 | 981 | # Findutils 982 | coresrc_prep findutils 983 | echo "[Findutils] Configuring..." 984 | ./configure --prefix=/usr --localstatedir=/var/lib/locate > ${PLOGS}/findutils_configure.1 2>&1 985 | 986 | echo "[Findutils] Building..." 987 | make > ${PLOGS}/findutils_make.1 2>&1 988 | #make check > ${PLOGS}/findutils_check.1 2>&1 989 | make install >> ${PLOGS}/findutils_make.1 2>&1 990 | mv /usr/bin/find /bin 991 | sed -i 's|find:=${BINDIR}|find:=/bin|' /usr/bin/updatedb 992 | coresrc_clean findutils 993 | 994 | 995 | # Gettext 996 | coresrc_prep gettext 997 | echo "[Gettext] Configuring..." 998 | ./configure --prefix=/usr \ 999 | --disable-static \ 1000 | --docdir=/usr/share/doc/gettext > ${PLOGS}/gettext_configure.1 2>&1 1001 | 1002 | echo "[Gettext] Building..." 1003 | make > ${PLOGS}/gettext_make.1 2>&1 1004 | #make check > ${PLOGS}/gettext_check.1 2>&1 1005 | make install >> ${PLOGS}/gettext_make.1 2>&1 1006 | chmod 0755 /usr/lib/preloadable_libintl.so 1007 | coresrc_clean gettext 1008 | 1009 | 1010 | # Intltool 1011 | coresrc_prep intltool 1012 | echo "[Intltool] Configuring..." 1013 | sed -i 's:\\\${:\\\$\\{:' intltool-update.in 1014 | ./configure --prefix=/usr > ${PLOGS}/intltool_configure.1 2>&1 1015 | 1016 | echo "[Intltool] Building..." 1017 | make > ${PLOGS}/intltool_make.1 2>&1 1018 | #make check > ${PLOGS}/intltool_check.1 2>&1 1019 | make install >> ${PLOGS}/intltool_make.1 2>&1 1020 | install -Dm644 doc/I18N-HOWTO /usr/share/doc/intltool/I18N-HOWTO 1021 | coresrc_clean intltool 1022 | 1023 | 1024 | # Gperf 1025 | coresrc_prep gperf 1026 | echo "[Gperf] Configuring..." 1027 | ./configure --prefix=/usr --docdir=/usr/share/doc/gperf > ${PLOGS}/gperf_configure.1 2>&1 1028 | 1029 | echo "[Gperf] Building..." 1030 | make > ${PLOGS}/gperf_make.1 2>&1 1031 | #make -j1 check > ${PLOGS}/gperf_check.1 2>&1 1032 | make install >> ${PLOGS}/gperf_make.1 2>&1 1033 | coresrc_clean gperf 1034 | 1035 | 1036 | # Groff 1037 | coresrc_prep groff 1038 | echo "[Groff] Configuring..." 1039 | PAGE=letter ./configure --prefix=/usr > ${PLOGS}/groff_configure.1 2>&1 1040 | 1041 | echo "[Groff] Building..." 1042 | # keeps failing.. 1043 | MAKEFLAGS='' 1044 | make -j 1 > ${PLOGS}/groff_make.1 2>&1 1045 | make install >> ${PLOGS}/groff_make.1 2>&1 1046 | MAKEFLAGS=${MAKEFLAGS_LOC} 1047 | coresrc_clean groff 1048 | 1049 | 1050 | # Xz 1051 | coresrc_prep xz 1052 | echo "[Xz] Configuring..." 1053 | sed -i -e '/mf\.buffer = NULL/a next->coder->mf.size = 0;' src/liblzma/lz/lz_encoder.c 1054 | ./configure --prefix=/usr \ 1055 | --disable-static \ 1056 | --docdir=/usr/share/doc/xz > ${PLOGS}/xz_configure.1 2>&1 1057 | 1058 | echo "[Xz] Building..." 1059 | make > ${PLOGS}/xz_make.1 2>&1 1060 | #make check > ${PLOGS}/xz_check.1 2>&1 1061 | make install >> ${PLOGS}/xz_make.1 2>&1 1062 | mv /usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} /bin 1063 | mv /usr/lib/liblzma.so.* /lib 1064 | ln -sf /lib/$(readlink /usr/lib/liblzma.so) /usr/lib/liblzma.so 1065 | coresrc_clean xz 1066 | 1067 | 1068 | # Grub 1069 | coresrc_prep grub 1070 | echo "[Grub] Configuring..." 1071 | ./configure --prefix=/usr \ 1072 | --sbindir=/sbin \ 1073 | --sysconfdir=/etc \ 1074 | --disable-grub-emu-usb \ 1075 | --disable-efiemu \ 1076 | --disable-werror > ${PLOGS}/grub_configure.1 2>&1 1077 | 1078 | echo "[Grub] Building..." 1079 | make > ${PLOGS}/grub_make.1 2>&1 1080 | make install >> ${PLOGS}/grub_make.1 2>&1 1081 | coresrc_clean grub 1082 | 1083 | 1084 | # Less 1085 | coresrc_prep less 1086 | echo "[Less] Configuring..." 1087 | ./configure --prefix=/usr --sysconfdir=/etc > ${PLOGS}/less_configure.1 2>&1 1088 | 1089 | echo "[Less] Building..." 1090 | make > ${PLOGS}/less_make.1 2>&1 1091 | make install >> ${PLOGS}/less_make.1 2>&1 1092 | coresrc_clean less 1093 | 1094 | 1095 | # Gzip 1096 | coresrc_prep gzip 1097 | echo "[Gzip] Configuring..." 1098 | ./configure --prefix=/usr --bindir=/bin > ${PLOGS}/gzip_configure.1 2>&1 1099 | 1100 | echo "[Gzip] Building..." 1101 | make > ${PLOGS}/gzip_make.1 2>&1 1102 | #make check > ${PLOGS}/gzip_check.1 2>&1 1103 | make install >> ${PLOGS}/gzip_make.1 2>&1 1104 | mv /bin/{gzexe,uncompress,zcmp,zdiff,zegrep} /usr/bin 1105 | mv /bin/{zfgrep,zforce,zgrep,zless,zmore,znew} /usr/bin 1106 | coresrc_clean gzip 1107 | 1108 | 1109 | # IPRoute2 1110 | coresrc_prep iproute2 1111 | echo "[IPRoute2] Building..." 1112 | sed -i -e '/ARPD/d' Makefile 1113 | sed -i -e 's/arpd.8//' man/man8/Makefile 1114 | rm doc/arpd.sgml 1115 | make > ${PLOGS}/iproute2_make.1 2>&1 1116 | make DOCDIR=/usr/share/doc/iproute2 install >> ${PLOGS}/iproute2_make.1 2>&1 1117 | coresrc_clean iproute2 1118 | 1119 | 1120 | # Kbd 1121 | coresrc_prep kbd 1122 | echo "[Kbd] Configuring..." 1123 | sed -i -e 's/\(RESIZECONS_PROGS=\)yes/\1no/g' configure 1124 | sed -i -e 's/resizecons.8 //' docs/man/man8/Makefile.in 1125 | PKG_CONFIG_PATH=${PTLS}/lib/pkgconfig ./configure --prefix=/usr --disable-vlock > ${PLOGS}/kbd_configure.1 2>&1 1126 | 1127 | echo "[Kbd] Building..." 1128 | make > ${PLOGS}/kbd_make.1 2>&1 1129 | #make check > ${PLOGS}/kbd_check.1 2>&1 1130 | make install >> ${PLOGS}/kbd_make.1 2>&1 1131 | mkdir /usr/share/doc/kbd 1132 | cp -R docs/doc/* /usr/share/doc/kbd 1133 | coresrc_clean kbd 1134 | 1135 | 1136 | # Kmod 1137 | coresrc_prep kmod 1138 | echo "[Kmod] Configuring..." 1139 | ./configure --prefix=/usr \ 1140 | --bindir=/bin \ 1141 | --sysconfdir=/etc \ 1142 | --with-rootlibdir=/lib \ 1143 | --with-xz \ 1144 | --with-zlib > ${PLOGS}/kmod_configure.1 2>&1 1145 | 1146 | echo "[Kmod] Building..." 1147 | make > ${PLOGS}/kmod_make.1 2>&1 1148 | make install >> ${PLOGS}/kmod_make.1 2>&1 1149 | for target in depmod insmod lsmod modinfo modprobe rmmod; 1150 | do 1151 | ln -s /bin/kmod /sbin/${target} 1152 | done 1153 | ln -s kmod /bin/lsmod 1154 | coresrc_clean kmod 1155 | 1156 | 1157 | # Libpipeline 1158 | coresrc_prep libpipeline 1159 | echo "[LibPipeline] Configuring..." 1160 | PKG_CONFIG_PATH=${PTLS}/lib/pkgconfig ./configure --prefix=/usr > ${PLOGS}/libpipeline_configure.1 2>&1 1161 | 1162 | echo "[LibPipeline] Building..." 1163 | make > ${PLOGS}/libpipeline_make.1 2>&1 1164 | #make check > ${PLOGS}/libpipeline_check.1 2>&1 1165 | make install >> ${PLOGS}/libpipeline_make.1 2>&1 1166 | coresrc_clean libpipeline 1167 | 1168 | 1169 | # Make 1170 | coresrc_prep make 1171 | echo "[Make] Configuring..." 1172 | ./configure --prefix=/usr > ${PLOGS}/make_configure.1 2>&1 1173 | 1174 | echo "[Make] Building..." 1175 | make > ${PLOGS}/make_make.1 2>&1 1176 | #make check > ${PLOGS}/make_check.1 2>&1 1177 | make install >> ${PLOGS}/make_make.1 2>&1 1178 | coresrc_clean make 1179 | 1180 | 1181 | # Patch 1182 | coresrc_prep patch 1183 | echo "[Patch] Configuring..." 1184 | ./configure --prefix=/usr > ${PLOGS}/patch_configure.1 2>&1 1185 | 1186 | echo "[Patch] Building..." 1187 | make > ${PLOGS}/patch_make.1 2>&1 1188 | #make check > ${PLOGS}/patch_check.1 2>&1 1189 | make install >> ${PLOGS}/patch_make.1 2>&1 1190 | coresrc_clean patch 1191 | 1192 | 1193 | # Sysklogd 1194 | coresrc_prep sysklogd 1195 | echo "[Sysklogd] Building..." 1196 | sed -i -e '/Error loading kernel symbols/{n;n;d}' ksym_mod.c 1197 | make > ${PLOGS}/sysklogd_make.1 2>&1 1198 | make BINDIR=/sbin install >> ${PLOGS}/sysklogd_make.1 2>&1 1199 | cat > /etc/syslog.conf << "EOF" 1200 | # Begin /etc/syslog.conf 1201 | 1202 | auth,authpriv.* -/var/log/auth.log 1203 | *.*;auth,authpriv.none -/var/log/sys.log 1204 | daemon.* -/var/log/daemon.log 1205 | kern.* -/var/log/kern.log 1206 | mail.* -/var/log/mail.log 1207 | user.* -/var/log/user.log 1208 | *.emerg * 1209 | 1210 | # End /etc/syslog.conf 1211 | EOF 1212 | coresrc_clean sysklogd 1213 | 1214 | 1215 | # SysVInit skipped because using RC...? 1216 | 1217 | 1218 | # Tar 1219 | coresrc_prep tar 1220 | echo "[Tar] Configuring..." 1221 | FORCE_UNSAFE_CONFIGURE=1 \ 1222 | ./configure --prefix=/usr \ 1223 | --bindir=/bin > ${PLOGS}/tar_configure.1 2>&1 1224 | 1225 | echo "[Tar] Building..." 1226 | make > ${PLOGS}/tar_make.1 2>&1 1227 | #make check > ${PLOGS}/tar_check.1 2>&1 1228 | make install >> ${PLOGS}/tar_make.1 2>&1 1229 | set +e 1230 | make -C doc install-html docdir=/usr/share/doc/tar >> ${PLOGS}/tar_make.1 2>&1 1231 | set -e 1232 | coresrc_clean tar 1233 | 1234 | 1235 | # Texinfo 1236 | coresrc_prep texinfo 1237 | echo "[Texinfo] Configuring..." 1238 | ./configure --prefix=/usr --disable-static > ${PLOGS}/texinfo_configure.1 2>&1 1239 | 1240 | echo "[Texinfo] Building..." 1241 | make > ${PLOGS}/texinfo_make.1 2>&1 1242 | #make check > ${PLOGS}/texinfo_check.1 2>&1 1243 | make install >> ${PLOGS}/texinfo_make.1 2>&1 1244 | make TEXMF=/usr/share/texmf install-tex >> ${PLOGS}/texinfo_make.1 2>&1 1245 | coresrc_clean texinfo 1246 | 1247 | 1248 | # Eudev 1249 | coresrc_prep eudev 1250 | echo "[Eudev] Configuring..." 1251 | sed -i -re 's|/usr(/bin/test)|\1|' test/udev-test.pl 1252 | cat > config.cache << "EOF" 1253 | HAVE_BLKID=1 1254 | BLKID_LIBS="-lblkid" 1255 | BLKID_CFLAGS="-I${PTLS}/include" 1256 | EOF 1257 | # needed if building from git release tarball, but fails because xsltproc 1258 | #./autogen.sh > ${PLOGS}/eudev_configure.1 2>&1 1259 | ./configure --prefix=/usr \ 1260 | --bindir=/sbin \ 1261 | --sbindir=/sbin \ 1262 | --libdir=/usr/lib \ 1263 | --sysconfdir=/etc \ 1264 | --libexecdir=/lib \ 1265 | --with-rootprefix= \ 1266 | --with-rootlibdir=/lib \ 1267 | --enable-manpages \ 1268 | --disable-static \ 1269 | --config-cache > ${PLOGS}/eudev_configure.1 2>&1 1270 | 1271 | echo "[Eudev] Building..." 1272 | LIBRARY_PATH=${PTLS}/lib make > ${PLOGS}/eudev_make.1 2>&1 1273 | mkdir -p /lib/udev/rules.d 1274 | mkdir -p /etc/udev/rules.d 1275 | # these tests.. may fail, since we're in a chroot. 1276 | set +e 1277 | make LD_LIBRARY_PATH=${PTLS}/lib check > ${PLOGS}/eudev_check.1 2>&1 1278 | set -e 1279 | make LD_LIBRARY_PATH=${PTLS}/lib install >> ${PLOGS}/eudev_make.1 2>&1 1280 | cp -a ${PSRC}/pur_src/core/udev-lfs . 1281 | # ugh. ugly. tsk, tsk! 1282 | find udev-lfs/ -type f -exec sed -i -e 's/-$(VERSION)//g' '{}' \; 1283 | make -f udev-lfs/Makefile.lfs install >> ${PLOGS}/eudev_make.1 2>&1 1284 | LD_LIBRARY_PATH=${PTLS}/lib udevadm hwdb --update >> ${PLOGS}/eudev_configure.1 2>&1 1285 | coresrc_clean eudev 1286 | 1287 | 1288 | # Util-Linux 1289 | coresrc_prep util-linux 1290 | echo "[Util-Linux] Configuring..." 1291 | mkdir -p /var/lib/hwclock 1292 | ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ 1293 | --docdir=/usr/share/doc/util-linux \ 1294 | --disable-chfn-chsh \ 1295 | --disable-login \ 1296 | --disable-nologin \ 1297 | --disable-su \ 1298 | --disable-setpriv \ 1299 | --disable-runuser \ 1300 | --disable-pylibmount \ 1301 | --disable-static \ 1302 | --without-python \ 1303 | --without-systemd \ 1304 | --without-systemdsystemunitdir > ${PLOGS}/util-linux_configure.1 2>&1 1305 | 1306 | echo "[Util-Linux] Building..." 1307 | make > ${PLOGS}/util-linux_make.1 2>&1 1308 | make install >> ${PLOGS}/util-linux_make.1 2>&1 1309 | coresrc_clean util-linux 1310 | 1311 | 1312 | # Man-DB 1313 | coresrc_prep man-db 1314 | echo "[Man-DB] Configuring..." 1315 | ./configure --prefix=/usr \ 1316 | --docdir=/usr/share/doc/man-db \ 1317 | --sysconfdir=/etc \ 1318 | --disable-setuid \ 1319 | --with-browser=/usr/bin/lynx \ 1320 | --with-vgrind=/usr/bin/vgrind \ 1321 | --with-grap=/usr/bin/grap > ${PLOGS}/man-db_configure.1 2>&1 1322 | 1323 | echo "[Man-DB] Building..." 1324 | make > ${PLOGS}/man-db_make.1 2>&1 1325 | #make check > ${PLOGS}/man-db_check.1 2>&1 1326 | make install >> ${PLOGS}/man-db_make.1 2>&1 1327 | coresrc_clean man-db 1328 | 1329 | 1330 | # Vim 1331 | coresrc_prep vim 1332 | echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h 1333 | echo "[Vim] Configuring..." 1334 | ./configure --prefix=/usr > ${PLOGS}/vim_configure.1 2>&1 1335 | 1336 | echo "[Vim] Building..." 1337 | make > ${PLOGS}/vim_make.1 2>&1 1338 | #make -j1 test > ${PLOGS}/vim_check.1 2>&1 1339 | make install >> ${PLOGS}/vim_make.1 2>&1 1340 | ln -s vim /usr/bin/vi 1341 | for L in /usr/share/man/{,*/}man1/vim.1; 1342 | do 1343 | ln -s vim.1 $(dirname $L)/vi.1 1344 | done 1345 | mv /usr/share/vim/vim${VIMVER}/doc /usr/share/doc/vim 1346 | cat > /etc/vimrc << "EOF" 1347 | " Begin /etc/vimrc 1348 | 1349 | set nocompatible 1350 | set backspace=2 1351 | syntax on 1352 | if (&term == "iterm") || (&term == "putty") 1353 | set background=dark 1354 | endif 1355 | 1356 | " End /etc/vimrc 1357 | EOF 1358 | coresrc_clean vim 1359 | -------------------------------------------------------------------------------- /chroottest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | PUR=${HOME}/purroot 6 | PTLS='/tools' 7 | set +e 8 | sudo umount -l ${PUR}/{run,sys,proc,dev} > /dev/null 2>&1 9 | set -e 10 | sudo mount --bind /dev ${PUR}/dev 11 | sudo mount -t devpts devpts ${PUR}/dev/pts -o gid=5,mode=620 12 | sudo mount -t proc proc ${PUR}/proc 13 | sudo mount -t sysfs sysfs ${PUR}/sys 14 | sudo mount -t tmpfs tmpfs ${PUR}/run 15 | 16 | sudo chroot ${PUR} /usr/bin/env -i \ 17 | HOME=/root \ 18 | TERM="$TERM" \ 19 | PS1='\u:\w\$ ' \ 20 | PATH=/bin:/usr/bin:/sbin:/usr/sbin \ 21 | PUR="/" \ 22 | PSRC="/sources" \ 23 | PTLS="/tools" \ 24 | PCNTRB="/contrib" \ 25 | MAKEFLAGS="${MAKEFLAGS}" \ 26 | /bin/bash --login 27 | 28 | sudo umount -l ${PUR}/{run,sys,proc,dev} > /dev/null 2>&1 29 | -------------------------------------------------------------------------------- /extnltools/releasechk/config.ini: -------------------------------------------------------------------------------- 1 | ############ 2 | # SETTINGS # 3 | ############ 4 | 5 | 6 | [RELEASE] 7 | # What version of release is this for? 8 | # If blank, assume we're testing. TEST will be used instead. 9 | pur_release = 2016.04-RELEASE 10 | 11 | 12 | [FILES] 13 | # Where should the sources be downloaded to? *THIS MUST BE SET.* 14 | #dir = /usr/local/www/nginx/pkgs/ 15 | dir = /tmp/releasechktest 16 | 17 | # Where can we store some temporary files while we prep them for 18 | # release? 19 | # Note that it may get quite sizeable, so if you use /tmp make sure 20 | # you have the ramfs/disk/etc. space for it. 21 | # *THIS MUST BE SET.* 22 | workdir = /tmp 23 | 24 | # What file should we reference for packages to check/download? 25 | # *THIS MUST BE SET.* 26 | # This should be a sqlite3 database with a table "sources". One 27 | # will be created from a default if none is provided. 28 | # See README.db for more info. 29 | #repolist = sources.db 30 | repolist = urls.txt 31 | 32 | # Where should errors when fetching/testing URLs be logged to? 33 | # If blank, no logging will be implemented. 34 | log = urls.error.log 35 | 36 | 37 | [RSYNC] 38 | # If this setting is empty, assume the webroot("dir" above) is on this host. 39 | # If populated, assume that tarball_dir is on the given host and 40 | # that host has rsync installed (and SSH PKI is properly set up 41 | # to allow for automated uploading). This lets you run the checker 42 | # on a remote box without installing python on the file host if desired. 43 | host = 44 | 45 | # What remote user, if "host" is set, should we use? 46 | # If left blank but "host" is populated, the default 47 | # is to use the current/running local user's username. 48 | # Remember, it is *highly* recommended to use SSH PKI. 49 | # See https://sysadministrivia.com/notes/HOWTO:SSH_Security 50 | # for help if desired. 51 | user = 52 | 53 | # What port should we use to connect to rsync, assuming 54 | # an rsync host is set? 55 | # If blank, use port 22. 56 | port = 57 | 58 | 59 | -------------------------------------------------------------------------------- /extnltools/releasechk/release.checker.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # needs python 3.x 3 | # inspired by https://github.com/anatol/pkgoutofdate but: 4 | # -portable so you can use it with... anything, not just Arch/pacman PKGBUILDS 5 | # -no Ruby. :)))))) 6 | # brent s. 7 | # originally for Pür Linux (https://github.com/RainbowHackerHorse/Pur-Linux). 8 | ## 9 | # requires a urls.txt file in the same directory listing sources in the following format: 10 | # nammeofsoftware@http://upstream.domain.com/path/to/current/release/filename-1.2.3.tar.gz # additional comment about this source URL (optional) 11 | # e.g. 12 | # linux@https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.4.tar.gz # the linux kernel 13 | # sed@ftp://ftp.gnu.org/gnu/sed/sed-4.2.2.tar.gz # GNU sed 14 | # (etc.) 15 | # NOTE: for sanity reasons, you'll want the LAST actual URL- the TRUE URL- not a redirect. 16 | # you can get this with curl -sIL , look for any "Location:" directives- those are redirects. 17 | 18 | import semantic_version 19 | import os 20 | import re 21 | import time 22 | import urllib.request 23 | import urllib.parse 24 | import urllib.request 25 | import configparser 26 | import ftplib 27 | 28 | # import main settings 29 | config = configparser.ConfigParser() 30 | config.read('config.ini') 31 | release_ver = config['RELEASE']['pur_release'] 32 | destdir = config['FILES']['dir'] 33 | workdir = config['FILES']['workdir'] 34 | repolist = config['FILES']['repolist'] 35 | rsync_host = config['RSYNC']['host'] 36 | rsync_user = config['RSYNC']['port'] 37 | destdir = re.sub('/?$','/',destdir) 38 | 39 | upstream = open(repolist,'r') 40 | 41 | def fetchFile(newurl,filename): 42 | failed = False 43 | # here's where we actually download files 44 | req = urllib.request.Request( 45 | newurl+filename, 46 | data=None, 47 | headers={ 48 | 'User-Agent': 'https://github.com/RainbowHackerHorse/Pur-Linux/blob/master/extnltools/release.checker.py' 49 | #'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)' 50 | }) 51 | try: 52 | source_web = urllib.request.urlopen(req) 53 | except urllib.error.URLError as e: 54 | if hasattr(e, 'reason'): 55 | #print(name + ' failed: ',str(e.reason)) 56 | if e.code: 57 | with open('urls.error.log','a') as errfile: errfile.write(('{0}: {1} {2} ({3})\n').format(str(int(time.time())),name,e.code,e.reason)) 58 | failed = True 59 | else: 60 | with open('urls.error.log','a') as errfile: errfile.write(('{0}: {1} {2})\n').format(str(int(time.time())),name,e.reason)) 61 | failed = True 62 | elif hasattr(e, 'code'): 63 | #print('{0} failed: ',str(e.code)) 64 | with open('urls.error.log',"a") as errfile: errfile.write(('{0}: {1} {2} (no reason given))\n').format(str(int(time.time())),name,str(e.code))) 65 | failed = True 66 | else: 67 | #print(('{0} failed: ',''.join(e)).format(name)) 68 | failed = True 69 | 70 | if failed: 71 | return(False) 72 | else: 73 | urllib.request.urlretrieve(newurl,destdir+filename) 74 | return(True) 75 | 76 | 77 | def checkFile(newurl): 78 | failed = False 79 | # disable logging, because there'll be a lot of 404's 80 | # check remote for newer version defined in getNewVer 81 | req = urllib.request.Request( 82 | newurl, 83 | data=None, 84 | headers={ 85 | 'User-Agent': 'https://github.com/RainbowHackerHorse/Pur-Linux/blob/master/extnltools/release.checker.py' 86 | #'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)' 87 | }) 88 | try: 89 | source_web = urllib.request.urlopen(req) 90 | except urllib.error.URLError as e: 91 | if hasattr(e, 'reason'): 92 | #print(name + ' failed: ',str(e.reason)) 93 | #if e.code: 94 | # with open('urls.error.log','a') as errfile: errfile.write(('{0}: {1} {2} ({3})\n').format(str(int(time.time())),name,e.code,e.reason)) 95 | #else: 96 | #with open('urls.error.log','a') as errfile: errfile.write(('{0}: {1} {2})\n').format(str(int(time.time())),name,e.reason)) 97 | failed = True 98 | elif hasattr(e, 'code'): 99 | #print('{0} failed: ',str(e.code)) 100 | #with open('urls.error.log',"a") as errfile: errfile.write(('{0}: {1} {2} (no reason given))\n').format(str(int(time.time())),name,str(e.code))) 101 | failed = True 102 | else: 103 | #print(('{0} failed: ',''.join(e)).format(name)) 104 | failed = True 105 | # ftplib.error_perm: 550 Failed to change directory 106 | except ftplib.all_errors as e: 107 | #print(e) 108 | #with open("urls.error.log","a") as errfile: errfile.write(('{0}: {1} {2} (no reason given))\n').format(str(int(time.time())),name,str(e))) 109 | failed = True 110 | else: 111 | failed = False 112 | 113 | if failed: 114 | return(False) 115 | else: 116 | return(True) 117 | 118 | def getNewVer(name,filename,urlbase,cur_ver): 119 | #try to loop for remote files until we find one that hits. this might need tweaking/delays if upstream has rate limiting. 120 | #also, what a mess. this'll be wayyyy easier in the newer implementation since it's all strings in the sqlite3 db 121 | _cur_ver = cur_ver.split('.') 122 | try: 123 | ver = semantic_version.Version(cur_ver,partial=True) 124 | except: 125 | pass # it's a malformed version- we can't support 4 or more version points. yet? 126 | 127 | if ver: 128 | rel_iter = 0 129 | #print(name) 130 | for release in _cur_ver: #iterate through the number of release points... 131 | if len(_cur_ver) > 2: 132 | if rel_iter == 0: 133 | #print('upgrading major') 134 | rel = ver.next_major() 135 | loop_iter = 2 136 | elif rel_iter == 1: 137 | #print('upgrading minor') 138 | rel = ver.next_minor() 139 | loop_iter = 3 140 | elif rel_iter == 2: 141 | #print('upgrading patch') 142 | rel = ver.next_patch() 143 | loop_iter = 5 144 | else: 145 | # something went haywire 146 | rel = cur_ver 147 | loop_iter = 0 148 | 149 | else: 150 | # "relaxed" semver most likely, i.e. "1.2" instead of "1.2.0" 151 | rel = re.sub('\.0$','',str(ver.next_minor())) 152 | loop_iter = 4 153 | relaxed = True 154 | 155 | while loop_iter > 0: 156 | if len(_cur_ver) == 3 and (_cur_ver[0] == _cur_ver[1] or _cur_ver[1] == _cur_ver[2] or _cur_ver[0] == _cur_ver[2]): 157 | if rel_iter == 0: 158 | # increment the first section 159 | loop_ver = re.sub('^'+str(_cur_ver[rel_iter])+'\.',str(int(_cur_ver[rel_iter]) + loop_iter)+'.',cur_ver) 160 | elif rel_iter == 1: 161 | # increment the second section 162 | loop_ver = re.sub('\.'+str(_cur_ver[rel_iter])+'\.','.'+str(int(_cur_ver[rel_iter]) + loop_iter)+'.',cur_ver) 163 | else: 164 | # increment the third section 165 | loop_ver = re.sub('\.'+str(_cur_ver[rel_iter])+'$','.'+str(int(_cur_ver[rel_iter]) + loop_iter),cur_ver) 166 | elif len(_cur_ver) == 2 and _cur_ver[0] == _cur_ver[1]: 167 | #print('duplicate version detected') 168 | if rel_iter == 0: 169 | # increment the first section 170 | loop_ver = re.sub('^'+str(_cur_ver[rel_iter])+'\.',str(int(_cur_ver[rel_iter]) + loop_iter)+'.',cur_ver) 171 | elif rel_iter == 1: 172 | # increment the second section 173 | loop_ver = re.sub('\.'+str(_cur_ver[rel_iter])+'$','.'+str(int(_cur_ver[rel_iter]) + loop_iter),cur_ver) 174 | else: 175 | # this should literally never happen since this particular loop runs against relaxed versioning. 176 | pass 177 | else: 178 | loop_ver = re.sub(str(_cur_ver[rel_iter]),str(int(_cur_ver[rel_iter]) + loop_iter),cur_ver) 179 | #print(loop_ver) 180 | newfilename = re.sub(cur_ver,loop_ver,filename) 181 | newurlbase = re.sub(('/{0}/').format(cur_ver),('/{0}/').format(str(rel)),urlbase) 182 | findme = checkFile(newurlbase+newfilename) 183 | if findme: 184 | fetchFile(newurlbase,newfilename) 185 | filename = newfilename 186 | break 187 | else: 188 | #rel = rel.next(patch?min?maj?) 189 | filename = filename 190 | loop_iter -= 1 191 | #print(('{0} ==> {1}').format(filename,newfilename)) 192 | #print(('{0} ==> {1}').format(urlbase,newurlbase)) 193 | rel_iter += 1 194 | return(rel) 195 | 196 | 197 | 198 | for source in upstream: 199 | # parse the line, and skip empty lines/just comments 200 | if re.fullmatch('^\s*(#.*)?\s*$',source): 201 | continue 202 | line = source.split('@') 203 | name = line[0] 204 | url = re.sub('(\s*#.*$|\n)','',''.join(line[1])) 205 | if re.search('\s*#.*$\n?',source): 206 | #comment = '#' + '#'.join(source.split('#')[1:]) 207 | comment = '#' + "#".join(source.split('#')[1:]) 208 | comment = re.sub('\n','',comment) 209 | else: 210 | comment = '' 211 | urlbase = '/'.join(url.split('/')[:-1]) + '/' 212 | filename = ''.join(url.split('/')[-1]) 213 | # print(url) 214 | #print(('{0}: {1}').format(name,comment)) 215 | # stupid projects not keeping proper naming standards. 216 | # so we need to munge some filenames for getting the version number. 217 | if name == 'check': 218 | munged_fn = ('{0}-{1}').format(name,filename) 219 | elif name == 'expect': 220 | munged_fn = re.sub('^'+name,name+'-',filename).format(name) 221 | elif name == 'tcl': 222 | # didn't feel like making a dict, setting up a class/function, etc. 223 | # just to do this. so multiple iterations on the same string, because lazy. 224 | munged_fn = re.sub(name,name + '-',filename) 225 | munged_fn = re.sub('-src','',munged_fn) 226 | elif name == 'tzdata': 227 | # weird and totally incompatible numbering scheme... revisit this in the future maybe. 228 | with open(repolist+".new","a") as genfile: genfile.write(('{0}@{1}{2}{3}\n').format(name,urlbase,filename,comment)) 229 | continue 230 | print('this should never print') 231 | else: 232 | munged_fn = filename 233 | 234 | # now we get the current version number 235 | cur_ver = re.split('^' + name + '-',munged_fn) 236 | cur_ver = re.sub('(\.tgz|\.zip|\.tar(\..*)?)$','',cur_ver[1]) 237 | 238 | ver = getNewVer(name,filename,urlbase,cur_ver) 239 | print(filename) 240 | with open(repolist+".new","a") as genfile: genfile.write(('{0}@{1}{2}{3}\n').format(name,urlbase,filename,comment)) 241 | 242 | upstream.close() 243 | os.rename(repolist+'.new',repolist) 244 | -------------------------------------------------------------------------------- /extnltools/releasechk/urls.txt: -------------------------------------------------------------------------------- 1 | # core # 2 | http://download.savannah.gnu.org/releases/acl/acl-2.2.52.src.tar.gz 3 | http://download.savannah.gnu.org/releases/attr/attr-2.4.47.src.tar.gz 4 | http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz 5 | http://ftp.gnu.org/gnu/automake/automake-1.15.tar.xz 6 | http://alpha.gnu.org/gnu/bc/bc-1.06.95.tar.bz2 7 | http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.xz 8 | http://downloads.sourceforge.net/project/e2fsprogs/e2fsprogs/v1.42.13/e2fsprogs-1.42.13.tar.gz 9 | http://prdownloads.sourceforge.net/expat/expat-2.1.0.tar.gz 10 | http://prdownloads.sourceforge.net/flex/flex-2.6.0.tar.xz 11 | http://ftp.gnu.org/gnu/gdbm/gdbm-1.11.tar.gz 12 | http://ftp.gnu.org/gnu/gperf/gperf-3.0.4.tar.gz 13 | http://ftp.gnu.org/gnu/groff/groff-1.22.3.tar.gz 14 | http://alpha.gnu.org/gnu/grub/grub-2.02~beta3.tar.xz 15 | http://sethwklein.net/iana-etc-2.30.tar.bz2 16 | http://ftp.gnu.org/gnu/inetutils/inetutils-1.9.4.tar.xz 17 | http://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz 18 | https://www.kernel.org/pub/linux/utils/net/iproute2/iproute2-4.4.0.tar.xz 19 | https://www.kernel.org/pub/linux/utils/kbd/kbd-2.0.3.tar.xz 20 | https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-22.tar.xz 21 | http://www.greenwoodsoftware.com/less/less-481.tar.gz 22 | https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.25.tar.xz 23 | http://download.savannah.gnu.org/releases/libpipeline/libpipeline-1.4.1.tar.gz 24 | http://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.xz 25 | https://www.kernel.org/pub/linux/docs/man-pages/man-pages-4.04.tar.xz 26 | http://pkgconfig.freedesktop.org/releases/pkg-config-0.29.1.tar.gz 27 | http://sourceforge.net/projects/procps-ng/files/Production/procps-ng-3.3.11.tar.xz 28 | http://downloads.sourceforge.net/project/psmisc/psmisc/psmisc-22.21.tar.gz 29 | http://ftp.gnu.org/gnu/readline/readline-6.3.tar.gz 30 | http://pkg-shadow.alioth.debian.org/releases/shadow-4.2.1.tar.xz 31 | http://www.infodrom.org/projects/sysklogd/download/sysklogd-1.5.1.tar.gz 32 | http://anduin.linuxfromscratch.org/LFS/udev-lfs-20140408.tar.bz2 33 | ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2 34 | http://cpan.metacpan.org/authors/id/T/TO/TODDR/XML-Parser-2.44.tar.gz 35 | https://ftp.gnu.org/gnu/bash/bash-4.3.30.tar.gz 36 | https://ftp.gnu.org/gnu/binutils/binutils-2.26.tar.bz2 37 | http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz 38 | https://github.com/libcheck/check/archive/0.10.0.tar.gz 39 | https://ftp.gnu.org/gnu/coreutils/coreutils-8.25.tar.xz 40 | https://ftp.gnu.org/gnu/dejagnu/dejagnu-1.5.3.tar.gz 41 | https://ftp.gnu.org/gnu/diffutils/diffutils-3.3.tar.xz 42 | http://iweb.dl.sourceforge.net/project/expect/Expect/5.45/expect5.45.tar.gz 43 | http://lug.mtu.edu/gentoo/distfiles/file-5.25.tar.gz 44 | https://ftp.gnu.org/pub/gnu/findutils/findutils-4.6.0.tar.gz 45 | https://ftp.gnu.org/pub/gnu/gawk/gawk-4.1.3.tar.xz 46 | http://ftp.gnu.org/gnu/gcc/gcc-5.3.0/gcc-5.3.0.tar.gz 47 | http://ftp.gnu.org/gnu/gettext/gettext-0.19.7.tar.gz 48 | http://ftp.gnu.org/gnu/glibc/glibc-2.23.tar.xz 49 | http://ftp.gnu.org/gnu/gmp/gmp-6.1.0.tar.bz2 50 | http://ftp.gnu.org/gnu/grep/grep-2.23.tar.xz 51 | http://ftp.gnu.org/gnu/gzip/gzip-1.6.tar.xz 52 | https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.4.4.tar.gz 53 | http://ftp.gnu.org/gnu/m4/m4-1.4.17.tar.gz 54 | http://ftp.gnu.org/gnu/make/make-4.1.tar.gz 55 | http://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz 56 | http://www.mpfr.org/mpfr-current/mpfr-3.1.4.tar.xz 57 | http://ftp.gnu.org/gnu/ncurses/ncurses-6.0.tar.gz 58 | http://ftp.gnu.org/gnu/patch/patch-2.7.5.tar.gz 59 | http://www.cpan.org/src/5.0/perl-5.22.1.tar.gz 60 | http://ftp.gnu.org/gnu/sed/sed-4.2.2.tar.gz 61 | http://ftp.gnu.org/gnu/tar/tar-1.28.tar.xz 62 | http://iweb.dl.sourceforge.net/project/tcl/Tcl/8.6.5/tcl8.6.5-src.tar.gz 63 | http://ftp.gnu.org/gnu/texinfo/texinfo-6.1.tar.gz 64 | http://dev.gentoo.org/~blueness/eudev/eudev-3.1.5.tar.gz 65 | https://www.kernel.org/pub/linux/utils/util-linux/v2.27/util-linux-2.27.1.tar.gz 66 | http://tukaani.org/xz/xz-5.2.2.tar.gz 67 | http://download.savannah.gnu.org/releases/man-db/man-db-2.7.5.tar.xz 68 | http://www.iana.org/time-zones/repository/releases/tzdata2016a.tar.gz 69 | http://www.zlib.net/zlib-1.2.8.tar.xz 70 | # contrib # 71 | https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tar.xz 72 | https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz 73 | https://gitlab.com/NTPsec/ntpsec/repository/archive.tar.bz2?ref=master 74 | http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.3.2.tar.gz 75 | https://sourceforge.net/code-snapshots/git/n/ne/net-tools/code.git/net-tools-code-bd8bceaed2311651710331a7f8990c3e31be9840.zip 76 | http://archive.zfsonlinux.org/downloads/zfsonlinux/zfs/zfs-0.6.5.6.tar.gz 77 | http://archive.zfsonlinux.org/downloads/zfsonlinux/spl/spl-0.6.5.6.tar.gz 78 | -------------------------------------------------------------------------------- /kernel/patches/placeholder.txt: -------------------------------------------------------------------------------- 1 | foo 2 | -------------------------------------------------------------------------------- /kernel/version.txt: -------------------------------------------------------------------------------- 1 | Kernel 4.5 2 | -------------------------------------------------------------------------------- /purbuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | ## For moar debugging, before you run the script, run 4 | ## export PS4='Line ${LINENO}: ' 5 | ## (or add to your ~/.bashrc) 6 | ## That prints the line number of the current command 7 | ## (and with set -x, the actual command) for the script 8 | ## being run.-bts,Tue Jan 19 07:29:38 EST 2016 9 | if [ "${PS4}" == 'Line ${LINENO}: ' ]; 10 | then 11 | set -x 12 | fi 13 | 14 | # RELEASE VERSION # 15 | PUR_RLS="2016.04" 16 | RLS_MOD="-RELEASE" 17 | # for testing... 18 | if [[ "$(whoami)" == "bts" ]]; 19 | then 20 | RLS_URL="http://10.1.1.1/pur" 21 | else 22 | RLS_URL="http://g.rainwreck.com/pur" 23 | fi 24 | 25 | purlogo() { 26 | cat <<"EOT" 27 | _ _ 28 | __________ (_) (_) .____ .__ 29 | \______ \__ _________ | | |__| ____ __ _____ ___ 30 | | ___/ | \_ __ \ | | | |/ \| | \ \/ / 31 | | | | | /| | \/ | |___| | | \ | /> < 32 | |____| |____/ |__| |_______ \__|___| /____//__/\_ \ 33 | \/ \/ \/ 34 | 35 | Pür Linux Buildscript Version 1 36 | Pür Linux Version ${PUR_RLS}${RLS_MOD} 37 | 38 | You should have received a License file, if you cloned from Github. 39 | If not, please see https://github.com/PurLinux/Base/blob/CURRENT/LICENSE 40 | This script is released under a Simplified 2-Clause BSD license. Support 41 | truly Free software, and use a BSD license for your projects. 42 | GPL restrictions just make it Open, not Free. 43 | 44 | LFS was originally used for reference, and to bootstrap the project. 45 | FreeBSD inspired this project. 46 | PkgSrc from NetBSD is used as the primary package management utility. 47 | Instead of donating to Pür, go donate to LFS, the FreeBSD project, or NetBSD. 48 | We're a small project, and currently have enough resources to do the needful. 49 | Your money is better spent with the aforementioned projects. 50 | 51 | This is the first half of the Pür Linux build process, which occurrs within 52 | the host environment. At the end, another script is called and run within a chroot. 53 | 54 | EOT 55 | } 56 | 57 | purlogo 58 | 59 | 60 | # Only supported on Arch. 61 | 62 | #Deps list: 63 | #_______________________________________ 64 | # gawk | | 65 | # sed |-- included in the | 66 | # grep | "base" group | 67 | #_______________| | 68 | # gcc |-- included in the 69 | # make | "base-devel" group 70 | # bison | 71 | # patch | 72 | #_______________________________________| 73 | # gmp | 74 | # mpfr | 75 | # libmpc |-- must be explicitly 76 | # wget/curl | installed 77 | #_______________| 78 | 79 | 80 | #Important: Key Verification of packages is being implemented in an automated method 81 | # where this script will fail and print to your screen if a key fails. It will require GPG to be installed. 82 | 83 | # Build tests are commented out in some places due to some machines just plain being too fast/new. 84 | 85 | # Check to make sure sh is a link to bash 86 | if [ "$(sha256sum $(which sh) | awk '{print $1}')" != "$(sha256sum $(which bash) | awk '{print $1}')" ]; 87 | then 88 | echo " /!\ /!\ /!\ WARNING WARNING WARNING /!\ /!\ /!\ /!\ " 89 | echo " Your $(which sh) is NOT linked to $(which bash)!! " 90 | echo " Please fix this (i.e. via: ln -sf $(which bash) $(which sh)" 91 | echo "/!\ /!\ /!\ WARNING WARNING WARNING /!\ /!\ /!\ /!\ " 92 | exit 1 93 | fi 94 | 95 | if [[ "$(whoami)" == "root" ]]; 96 | then 97 | echo " /!\ /!\ /!\ WARNING WARNING WARNING /!\ /!\ /!\ /!\ " 98 | echo " Don't run me as root. Create a new user!! " 99 | echo "/!\ /!\ /!\ WARNING WARNING WARNING /!\ /!\ /!\ /!\ " 100 | exit 1 101 | fi 102 | echo 103 | 104 | # Are we using curl or wget? 105 | if ! type curl > /dev/null 2>&1; 106 | then 107 | fetch_cmd="$(which wget) -c --progress=bar --tries=5 --waitretry 3 -a /tmp/fetch.log" 108 | else 109 | fetch_cmd="$(which curl) --progress-bar -LSOf --retry 5 --retry-delay 3 -C -" 110 | fi 111 | 112 | 113 | # Scrub/create paths 114 | mkdir -p ${HOME}/purroot 115 | PUR=${HOME}/purroot 116 | PLOGS=${PUR}/logs 117 | rm -rf ${PLOGS} 118 | mkdir -p ${PLOGS} 119 | 120 | # Setting up ENV 121 | # WELL, if this isn't the most hacky thing in the world. see the chroot section. 122 | PATH_LOC=${PATH} 123 | env_vars=$(env | sed -re "s/=(.*)/='\1'/g") 124 | env > ${PLOGS}/env_vars.pre_clear 125 | echo "Setting up the environment and cleaning results from previous runs if necessary..." 126 | env -i HOME=${HOME} TERM=${TERM} PS1='\u:\w\$ ' > /dev/null 2>&1 127 | set +h 128 | umask 022 129 | echo 130 | 131 | # clean up from previous failed runs 132 | if [ -z "${PUR}" ]; 133 | then 134 | echo "PUR VARIABLE IS UNSET! Further process will cause host system damage." 135 | exit 1 136 | fi 137 | set +e 138 | sudo umount -l ${PUR}/{run,sys,proc,dev} > /dev/null 2>&1 139 | sudo rm -rf ${PUR}/{bin,boot,etc,home,lib,mnt,opt,run,sys,proc,dev} > /dev/null 2>&1 140 | set -e 141 | # sudo is needed if tools has been chown'd 142 | PTLS=/tools 143 | PSRC=${PUR}/sources 144 | PCNTRB=${PUR}/contrib 145 | sudo rm -rf ${PTLS} 146 | mkdir -p ${PUR}/tools 147 | mkdir -p ${PSRC} 148 | find ${PSRC}/. -maxdepth 1 -ignore_readdir_race -type d -exec rm -rf '{}' \; > /dev/null 2>&1 149 | sudo chmod a+wt ${PSRC} 150 | mkdir -p ${PCNTRB} 151 | find ${PCNTRB}/. -maxdepth 1 -ignore_readdir_race -type d -exec rm -rf '{}' \; > /dev/null 2>&1 152 | LC_ALL=POSIX 153 | PUR_TGT="$(uname -m)-pur-linux-gnu" 154 | sudo rm -rf ${PTLS} 155 | sudo ln -s ${PUR}/tools / 156 | 157 | rm -rf ${PTLS}/include 158 | mkdir -p ${PTLS}/include 159 | PATH=${PTLS}/bin:/usr/local/bin:/bin:/usr/bin 160 | export LC_ALL PUR_TGT PATH PBLD 161 | 162 | rm -rf ${HOME}/specs 163 | mkdir -p ${HOME}/specs 164 | sudo ln -s ${HOME}/specs /specs 165 | if [ "${USER}" == 'bts' ]; 166 | then 167 | export MAKEFLAGS="-j $(($(egrep '^processor[[:space:]]*:' /proc/cpuinfo | wc -l)+1))" 168 | fi 169 | ulimit -n 512 ## Needed for building GNU Make on Debian 170 | 171 | 172 | #Fetching everything. 173 | cd ${PSRC} 174 | echo "Fetching source tarballs (if necessary) and cleaning up from previous builds (if necessary). This may take a while..." 175 | find . -maxdepth 1 -ignore_readdir_race -type d -exec rm -rf '{}' \; > /dev/null 2>&1 176 | find . -maxdepth 1 -ignore_readdir_race -type f -not -name "pur_src*.tar.xz" -delete > /dev/null 2>&1 177 | if [ -f "pur_src.${PUR_RLS}${RLS_MOD}.tar.xz" ]; 178 | then 179 | if type sha256sum > /dev/null 2>&1; 180 | then 181 | echo "Checking integrity..." 182 | ${fetch_cmd} -s "${RLS_URL}/pur_src.${PUR_RLS}${RLS_MOD}.tar.xz.sha256" 183 | set +e 184 | $(which sha256sum) -c pur_src.${PUR_RLS}${RLS_MOD}.tar.xz.sha256 185 | if [ "${?}" != '0' ]; 186 | then 187 | echo "SHA256 checksum failed. Try deleting ${PSRC}/pur_src.${PUR_RLS}${RLS_MOD}.tar.xz and re-running." 188 | exit 1 189 | fi 190 | set -e 191 | fi 192 | else 193 | ${fetch_cmd} ${RLS_URL}/pur_src.${PUR_RLS}${RLS_MOD}.tar.xz 194 | if type sha256sum > /dev/null 2>&1; 195 | then 196 | echo "Checking integrity..." 197 | ${fetch_cmd} -s "${RLS_URL}/pur_src.${PUR_RLS}${RLS_MOD}.tar.xz.sha256" 198 | set +e 199 | $(which sha256sum) -c pur_src.${PUR_RLS}${RLS_MOD}.tar.xz.sha256 200 | if [ "${?}" != '0' ]; 201 | then 202 | echo "SHA256 checksum failed. Try deleting ${PSRC}/pur_src.${PUR_RLS}${RLS_MOD}.tar.xz and re-running." 203 | exit 1 204 | fi 205 | set -e 206 | fi 207 | fi 208 | echo "Extracting main packageset..." 209 | tar --totals -Jxf pur_src.${PUR_RLS}${RLS_MOD}.tar.xz 210 | #cd pur_src/core 211 | #mv * ${PSRC} 212 | #cd ../contrib 213 | #mv * ${PCNTRB} 214 | #rm -rf pur_src 215 | cd ${PSRC}/pur_src/core 216 | GLIBCVERS=$(egrep '^glibc-[0-9]' versions.txt | sed -re 's/^.*[A-Za-z]-([0-9\.]+).*/\1/g') 217 | #HOSTGLIBCVERS="2.11" # <2.13 had serious security issues, we don't want any possible contamination 218 | HOSTGLIBCVERS="2.13" 219 | # or, we can detect the host's actual glibc version. 220 | #HOSTGLIBCVERS=$(/lib/libc.so.6 | egrep 'release\ version\ [0-9\.]+\,? ' | sed -re 's/^.*[[:space:]]+([0-9\.]+)(,|[[:space:]]+).*/\1/g') 221 | GCCVER=$(egrep '^gcc-[0-9]' versions.txt | sed -re 's/[A-Za-z]*-(.*)$/\1/g') 222 | PERLVER=$(egrep '^perl-[0-9]' versions.txt | sed -re 's/[A-Za-z]*-(.*)$/\1/g') 223 | PERLMAJ=$(echo ${PERLVER} | sed -re 's/([0-9]*)\..*$/\1/g') 224 | TCLVER=$(egrep '^tcl-[0-9]' versions.txt | sed -re 's/[A-Za-z]*-(.*)$/\1/g' | awk -F. '{print $1"."$2}') 225 | VIMVER=$(egrep '^vim-[0-9]' versions.txt | sed -re 's/[A-Za-z]*-(.*)$/\1/g' | sed -e 's/\.//g') 226 | export GLIBCVERS HOSTGLIBCVERS GCCVER PERLVER PERLMAJ TLCVER VIMVER 227 | 228 | # Okay, so this would take way too much time... 229 | #src_core_x () { 230 | # cd ${PSRC} 231 | # pkg=${1} 232 | # rm -rf ${pkg} 233 | # tar -C ${PSRC} -Jxf ${PSRC}/pur_src.${PUR_RLS}${RLS_MOD}.tar.xz pur_src/core/${pkg} 234 | # mv ${PSRC}/pur_src/core/${pkg} ${PSRC}/${pkg} 235 | # rm -rf ${PSRC}/pur_src 236 | #} 237 | 238 | coresrc_prep () { 239 | pkg=${1} 240 | if [ -z "${pkg}" ]; 241 | then 242 | echo "WARNING: coresrc_prep called with no packagename!" 243 | exit 1 244 | fi 245 | rm -rf ${PSRC}/${pkg} 246 | cp -a ${PSRC}/pur_src/core/${pkg} ${PSRC} 247 | cd ${PSRC}/${pkg} 248 | } 249 | 250 | coresrc_prep2 () { 251 | pkg=${1} 252 | if [ -z "${pkg}" ]; 253 | then 254 | echo "WARNING: coresrc_prep2 called with no packagename!" 255 | exit 1 256 | fi 257 | rm -rf ${PSRC}/${pkg} 258 | cp -a ${PSRC}/pur_src/core/${pkg} ${PSRC} 259 | mkdir ${PSRC}/${pkg}/${pkg}-build 260 | cd ${PSRC}/${pkg}/${pkg}-build 261 | } 262 | 263 | coresrc_clean () { 264 | pkg=${1} 265 | if [ -z "${pkg}" ]; 266 | then 267 | echo "WARNING: coresrc_clean called with no packagename!" 268 | exit 1 269 | fi 270 | cd ${PSRC} 271 | rm -rf ${PSRC}/${pkg} 272 | } 273 | 274 | echo 275 | 276 | 277 | 278 | ############################################ 279 | # BUILDING BOOTSTRAP ENVIRONMENT IN /TOOLS # 280 | ############################################ 281 | 282 | #binutils first build 283 | echo "Binutils - first pass." 284 | coresrc_prep2 binutils 285 | echo "[Binutils] Configuring..." 286 | ../configure --prefix=${PTLS} \ 287 | --with-sysroot=${PUR} \ 288 | --with-lib-path=${PTLS}/lib \ 289 | --target=${PUR_TGT} \ 290 | --disable-nls \ 291 | --disable-werror > ${PLOGS}/binutils_configure.1 2>&1 292 | 293 | echo "[Binutils] Building..." 294 | make > ${PLOGS}/binutils_make.1 2>&1 295 | case $(uname -m) in 296 | x86_64) ln -s ${PTLS}/lib ${PTLS}/lib64 ;; 297 | esac 298 | make install >> ${PLOGS}/binutils_make.1 2>&1 299 | coresrc_clean binutils 300 | 301 | ## building GCC first run. 302 | echo "GCC - first pass." 303 | #GCC DEPS 304 | # May want to consider this in the future, just for keeping compat with GCC's suggested practices: 305 | # Using ./contrib/download_prerequisites instead of manually grabbing 306 | coresrc_prep2 gcc 307 | 308 | for i in mpfr mpc gmp; 309 | do 310 | coresrc_prep ${i} 311 | cp -a ${PSRC}/${i} ${PSRC}/gcc/. 312 | done 313 | cd ${PSRC}/gcc 314 | 315 | #GCC 316 | echo "[GCC] Configuring..." 317 | for file in $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h); 318 | do 319 | cp -u ${file}{,.orig} 320 | sed -re "s@/lib(64)?(32)?/ld@${PTLS}&@g" -e "s@/usr@${PTLS}@g" ${file}.orig > ${file} 321 | echo " 322 | #undef STANDARD_STARTFILE_PREFIX_1 323 | #undef STANDARD_STARTFILE_PREFIX_2 324 | #define STANDARD_STARTFILE_PREFIX_1 \"${PTLS}/lib/\" 325 | #define STANDARD_STARTFILE_PREFIX_2 \"\"" >> ${file} 326 | touch ${file}.orig 327 | done 328 | cd ${PSRC}/gcc/gcc-build 329 | ../configure \ 330 | --target=${PUR_TGT} \ 331 | --prefix=${PTLS} \ 332 | --with-glibc-version=${HOSTGLIBCVERS} \ 333 | --with-sysroot=${PUR} \ 334 | --with-newlib \ 335 | --without-headers \ 336 | --with-local-prefix=${PTLS} \ 337 | --with-native-system-header-dir=${PTLS}/include \ 338 | --disable-nls \ 339 | --disable-shared \ 340 | --disable-multilib \ 341 | --disable-decimal-float \ 342 | --disable-threads \ 343 | --disable-libatomic \ 344 | --disable-libgomp \ 345 | --disable-libquadmath \ 346 | --disable-libssp \ 347 | --disable-libvtv \ 348 | --disable-libstdcxx \ 349 | --enable-languages=c,c++ > ${PLOGS}/gcc_configure.1 2>&1 350 | 351 | echo "[GCC] Building..." 352 | make > ${PLOGS}/gcc_make.1 2>&1 353 | make install >> ${PLOGS}/gcc_make.1 2>&1 354 | coresrc_clean gcc 355 | for i in mpfr mpc gmp; 356 | do 357 | coresrc_clean ${i} 358 | done 359 | 360 | ## Grabbing latest kernel headers 361 | echo "[Kernel] Making and installing headers..." 362 | coresrc_prep linux 363 | make mrproper > ${PLOGS}/kernel-headers_make.1 2>&1 364 | make INSTALL_HDR_PATH=dest headers_install >> ${PLOGS}/kernel-headers_make.1 2>&1 365 | cp -r dest/include/* ${PTLS}/include 366 | coresrc_clean linux 367 | 368 | # Building glibc - first pass 369 | echo "GlibC - first pass." 370 | coresrc_prep2 glibc 371 | echo "[GlibC] Configuring..." 372 | ../configure \ 373 | --prefix=${PTLS} \ 374 | --host=${PUR_TGT} \ 375 | --build=$(../scripts/config.guess) \ 376 | --disable-profile \ 377 | --enable-kernel=2.6.32 \ 378 | --enable-obsolete-rpc \ 379 | --with-headers=${PTLS}/include \ 380 | libc_cv_forced_unwind=yes \ 381 | libc_cv_ctors_header=yes \ 382 | libc_cv_c_cleanup=yes > ${PLOGS}/glibc_configure.1 2>&1 383 | # Note: the below was originally enabled. 384 | # However, this version of GlibC is scrapped in the final version and likely the umlaut 385 | # might break things- so disabling for sane initial toolchain. 386 | # --with-pkgversion='Pür Linux glibc' \ 387 | 388 | echo "[GlibC] Building..." 389 | make > ${PLOGS}/glibc_make.1 2>&1 390 | make install >> ${PLOGS}/glibc_make.1 2>&1 391 | 392 | # Testing! 393 | echo -n "Runnning tests before continuing... " 394 | echo 'int main(){}' > dummy.c 395 | ${PUR_TGT}-gcc dummy.c 396 | if readelf -l a.out | grep ": ${PTLS}" | grep -q ld-linux-x86-64.so.2; 397 | then 398 | echo "Test passed." 399 | rm dummy.c a.out 400 | else 401 | echo "Test Failed. Now Exiting, post glibc build." 402 | exit 1 403 | fi 404 | coresrc_clean glibc 405 | 406 | #libstc++ 407 | echo "LibstdC++ - first pass." 408 | coresrc_prep2 gcc 409 | echo "[LibstdC++] Configuring..." 410 | ../libstdc++-v3/configure \ 411 | --host=${PUR_TGT} \ 412 | --prefix=${PTLS} \ 413 | --disable-multilib \ 414 | --disable-nls \ 415 | --disable-libstdcxx-threads \ 416 | --disable-libstdcxx-pch \ 417 | --with-gxx-include-dir=${PTLS}/${PUR_TGT}/include/c++/${GCCVER} > ${PLOGS}/libstdc++_configure.1 2>&1 418 | 419 | echo "[LibstdC++] Building..." 420 | make > ${PLOGS}/libstdc++_make.1 2>&1 421 | make install >> ${PLOGS}/libstdc++_make.1 2>&1 422 | coresrc_clean gcc 423 | 424 | 425 | ############################## 426 | # BUILDING TOOLKIT IN /TOOLS # 427 | ############################## 428 | 429 | # binutils pass 2 430 | echo "Binutils - second pass." 431 | coresrc_prep2 binutils 432 | echo "[Binutils] Configuring..." 433 | CC=${PUR_TGT}-gcc \ 434 | AR=${PUR_TGT}-ar \ 435 | RANLIB=${PUR_TGT}-ranlib \ 436 | ../configure \ 437 | --prefix=${PTLS} \ 438 | --disable-nls \ 439 | --disable-werror \ 440 | --with-lib-path=${PTLS}/lib \ 441 | --with-sysroot > ${PLOGS}/binutils_configure.2 2>&1 442 | 443 | echo "[Binutils] Building..." 444 | make > ${PLOGS}/binutils_make.2 2>&1 445 | make install >> ${PLOGS}/binutils_make.2 2>&1 446 | #fiddly bits 447 | make -C ld clean > ${PLOGS}/binutils_post-tweaks.2 2>&1 448 | make -C ld LIB_PATH=/usr/lib:/lib >> ${PLOGS}/binutils_post-tweaks.2 2>&1 449 | cp ld/ld-new ${PTLS}/bin 450 | coresrc_clean binutils 451 | 452 | # GCC round 2 453 | echo "GCC - second pass." 454 | coresrc_prep2 gcc 455 | #cd ${PTLS}/lib # why is this here? 456 | cd ${PSRC}/gcc 457 | cat gcc/limitx.h gcc/glimits.h gcc/limity.h > $(dirname $(${PUR_TGT}-gcc -print-libgcc-file-name))/include-fixed/limits.h 458 | for file in $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h); 459 | do 460 | cp -u ${file}{,.orig} 461 | sed -re "s@/lib(64)?(32)?/ld@${PTLS}&@g" -e "s@/usr@${PTLS}@g" ${file}.orig > ${file} 462 | echo " 463 | #undef STANDARD_STARTFILE_PREFIX_1 464 | #undef STANDARD_STARTFILE_PREFIX_2 465 | #define STANDARD_STARTFILE_PREFIX_1 \"${PTLS}/lib/\" 466 | #define STANDARD_STARTFILE_PREFIX_2 \"\"" >> ${file} 467 | touch ${file}.orig 468 | done 469 | for i in mpfr mpc gmp; 470 | do 471 | coresrc_prep ${i} 472 | cp -a ${PSRC}/${i} ${PSRC}/gcc/. 473 | done 474 | 475 | cd ${PSRC}/gcc/gcc-build 476 | find ./ -name 'config.cache' -exec rm -rf '{}' \; 477 | echo "[GCC] Configuring..." 478 | CC=${PUR_TGT}-gcc \ 479 | CXX=${PUR_TGT}-g++ \ 480 | AR=${PUR_TGT}-ar \ 481 | RANLIB=${PUR_TGT}-ranlib \ 482 | ../configure \ 483 | --prefix=${PTLS} \ 484 | --with-local-prefix=${PTLS} \ 485 | --with-native-system-header-dir=${PTLS}/include \ 486 | --enable-languages=c,c++ \ 487 | --disable-libstdcxx-pch \ 488 | --disable-multilib \ 489 | --disable-bootstrap \ 490 | --disable-libgomp > ${PLOGS}/gcc_configure.2 2>&1 491 | 492 | echo "[GCC] Building..." 493 | make > ${PLOGS}/gcc_make.2 2>&1 494 | make install >> ${PLOGS}/gcc_make.2 2>&1 495 | ln -s gcc ${PTLS}/bin/cc 496 | 497 | #testing again 498 | echo -n "Runnning tests before continuing... " 499 | echo 'int main(){}' > dummy.c 500 | ${PUR_TGT}-gcc dummy.c 501 | if readelf -l a.out | grep ": ${PTLS}" | grep -q ld-linux; 502 | then 503 | echo "Test passed." 504 | rm dummy.c a.out 505 | else 506 | echo "Test Failed. Now Exiting, post GCC Round 2 build" 507 | rm dummy.c a.out 508 | exit 1 509 | fi 510 | coresrc_clean gcc 511 | for i in mpfr mpc gmp; 512 | do 513 | coresrc_clean ${i} 514 | done 515 | 516 | ## Tests 517 | echo "Running further tests..." 518 | # TCL 519 | coresrc_prep tcl 520 | cd unix 521 | echo "[TCL] Configuring..." 522 | ./configure --prefix=${PTLS} > ${PLOGS}/tcl_configure.1 2>&1 523 | echo "[TCL] Building..." 524 | make > ${PLOGS}/tcl_make.1 2>&1 525 | TZ=UTC make test >> ${PLOGS}/tcl_test.1 2>&1 526 | make install >> ${PLOGS}/tcl_test.1 2>&1 527 | chmod u+w ${PTLS}/lib/libtcl${TCLVER}.so 528 | make install-private-headers >> ${PLOGS}/tcl_test.1 2>&1 529 | ln -s tclsh${TCLVER} ${PTLS}/bin/tclsh 530 | coresrc_clean tcl 531 | 532 | #Expect 533 | coresrc_prep expect 534 | echo "[Expect] Configuring..." 535 | sed -i -e 's:/usr/local/bin:/bin:' configure 536 | ./configure --prefix=${PTLS} \ 537 | --with-tcl=${PTLS}/lib \ 538 | --with-tclinclude=${PTLS}/include > ${PLOGS}/expect_configure.1 2>&1 539 | 540 | echo "[Expect] Building..." 541 | make > ${PLOGS}/expect_make.1 2>&1 542 | make tests >> ${PLOGS}/expect_make.1 2>&1 543 | make SCRIPTS="" install >> ${PLOGS}/expect_make.1 2>&1 544 | coresrc_clean expect 545 | 546 | #DejaGNU 547 | coresrc_prep dejagnu 548 | echo "[DejaGNU] Configuring..." 549 | ./configure --prefix=${PTLS} > ${PLOGS}/dejagnu_configure.1 2>&1 550 | 551 | echo "[DejaGNU] Building..." 552 | make install > ${PLOGS}/dejagnu_make.1 2>&1 553 | #make check >> ${PLOGS}/dejagnu_make.1 2>&1 554 | coresrc_clean dejagnu 555 | 556 | #check 557 | coresrc_prep check 558 | echo "[Check] Configuring..." 559 | # this is necessary since we download from git rather than sourceforge. fuck sourceforge. 560 | autoreconf --install > ${PLOGS}/check_configure.1 2>&1 561 | PKG_CONFIG= ./configure --prefix=${PTLS} >> ${PLOGS}/check_configure.1 2>&1 562 | 563 | echo "[Check] Building..." 564 | make > ${PLOGS}/check_make.1 2>&1 565 | #make check >> ${PLOGS}/check_make.1 2>&1 566 | make install >> ${PLOGS}/check_make.1 2>&1 567 | coresrc_clean check 568 | 569 | # ncurses 570 | coresrc_prep ncurses 571 | echo "[nCurses] Configuring..." 572 | sed -i -e 's/mawk//' configure # used for ncurses 573 | ./configure --prefix=${PTLS} \ 574 | --with-shared \ 575 | --without-debug \ 576 | --without-ada \ 577 | --enable-widec \ 578 | --enable-overwrite > ${PLOGS}/ncurses_configure.1 2>&1 579 | 580 | echo "[nCurses] Building..." 581 | make > ${PLOGS}/ncurses_make.1 2>&1 582 | make install >> ${PLOGS}/ncurses_make.1 2>&1 583 | coresrc_clean ncurses 584 | 585 | #bash 586 | coresrc_prep bash 587 | echo "[Bash] Configuring..." 588 | ./configure --prefix=${PTLS} --without-bash-malloc > ${PLOGS}/bash_configure.1 2>&1 589 | 590 | echo "[Bash] Building..." 591 | make > ${PLOGS}/bash_make.1 2>&1 592 | # make tests >> ${PLOGS}/bash_make.1 2>&1 593 | make install >> ${PLOGS}/bash_make.1 2>&1 594 | ln -s bash ${PTLS}/bin/sh 595 | coresrc_clean bash 596 | 597 | #Bzip2 598 | coresrc_prep bzip2 599 | echo "[Bzip2] Building..." 600 | make > ${PLOGS}/bzip2_make.1 2>&1 601 | make PREFIX=${PTLS} install >> ${PLOGS}/bzip2_make.1 2>&1 602 | coresrc_clean bzip2 603 | 604 | #Coreutils 605 | coresrc_prep coreutils 606 | echo "[Coreutils] Configuring..." 607 | ./configure --prefix=${PTLS} --enable-install-program=hostname > ${PLOGS}/coreutils_configure.1 2>&1 608 | 609 | echo "[Coreutils] Building..." 610 | make > ${PLOGS}/coreutils_make.1 2>&1 611 | # make RUN_EXPENSIVE_TESTS=yes check >> ${PLOGS}/coreutils_make.1 2>&1 612 | make install >> ${PLOGS}/coreutils_make.1 2>&1 613 | coresrc_clean coreutils 614 | 615 | #Diffutils 616 | coresrc_prep diffutils 617 | echo "[Diffutils] Configuring..." 618 | ./configure --prefix=${PTLS} > ${PLOGS}/diffutils_configure.1 2>&1 619 | 620 | echo "[Diffutils] Building..." 621 | make > ${PLOGS}/diffutils_make.1 2>&1 622 | # make check >> ${PLOGS}/diffutils_make.1 2>&1 623 | make install >> ${PLOGS}/diffutils_make.1 2>&1 624 | coresrc_clean diffutils 625 | 626 | # File 627 | coresrc_prep file 628 | echo "[File] Configuring..." 629 | ./configure --prefix=${PTLS} > ${PLOGS}/file_configure.1 2>&1 630 | 631 | echo "[File] Building..." 632 | make > ${PLOGS}/file_make.1 2>&1 633 | #make check >> ${PLOGS}/file_make.1 2>&1 634 | make install >> ${PLOGS}/file_make.1 2>&1 635 | coresrc_clean file 636 | 637 | # Findutils 638 | coresrc_prep findutils 639 | echo "[Findutils] Configuring..." 640 | ./configure --prefix=${PTLS} > ${PLOGS}/findutils_configure.1 2>&1 641 | 642 | echo "[Findutils] Building..." 643 | make > ${PLOGS}/findutils_make.1 2>&1 644 | #make check >> ${PLOGS}/findutils_makee.1 2>&1 645 | make install >> ${PLOGS}/findutils_makee.1 2>&1 646 | coresrc_clean findutils 647 | 648 | # GAWK 649 | coresrc_prep gawk 650 | echo "[Gawk] Configuring..." 651 | ./configure --prefix=${PTLS} > ${PLOGS}/gawk_configure.1 2>&1 652 | 653 | echo "[Gawk] Building..." 654 | make > ${PLOGS}/gawk_make.1 2>&1 655 | #make check >> ${PLOGS}/gawk_make.1 2>&1 656 | make install >> ${PLOGS}/gawk_make.1 2>&1 657 | coresrc_clean gawk 658 | 659 | #gettext 660 | coresrc_prep gettext 661 | cd gettext-tools 662 | echo "[Gettext] Configuring..." 663 | EMACS="no" ./configure --prefix=${PTLS} --disable-shared > ${PLOGS}/gettext_configure.1 2>&1 664 | 665 | echo "[Gettext] Building..." 666 | make -C gnulib-lib > ${PLOGS}/gettext_make.1 2>&1 667 | make -C intl pluralx.c >> ${PLOGS}/gettext_make.1 2>&1 668 | make -C src msgfmt >> ${PLOGS}/gettext_make.1 2>&1 669 | make -C src msgmerge >> ${PLOGS}/gettext_make.1 2>&1 670 | make -C src xgettext >> ${PLOGS}/gettext_make.1 2>&1 671 | cp src/{msgfmt,msgmerge,xgettext} ${PTLS}/bin 672 | coresrc_clean gettext 673 | 674 | # GNU Grep 675 | coresrc_prep grep 676 | echo "[Grep] Configuring..." 677 | ./configure --prefix=${PTLS} > ${PLOGS}/grep_configure.1 2>&1 678 | 679 | echo "[Grep] Building..." 680 | make > ${PLOGS}/grep_make.1 2>&1 681 | #make check >> ${PLOGS}/grep_make.1 2>&1 682 | make install >> ${PLOGS}/grep_make.1 2>&1 683 | coresrc_clean grep 684 | 685 | # GNU GZip 686 | coresrc_prep gzip 687 | echo "[Gzip] Configuring..." 688 | ./configure --prefix=${PTLS} > ${PLOGS}/gzip_configure.1 2>&1 689 | 690 | echo "[Gzip] Building..." 691 | make > ${PLOGS}/gzip_make.1 2>&1 692 | #make check >> ${PLOGS}/gzip_make.1 2>&1 693 | make install >> ${PLOGS}/gzip_make.1 2>&1 694 | coresrc_clean gzip 695 | 696 | # M4 697 | coresrc_prep m4 698 | echo "[M4] Configuring..." 699 | ./configure --prefix=${PTLS} > ${PLOGS}/m4_configure.1 2>&1 700 | 701 | echo "[M4] Building..." 702 | make > ${PLOGS}/m4_make.1 2>&1 703 | #make check >> ${PLOGS}/m4_make.1 2>&1 704 | make install >> ${PLOGS}/m4_make.1 2>&1 705 | coresrc_clean m4 706 | 707 | # GNU Make 708 | coresrc_prep make 709 | echo "[Make] Configuring..." 710 | ./configure --prefix=${PTLS} --without-guile > ${PLOGS}/make_configure.1 2>&1 711 | 712 | echo "[Make] Building..." 713 | make > ${PLOGS}/make_make.1 2>&1 714 | #make check >> ${PLOGS}/make_make.1 2>&1 715 | make install >> ${PLOGS}/make_make.1 2>&1 716 | coresrc_clean make 717 | 718 | #GNU Patch 719 | coresrc_prep patch 720 | echo "[Patch] Configuring..." 721 | ./configure --prefix=${PTLS} > ${PLOGS}/patch_configure.1 2>&1 722 | 723 | echo "[Patch] Building..." 724 | make > ${PLOGS}/patch_make.1 2>&1 725 | #make check >> ${PLOGS}/patch_make.1 2>&1 726 | make install >> ${PLOGS}/patch_make.1 2>&1 727 | coresrc_clean patch 728 | 729 | # Perl (Will be removed from Base eventually/hopefully) 730 | coresrc_prep perl 731 | echo "[Perl] Configuring..." 732 | sh Configure -des -Dprefix=${PTLS} -Dlibs=-lm > ${PLOGS}/perl_configure.1 2>&1 733 | 734 | echo "[Perl] Building..." 735 | make > ${PLOGS}/perl_make.1 2>&1 736 | cp perl cpan/podlators/pod2man ${PTLS}/bin 737 | mkdir -p ${PTLS}/lib/perl${PERLMAJ}/${PERLVER} 738 | cp -R lib/* ${PTLS}/lib/perl${PERLMAJ}/${PERLVER} 739 | coresrc_clean perl 740 | 741 | #GNU Sed 742 | coresrc_prep sed 743 | echo "[Sed] Configuring..." 744 | ./configure --prefix=${PTLS} > ${PLOGS}/sed_configure.1 2>&1 745 | 746 | echo "[Sed] Building..." 747 | make > ${PLOGS}/sed_make.1 2>&1 748 | #make check >> ${PLOGS}/sed_make.1 2>&1 749 | make install >> ${PLOGS}/sed_make.1 2>&1 750 | coresrc_clean sed 751 | 752 | #GNU Tar 753 | coresrc_prep tar 754 | echo "[Tar] Configuring..." 755 | ./configure --prefix=${PTLS} > ${PLOGS}/tar_configure.1 2>&1 756 | 757 | echo "[Tar] Building..." 758 | make > ${PLOGS}/tar_make.1 2>&1 759 | #make check >> ${PLOGS}/tar_make.1 2>&1 760 | make install >> ${PLOGS}/tar_make.1 2>&1 761 | coresrc_clean tar 762 | 763 | #GNU Texinfo 764 | coresrc_prep texinfo 765 | echo "[Texinfo] Configuring..." 766 | ./configure --prefix=${PTLS} > ${PLOGS}/texinfo_configure.1 2>&1 767 | 768 | echo "[Texinfo] Building..." 769 | make > ${PLOGS}/texinfo_make.1 2>&1 770 | #make check >> ${PLOGS}/texinfo_make.1 2>&1 771 | make install >> ${PLOGS}/texinfo_make.1 2>&1 772 | coresrc_clean texinfo 773 | 774 | # Util-Linux 775 | coresrc_prep util-linux 776 | echo "[Util-Linux] Configuring..." 777 | ./configure --prefix=${PTLS} \ 778 | --without-python \ 779 | --disable-makeinstall-chown \ 780 | --without-systemdsystemunitdir \ 781 | PKG_CONFIG="" > ${PLOGS}/util-linux_configure.1 2>&1 782 | 783 | echo "[Util-Linux] Building..." 784 | # i've had issues with this failing- not finding zlib.h, libudev.h, etc. 785 | #MAKEFLAGS_DFLT=${MAKEFLAGS} 786 | #MAKEFLAGS='' 787 | #make -j1 > ${PLOGS}/util-linux_make.1 2>&1 788 | make > ${PLOGS}/util-linux_make.1 2>&1 789 | make install >> ${PLOGS}/util-linux_make.1 2>&1 790 | coresrc_clean util-linux 791 | #MAKEFLAGS=${MAKEFLAGS_DFLT} 792 | 793 | #Xz 794 | coresrc_prep xz 795 | echo "[Xz] Configuring..." 796 | ./configure --prefix=${PTLS} > ${PLOGS}/xz_configure.1 2>&1 797 | 798 | echo "[Xz] Building..." 799 | make > ${PLOGS}/xz_make.1 2>&1 800 | #make check >> ${PLOGS}/xz_make.1 2>&1 801 | make install >> ${PLOGS}/xz_make.1 2>&1 802 | coresrc_clean xz 803 | 804 | PATH=${PATH_LOC} 805 | 806 | # Stripping bootstrap env 807 | # strip throws a non-0 because some /usr/bin's are actually bash scripts, etc. 808 | set +e 809 | strip --strip-debug ${PTLS}/lib/* > /dev/null 2>&1 810 | /usr/bin/strip --strip-unneeded ${PTLS}/{,s}bin/* > /dev/null 2>&1 811 | set -e 812 | rm -rf ${PTLS}/{,share}/{info,man,doc} 813 | 814 | # CHOWNing Bootstrap 815 | sudo chown -R root:root ${PTLS} 816 | 817 | 818 | ############################################ 819 | # PREPPING CHROOT # 820 | ############################################ 821 | 822 | #dis some bullshit. sudo apparently may want env vars back. the script has none, essentially. 823 | #env > ${PLOGS}/env_vars.pre_restore 824 | #eval ${env_vars} 825 | ## and if that don't work... 826 | #while read line; 827 | #do 828 | # eval ${line} 829 | #done < ${PLOGS}/env_vars.pre_clear 830 | #env > ${PLOGS}/env_vars.post_restore 831 | 832 | #Device Nodes 833 | sudo mkdir -p ${PUR}/{dev,proc,sys,run} 834 | sudo mknod -m 600 ${PUR}/dev/console c 5 1 835 | sudo mknod -m 666 ${PUR}/dev/null c 1 3 836 | # Temporary workaround? Either going with eudev or the old static way, not sure yet! Wheee putting off decisions! 837 | # I vote for eudev, personally. It'll give us way better hardware detection/hotplugging/etc. support. -bts. Thu Jan 21 09:14:51 EST 2016 838 | sudo mount --bind /dev ${PUR}/dev 839 | sudo mount -t devpts devpts ${PUR}/dev/pts -o gid=5,mode=620 840 | sudo mount -t proc proc ${PUR}/proc 841 | sudo mount -t sysfs sysfs ${PUR}/sys 842 | sudo mount -t tmpfs tmpfs ${PUR}/run 843 | if [ -h ${PUR}/dev/shm ]; 844 | then 845 | sudo mkdir -p ${PUR}/$(readlink ${PUR}/dev/shm) 846 | fi 847 | # Entering chroot 848 | cd ${PUR} 849 | rm -f chrootboot{,-stage2}.sh 850 | if [ "${USER}" == 'bts' ]; 851 | then 852 | # used in development 853 | ${fetch_cmd} http://10.1.1.1/pur/chrootboot.sh 854 | ${fetch_cmd} http://10.1.1.1/pur/chrootboot-stage2.sh 855 | else 856 | ${fetch_cmd} https://raw.githubusercontent.com/PurLinux/Base/CURRENT/chrootboot.sh 857 | ${fetch_cmd} https://raw.githubusercontent.com/PurLinux/Base/CURRENT/chrootboot-stage2.sh 858 | fi 859 | chmod +x chrootboot.sh 860 | chmod +x chrootboot-stage2.sh 861 | echo "ENTERING CHROOT" 862 | sudo chroot "${PUR}" ${PTLS}/bin/env -i \ 863 | HOME=/root \ 864 | TERM="${TERM}" \ 865 | PS1='\u:\w (chroot) \$ ' \ 866 | PS4="${PS4}" \ 867 | PATH=/bin:/usr/bin:/sbin:/usr/sbin:${PTLS}/bin \ 868 | GCCVER=${GCCVER} \ 869 | VIMVER=${VIMVER} \ 870 | MAKEFLAGS="${MAKEFLAGS}" \ 871 | ${PTLS}/bin/bash +h /chrootboot.sh 872 | 873 | touch ${PUR}/chrootboot1.success 874 | 875 | #sudo chroot "${PUR}" ${PTLS}/bin/env -i HOME=/root TERM=$TERM \ 876 | # PS1='\u:\w\$ ' \ 877 | # PATH=/bin:/usr/bin:/sbin:/usr/sbin \ 878 | # ${PTLS}/bin/find /{,usr/}{bin,lib,sbin} -type f \ 879 | # -exec ${PTLS}/bin/strip --strip-debug '{}' ';' 880 | 881 | #touch ${PUR}/chrootboot2.success 882 | set +e 883 | sudo find ${PTLS}/{,usr}/{bin,lib,sbin} -type f -exec strip --strib-debug '{}' \; > /dev/null 2>&1 884 | set -e 885 | 886 | sudo chroot "${PUR}" ${PTLS}/bin/env -i \ 887 | HOME=/root \ 888 | TERM="${TERM}" \ 889 | PS1='\u:\w (chroot) \$ ' \ 890 | PS4="${PS4}" \ 891 | PATH=/bin:/usr/bin:/sbin:/usr/sbin \ 892 | GCCVER=${GCCVER} \ 893 | VIMVER=${VIMVER} \ 894 | MAKEFLAGS="${MAKEFLAGS}" \ 895 | ${PTLS}/bin/bash +h /chrootboot-stage2.sh 896 | 897 | touch ${PUR}/chrootboot3.success 898 | 899 | sudo umount -l ${PUR}/{run,sys,proc,dev} > /dev/null 2>&1 900 | 901 | rm -f ${PSRC}/pur_src.${PUR_RLS}${RLS_MOD}.tar.xz{,.sha256} 902 | -------------------------------------------------------------------------------- /src/etc/motd: -------------------------------------------------------------------------------- 1 | _ _ 2 | __________ (_) (_) .____ .__ 3 | \______ \__ _________ | | |__| ____ __ _____ ___ 4 | | ___/ | \_ __ \ | | | |/ \| | \ \/ / 5 | | | | | /| | \/ | |___| | | \ | /> < 6 | |____| |____/ |__| |_______ \__|___| /____//__/\_ \ 7 | \/ \/ \/ 8 | 9 | ########################################################################## 10 | # Default System Message Of The Day # 11 | ########################################################################## 12 | # Welcome to Pür Linux, Oldschool Linux for Oldschool Hackers # 13 | # A Distro based on the concept that the old ways were best. # 14 | # Pür Linux abides by the UNIX philosophy of Keep It Simple Stupid. # 15 | ########################################################################## 16 | # To get started, run /usr/bin/setup.sh to configure your system. # 17 | # To install PürPorts (NetBSD's Pkgsrc), the default Package Management # 18 | # System for Pür Linux, just run /usr/bin/ports! Pkgsrc will be # 19 | # bootstrapped in /usr/ports with packages installing in the /usr/local # 20 | # prefix. # 21 | # For Binary packages, run /usr/bin/pkgin. If you haven't run # 22 | # /usr/bin/ports yet, it will automatically call that first. # 23 | ########################################################################## 24 | # Edit me in /etc/motd # 25 | ########################################################################## 26 | -------------------------------------------------------------------------------- /src/etc/pur-release: -------------------------------------------------------------------------------- 1 | Pür Linux version: CURRENT 2 | Built: N/A 3 | Bug Reports: https://github.com/PurLinux/Base/issues 4 | -------------------------------------------------------------------------------- /src/etc/rc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (c) 2000-2004 The FreeBSD Project 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions 8 | # are met: 9 | # 1. Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 2. Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # 15 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 | # SUCH DAMAGE. 26 | # 27 | # @(#)rc 5.27 (Berkeley) 6/5/91 28 | # $FreeBSD$ 29 | # 30 | 31 | # System startup script run by init on autoboot 32 | # or after single-user. 33 | # Output and error are redirected to console by init, 34 | # and the console is the controlling terminal. 35 | 36 | # Note that almost all of the user-configurable behavior is no longer in 37 | # this file, but rather in /etc/defaults/rc.conf. Please check that file 38 | # first before contemplating any changes here. If you do need to change 39 | # this file for some reason, we would like to know about it. 40 | 41 | stty status '^T' 2> /dev/null 42 | 43 | # Set shell to ignore SIGINT (2), but not children; 44 | # shell catches SIGQUIT (3) and returns to single user. 45 | # 46 | trap : 2 47 | trap "echo 'Boot interrupted'; exit 1" 3 48 | 49 | HOME=/ 50 | PATH=/sbin:/bin:/usr/sbin:/usr/bin 51 | export HOME PATH 52 | 53 | if [ "$1" = autoboot ]; then 54 | autoboot=yes 55 | _boot="faststart" 56 | rc_fast=yes # run_rc_command(): do fast booting 57 | else 58 | autoboot=no 59 | _boot="quietstart" 60 | fi 61 | 62 | dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null` 63 | if [ ${dlv:=0} -ne 0 -o -f /etc/diskless ]; then 64 | sh /etc/rc.initdiskless 65 | fi 66 | 67 | # Run these after determining whether we are booting diskless in order 68 | # to minimize the number of files that are needed on a diskless system, 69 | # and to make the configuration file variables available to rc itself. 70 | # 71 | . /etc/rc.subr 72 | load_rc_config 'XXX' 73 | 74 | # If we receive a SIGALRM, re-source /etc/rc.conf; this allows rc.d 75 | # scripts to perform "boot-time configuration" including enabling and 76 | # disabling rc.d scripts which appear later in the boot order. 77 | trap "_rc_conf_loaded=false; load_rc_config 'XXX'" ALRM 78 | 79 | skip="-s nostart" 80 | if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then 81 | skip="$skip -s nojail" 82 | if [ "$early_late_divider" = "FILESYSTEMS" ]; then 83 | early_late_divider=NETWORKING 84 | fi 85 | if [ `/sbin/sysctl -n security.jail.vnet` -ne 1 ]; then 86 | skip="$skip -s nojailvnet" 87 | fi 88 | fi 89 | 90 | # If the firstboot sentinel doesn't exist, we want to skip firstboot scripts. 91 | if ! [ -e ${firstboot_sentinel} ]; then 92 | skip_firstboot="-s firstboot" 93 | fi 94 | 95 | # Do a first pass to get everything up to $early_late_divider so that 96 | # we can do a second pass that includes $local_startup directories 97 | # 98 | files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* 2>/dev/null` 99 | 100 | _rc_elem_done=' ' 101 | for _rc_elem in ${files}; do 102 | run_rc_script ${_rc_elem} ${_boot} 103 | _rc_elem_done="${_rc_elem_done}${_rc_elem} " 104 | 105 | case "$_rc_elem" in 106 | */${early_late_divider}) break ;; 107 | esac 108 | done 109 | 110 | unset files local_rc 111 | 112 | # Now that disks are mounted, for each dir in $local_startup 113 | # search for init scripts that use the new rc.d semantics. 114 | # 115 | case ${local_startup} in 116 | [Nn][Oo] | '') ;; 117 | *) find_local_scripts_new ;; 118 | esac 119 | 120 | # The firstboot sentinel might be on a newly mounted filesystem; look for it 121 | # again and unset skip_firstboot if we find it. 122 | if [ -e ${firstboot_sentinel} ]; then 123 | skip_firstboot="" 124 | fi 125 | 126 | files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* ${local_rc} 2>/dev/null` 127 | for _rc_elem in ${files}; do 128 | case "$_rc_elem_done" in 129 | *" $_rc_elem "*) continue ;; 130 | esac 131 | 132 | run_rc_script ${_rc_elem} ${_boot} 133 | done 134 | 135 | # Remove the firstboot sentinel, and reboot if it was requested. 136 | if [ -e ${firstboot_sentinel} ]; then 137 | rm ${firstboot_sentinel} 138 | if [ -e ${firstboot_sentinel}-reboot ]; then 139 | rm ${firstboot_sentinel}-reboot 140 | kill -INT 1 141 | fi 142 | fi 143 | 144 | echo '' 145 | date 146 | exit 0 147 | -------------------------------------------------------------------------------- /src/etc/rc.subr: -------------------------------------------------------------------------------- 1 | # Pür Linux /etc/rc.subr version 0.l 2 | # Forked from NetBSD rc.subr verison 1.12 3 | # 4 | # Copyright (c) 1997-2002 The NetBSD Foundation, Inc. 5 | # Copyright (c) 2016 Pür Linux 6 | # All rights reserved. 7 | # 8 | # This code is originally derived from software contributed to The NetBSD Foundation 9 | # by Luke Mewburn. 10 | # 11 | # Redistribution and use in source and binary forms, with or without 12 | # modification, are permitted provided that the following conditions 13 | # are met: 14 | # 1. Redistributions of source code must retain the above copyright 15 | # notice, this list of conditions and the following disclaimer. 16 | # 2. Redistributions in binary form must reproduce the above copyright 17 | # notice, this list of conditions and the following disclaimer in the 18 | # documentation and/or other materials provided with the distribution. 19 | # 3. All advertising materials mentioning features or use of this software 20 | # must display the following acknowledgement: 21 | # This product includes software developed by the NetBSD 22 | # Foundation, Inc. and its contributors. 23 | # 4. Neither the name of The NetBSD Foundation nor the names of its 24 | # contributors may be used to endorse or promote products derived 25 | # from this software without specific prior written permission. 26 | # 27 | # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 28 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | # POSSIBILITY OF SUCH DAMAGE. 37 | # 38 | # rc.subr 39 | # functions used by various rc scripts 40 | # 41 | 42 | # global variables 43 | # ---------------- 44 | 45 | _RCCMD_chown="/usr/sbin/chown" 46 | _RCCMD_chroot="/usr/sbin/chroot" 47 | _RCCMD_ci="/usr/bin/ci" 48 | _RCCMD_co="/usr/bin/co" 49 | _RCCMD_cp="/bin/cp" 50 | _RCCMD_echo="echo" # use sh builtin 51 | _RCCMD_kill="/bin/kill" 52 | _RCCMD_logger="/usr/bin/logger" 53 | _RCCMD_mount="/sbin/mount" 54 | _RCCMD_mv="/bin/mv" 55 | _RCCMD_nice="/usr/bin/nice" 56 | _RCCMD_ps="/bin/ps" 57 | _RCCMD_rcs="/usr/bin/rcs" 58 | _RCCMD_rm="/bin/rm" 59 | _RCCMD_sh="/bin/sh" 60 | _RCCMD_su="/usr/bin/su" 61 | _RCCMD_systrace="/bin/systrace" 62 | _RCCMD_whoami="/usr/bin/whoami" 63 | 64 | _RCARG_psformat="-o pid,command" 65 | _RCARG_ps="-ax" 66 | _RCARG_su="-m" 67 | 68 | 69 | _RCCMD_chown="/bin/chown" 70 | _RCCMD_nice=$(which nice) 71 | _RCARG_ps="ax" 72 | 73 | # 74 | # functions 75 | # --------- 76 | 77 | # 78 | # checkyesno var 79 | # Test $1 variable, and warn if not set to YES or NO. 80 | # Return 0 if it's "yes" (et al), nonzero otherwise. 81 | # 82 | checkyesno() 83 | { 84 | eval _value=\$${1} 85 | case $_value in 86 | 87 | # "yes", "true", "on", or "1" 88 | [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) 89 | return 0 90 | ;; 91 | 92 | # "no", "false", "off", or "0" 93 | [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) 94 | return 1 95 | ;; 96 | *) 97 | warn "\$${1} is not set properly - see rc.conf(5)." 98 | return 1 99 | ;; 100 | esac 101 | } 102 | 103 | # reverse_list list 104 | # print the list in reverse order 105 | # 106 | reverse_list() 107 | { 108 | _revlist= 109 | for _revfile; do 110 | _revlist="$_revfile $_revlist" 111 | done 112 | ${_RCCMD_echo} $_revlist 113 | } 114 | 115 | # 116 | # mount_critical_filesystems type 117 | # Go through the list of critical filesystems as provided in 118 | # the rc.conf(5) variable $critical_filesystems_${type}, checking 119 | # each one to see if it is mounted, and if it is not, mounting it. 120 | # 121 | mount_critical_filesystems() 122 | { 123 | eval _fslist=\$critical_filesystems_${1} 124 | for _fs in $_fslist; do 125 | ${_RCCMD_mount} | ( 126 | _ismounted=false 127 | while read what _on on _type type; do 128 | if [ $on = $_fs ]; then 129 | _ismounted=true 130 | fi 131 | done 132 | if $_ismounted; then 133 | : 134 | else 135 | ${_RCCMD_mount} $_fs >/dev/null 2>&1 136 | fi 137 | ) 138 | done 139 | } 140 | 141 | # 142 | # check_pidfile pidfile procname [interpreter] 143 | # Parses the first line of pidfile for a PID, and ensures 144 | # that the process is running and matches procname. 145 | # Prints the matching PID upon success, nothing otherwise. 146 | # interpreter is optional; see _find_processes() for details. 147 | # 148 | check_pidfile() 149 | { 150 | _pidfile=$1 151 | _procname=$2 152 | _interpreter=$3 153 | if [ -z "$_pidfile" -o -z "$_procname" ]; then 154 | err 3 'USAGE: check_pidfile pidfile procname [interpreter]' 155 | fi 156 | if [ ! -f $_pidfile ]; then 157 | return 158 | fi 159 | read _pid _junk < $_pidfile 160 | if [ -z "$_pid" ]; then 161 | return 162 | fi 163 | _find_processes $_procname ${_interpreter:-.} '-p '"$_pid" 164 | } 165 | 166 | # 167 | # check_process procname [interpreter] 168 | # Ensures that a process (or processes) named procname is running. 169 | # Prints a list of matching PIDs. 170 | # interpreter is optional; see _find_processes() for details. 171 | # 172 | check_process() 173 | { 174 | _procname=$1 175 | _interpreter=$2 176 | if [ -z "$_procname" ]; then 177 | err 3 'USAGE: check_process procname [interpreter]' 178 | fi 179 | _find_processes $_procname ${_interpreter:-.} ${_RCARG_ps} 180 | } 181 | 182 | # 183 | # _find_processes procname interpreter psargs 184 | # Search for procname in the output of ps generated by psargs. 185 | # Prints the PIDs of any matching processes, space separated. 186 | # 187 | # If interpreter == ".", check the following variations of procname 188 | # against the first word of each command: 189 | # procname 190 | # `basename procname` 191 | # `basename procname` + ":" 192 | # "(" + `basename procname` + ")" 193 | # 194 | # If interpreter != ".", read the first line of procname, remove the 195 | # leading #!, normalise whitespace, append procname, and attempt to 196 | # match that against each command, either as is, or with extra words 197 | # at the end. 198 | # 199 | _find_processes() 200 | { 201 | if [ $# -ne 3 ]; then 202 | err 3 'USAGE: _find_processes procname interpreter psargs' 203 | fi 204 | _procname=$1 205 | _interpreter=$2 206 | _psargs=$3 207 | 208 | _pref= 209 | if [ $_interpreter != "." ]; then # an interpreted script 210 | read _interp < $_procname # read interpreter name 211 | _interp=${_interp#\#!} # strip #! 212 | set -- $_interp 213 | if [ $_interpreter != $1 ]; then 214 | warn "\$command_interpreter $_interpreter != $1" 215 | fi 216 | _interp="$* $_procname" # cleanup spaces, add _procname 217 | _fp_args='_argv' 218 | _fp_match='case "$_argv" in 219 | ${_interp}|"${_interp} "*)' 220 | else # a normal daemon 221 | _procnamebn=${_procname##*/} 222 | _fp_args='_arg0 _argv' 223 | _fp_match='case "$_arg0" in 224 | $_procname|$_procnamebn|${_procnamebn}:|"(${_procnamebn})"|"[${_procnamebn}]")' 225 | fi 226 | 227 | _proccheck=' 228 | ${_RCCMD_ps} ${_RCARG_psformat} '"$_psargs"' | 229 | while read _npid '"$_fp_args"'; do 230 | case "$_npid" in 231 | PID) 232 | continue ;; 233 | esac ; '"$_fp_match"' 234 | ${_RCCMD_echo} -n "$_pref$_npid" ; 235 | _pref=" " 236 | ;; 237 | esac 238 | done' 239 | 240 | eval $_proccheck 241 | } 242 | 243 | # 244 | # wait_for_pids pid [pid ...] 245 | # spins until none of the pids exist 246 | # 247 | wait_for_pids() 248 | { 249 | _list="$@" 250 | if [ -z "$_list" ]; then 251 | return 252 | fi 253 | _prefix= 254 | while true; do 255 | _nlist=""; 256 | for _j in $_list; do 257 | if ${_RCCMD_kill} -0 $_j 2>/dev/null; then 258 | _nlist="${_nlist}${_nlist:+ }$_j" 259 | fi 260 | done 261 | if [ -z "$_nlist" ]; then 262 | break 263 | fi 264 | _list=$_nlist 265 | ${_RCCMD_echo} -n ${_prefix:-"Waiting for PIDS: "}$_list 266 | _prefix=", " 267 | sleep 2 268 | done 269 | if [ -n "$_prefix" ]; then 270 | ${_RCCMD_echo} "." 271 | fi 272 | } 273 | 274 | # 275 | # run_rc_command argument 276 | # Search for argument in the list of supported commands, which is: 277 | # "start stop restart rcvar status poll ${extra_commands}" 278 | # If there's a match, run ${argument}_cmd or the default method 279 | # (see below). 280 | # 281 | # If argument has a given prefix, then change the operation as follows: 282 | # Prefix Operation 283 | # ------ --------- 284 | # fast Skip the pid check, and set rc_fast=yes 285 | # force Set ${rcvar} to YES, and set rc_force=yes 286 | # 287 | # The following globals are used: 288 | # 289 | # Name Needed Purpose 290 | # ---- ------ ------- 291 | # name y Name of script. 292 | # 293 | # command n Full path to command. 294 | # Not needed if ${rc_arg}_cmd is set for 295 | # each keyword. 296 | # 297 | # command_args n Optional args/shell directives for command. 298 | # 299 | # command_interpreter n If not empty, command is interpreted, so 300 | # call check_{pidfile,process}() appropriately. 301 | # 302 | # extra_commands n List of extra commands supported. 303 | # 304 | # pidfile n If set, use check_pidfile $pidfile $command, 305 | # otherwise use check_process $command. 306 | # In either case, only check if $command is set. 307 | # 308 | # procname n Process name to check for instead of $command. 309 | # 310 | # rcvar n This is checked with checkyesno to determine 311 | # if the action should be run. 312 | # 313 | # ${name}_chroot n Directory to chroot to before running ${command} 314 | # Requires /usr to be mounted. 315 | # 316 | # ${name}_chdir n Directory to cd to before running ${command} 317 | # (if not using ${name}_chroot). 318 | # 319 | # ${name}_flags n Arguments to call ${command} with. 320 | # NOTE: $flags from the parent environment 321 | # can be used to override this. 322 | # 323 | # ${name}_nice n Nice level to run ${command} at. 324 | # 325 | # ${name}_user n User to run ${command} as, using su(1) if not 326 | # using ${name}_chroot. 327 | # Requires /usr to be mounted. 328 | # 329 | # ${name}_group n Group to run chrooted ${command} as. 330 | # Requires /usr to be mounted. 331 | # 332 | # ${name}_groups n Comma separated list of supplementary groups 333 | # to run the chrooted ${command} with. 334 | # Requires /usr to be mounted. 335 | # 336 | # ${name}_systrace n Flags passed to systrace(1) if it is used. 337 | # Setting this variable enables systracing 338 | # of the given program. The use of "-a" is 339 | # recommended so that the boot process is not 340 | # stalled. In order to pass no flags to 341 | # systrace, set this variable to "--". 342 | # 343 | # ${rc_arg}_cmd n If set, use this as the method when invoked; 344 | # Otherwise, use default command (see below) 345 | # 346 | # ${rc_arg}_precmd n If set, run just before performing the 347 | # ${rc_arg}_cmd method in the default 348 | # operation (i.e, after checking for required 349 | # bits and process (non)existence). 350 | # If this completes with a non-zero exit code, 351 | # don't run ${rc_arg}_cmd. 352 | # 353 | # ${rc_arg}_postcmd n If set, run just after performing the 354 | # ${rc_arg}_cmd method, if that method 355 | # returned a zero exit code. 356 | # 357 | # required_dirs n If set, check for the existence of the given 358 | # directories before running the default 359 | # (re)start command. 360 | # 361 | # required_files n If set, check for the readability of the given 362 | # files before running the default (re)start 363 | # command. 364 | # 365 | # required_vars n If set, perform checkyesno on each of the 366 | # listed variables before running the default 367 | # (re)start command. 368 | # 369 | # Default behaviour for a given argument, if no override method is 370 | # provided: 371 | # 372 | # Argument Default behaviour 373 | # -------- ----------------- 374 | # start if !running && checkyesno ${rcvar} 375 | # ${command} 376 | # 377 | # stop if ${pidfile} 378 | # rc_pid=$(check_pidfile $pidfile $command) 379 | # else 380 | # rc_pid=$(check_process $command) 381 | # kill $sig_stop $rc_pid 382 | # wait_for_pids $rc_pid 383 | # ($sig_stop defaults to TERM.) 384 | # 385 | # reload Similar to stop, except use $sig_reload instead, 386 | # and doesn't wait_for_pids. 387 | # $sig_reload defaults to HUP. 388 | # 389 | # restart Run `stop' then `start'. 390 | # 391 | # status Show if ${command} is running, etc. 392 | # 393 | # poll Wait for ${command} to exit. 394 | # 395 | # rcvar Display what rc.conf variable is used (if any). 396 | # 397 | # Variables available to methods, and after run_rc_command() has 398 | # completed: 399 | # 400 | # Variable Purpose 401 | # -------- ------- 402 | # rc_arg Argument to command, after fast/force processing 403 | # performed 404 | # 405 | # rc_flags Flags to start the default command with. 406 | # Defaults to ${name}_flags, unless overridden 407 | # by $flags from the environment. 408 | # This variable may be changed by the precmd method. 409 | # 410 | # rc_pid PID of command (if appropriate) 411 | # 412 | # rc_fast Not empty if "fast" was provided (q.v.) 413 | # 414 | # rc_force Not empty if "force" was provided (q.v.) 415 | # 416 | # 417 | run_rc_command() 418 | { 419 | rc_arg=$1 420 | if [ -z "$name" ]; then 421 | err 3 'run_rc_command: $name is not set.' 422 | fi 423 | 424 | case "$rc_arg" in 425 | fast*) # "fast" prefix; don't check pid 426 | rc_arg=${rc_arg#fast} 427 | rc_fast=yes 428 | ;; 429 | force*) # "force prefix; always start 430 | rc_arg=${rc_arg#force} 431 | rc_force=yes 432 | if [ -n "${rcvar}" ]; then 433 | eval ${rcvar}=YES 434 | fi 435 | ;; 436 | esac 437 | 438 | _keywords="start stop restart rcvar $extra_commands" 439 | rc_pid= 440 | _pidcmd= 441 | _procname=${procname:-${command}} 442 | 443 | # setup pid check command if not fast 444 | if [ -z "$rc_fast" -a -n "$_procname" ]; then 445 | if [ -n "$pidfile" ]; then 446 | _pidcmd='rc_pid=$(check_pidfile '"$pidfile $_procname $command_interpreter"')' 447 | else 448 | _pidcmd='rc_pid=$(check_process '"$_procname $command_interpreter"')' 449 | fi 450 | if [ -n "$_pidcmd" ]; then 451 | _keywords="${_keywords} status poll" 452 | fi 453 | fi 454 | 455 | if [ -z "$rc_arg" ]; then 456 | rc_usage "$_keywords" 457 | fi 458 | 459 | if [ -n "$flags" ]; then # allow override from environment 460 | rc_flags=$flags 461 | else 462 | eval rc_flags=\$${name}_flags 463 | fi 464 | eval _chdir=\$${name}_chdir _chroot=\$${name}_chroot \ 465 | _nice=\$${name}_nice _user=\$${name}_user \ 466 | _group=\$${name}_group _groups=\$${name}_groups \ 467 | _systrace=\$${name}_systrace 468 | 469 | if [ -n "$_user" ]; then # unset $_user if running as that user 470 | if [ "$_user" = "$($_RCCMD_whoami)" ]; then 471 | unset _user 472 | fi 473 | fi 474 | 475 | # if ${rcvar} is set, and $1 is not 476 | # "rcvar", then run 477 | # checkyesno ${rcvar} 478 | # and return if that failed 479 | # 480 | if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" ]; then 481 | if ! checkyesno ${rcvar}; then 482 | return 0 483 | fi 484 | fi 485 | 486 | eval $_pidcmd # determine the pid if necessary 487 | 488 | for _elem in $_keywords; do 489 | if [ "$_elem" != "$rc_arg" ]; then 490 | continue 491 | fi 492 | 493 | # if there's a custom ${XXX_cmd}, 494 | # run that instead of the default 495 | # 496 | eval _cmd=\$${rc_arg}_cmd _precmd=\$${rc_arg}_precmd \ 497 | _postcmd=\$${rc_arg}_postcmd 498 | if [ -n "$_cmd" ]; then 499 | # if the precmd failed and force 500 | # isn't set, exit 501 | # 502 | if ! eval $_precmd && [ -z "$rc_force" ]; then 503 | return 1 504 | fi 505 | 506 | if ! eval $_cmd && [ -z "$rc_force" ]; then 507 | return 1 508 | fi 509 | eval $_postcmd 510 | return 0 511 | fi 512 | 513 | case "$rc_arg" in # default operations... 514 | 515 | status) 516 | if [ -n "$rc_pid" ]; then 517 | ${_RCCMD_echo} \ 518 | "${name} is running as pid $rc_pid." 519 | else 520 | ${_RCCMD_echo} "${name} is not running." 521 | return 1 522 | fi 523 | ;; 524 | 525 | start) 526 | if [ -n "$rc_pid" ]; then 527 | ${_RCCMD_echo} \ 528 | "${name} already running? (pid=$rc_pid)." 529 | exit 1 530 | fi 531 | 532 | if [ ! -x ${_chroot}${command} ]; then 533 | return 0 534 | fi 535 | 536 | # check for required variables, 537 | # directories, and files 538 | # 539 | for _f in $required_vars; do 540 | if ! checkyesno $_f; then 541 | warn "\$${_f} is not set." 542 | if [ -z "$rc_force" ]; then 543 | return 1 544 | fi 545 | fi 546 | done 547 | for _f in $required_dirs; do 548 | if [ ! -d "${_f}/." ]; then 549 | warn "${_f} is not a directory." 550 | if [ -z "$rc_force" ]; then 551 | return 1 552 | fi 553 | fi 554 | done 555 | for _f in $required_files; do 556 | if [ ! -r "${_f}" ]; then 557 | warn "${_f} is not readable." 558 | if [ -z "$rc_force" ]; then 559 | return 1 560 | fi 561 | fi 562 | done 563 | 564 | # if the precmd failed and force 565 | # isn't set, exit 566 | # 567 | if ! eval $_precmd && [ -z "$rc_force" ]; then 568 | return 1 569 | fi 570 | 571 | # setup the command to run, and run it 572 | # 573 | ${_RCCMD_echo} "Starting ${name}." 574 | if [ -n "$_chroot" ]; then 575 | if [ "$_osname" = "SunOS" ]; then 576 | _doit="\ 577 | ${_nice:+${_RCCMD_nice} -n $_nice }\ 578 | ${_RCCMD_chroot} $_chroot" 579 | if [ -n "$_user" ]; then 580 | _doit="\ 581 | $_doit ${_RCCMD_su} ${_RCARG_su} $_user \ 582 | -c '${_RCCMD_sh} -c'" 583 | fi 584 | _doit="\ 585 | $_doit $command $rc_flags $command_args" 586 | else 587 | _doit="\ 588 | ${_nice:+${_RCCMD_nice} -n $_nice }\ 589 | ${_systrace:+${_RCCMD_systrace} $_systrace }\ 590 | ${_RCCMD_chroot} ${_user:+-u $_user }${_group:+-g $_group }\ 591 | ${_groups:+-G $_groups } $_chroot $command $rc_flags $command_args" 592 | fi 593 | else 594 | _doit="\ 595 | ${_chdir:+cd $_chdir; }\ 596 | ${_nice:+${_RCCMD_nice} -n $_nice }\ 597 | ${_systrace:+${_RCCMD_systrace} $_systrace }\ 598 | $command $rc_flags $command_args" 599 | if [ -n "$_user" ]; then 600 | _doit="${_RCCMD_su} ${_RCARG_su} $_user \ 601 | -c '${_RCCMD_sh} -c \"$_doit\"'" 602 | fi 603 | fi 604 | 605 | # if the cmd failed and force 606 | # isn't set, exit 607 | # 608 | if ! eval $_doit && [ -z "$rc_force" ]; then 609 | return 1 610 | fi 611 | 612 | # finally, run postcmd 613 | # 614 | eval $_postcmd 615 | ;; 616 | 617 | stop) 618 | if [ -z "$rc_pid" ]; then 619 | if [ -n "$pidfile" ]; then 620 | ${_RCCMD_echo} \ 621 | "${name} not running? (check $pidfile)." 622 | else 623 | ${_RCCMD_echo} "${name} not running?" 624 | fi 625 | exit 1 626 | fi 627 | 628 | # if the precmd failed and force 629 | # isn't set, exit 630 | # 631 | if ! eval $_precmd && [ -z "$rc_force" ]; then 632 | return 1 633 | fi 634 | 635 | # send the signal to stop 636 | # 637 | ${_RCCMD_echo} "Stopping ${name}." 638 | _doit="${_RCCMD_kill} -${sig_stop:-TERM} $rc_pid" 639 | if [ -n "$_user" ]; then 640 | _doit="${_RCCMD_su} ${_RCARG_su} $_user \ 641 | -c '${_RCCMD_sh} -c \"$_doit\"'" 642 | fi 643 | 644 | # if the stop cmd failed and force 645 | # isn't set, exit 646 | # 647 | if ! eval $_doit && [ -z "$rc_force" ]; then 648 | return 1 649 | fi 650 | 651 | # wait for the command to exit, 652 | # and run postcmd. 653 | wait_for_pids $rc_pid 654 | eval $_postcmd 655 | ;; 656 | 657 | reload) 658 | if [ -z "$rc_pid" ]; then 659 | if [ -n "$pidfile" ]; then 660 | ${_RCCMD_echo} \ 661 | "${name} not running? (check $pidfile)." 662 | else 663 | ${_RCCMD_echo} "${name} not running?" 664 | fi 665 | exit 1 666 | fi 667 | ${_RCCMD_echo} "Reloading ${name} config files." 668 | if ! eval $_precmd && [ -z "$rc_force" ]; then 669 | return 1 670 | fi 671 | _doit="${_RCCMD_kill} -${sig_reload:-HUP} $rc_pid" 672 | if [ -n "$_user" ]; then 673 | _doit="${_RCCMD_su} ${_RCARG_su} $_user -c '${_RCCMD_sh} -c \"$_doit\"'" 674 | fi 675 | if ! eval $_doit && [ -z "$rc_force" ]; then 676 | return 1 677 | fi 678 | eval $_postcmd 679 | ;; 680 | 681 | restart) 682 | if ! eval $_precmd && [ -z "$rc_force" ]; then 683 | return 1 684 | fi 685 | # prevent restart being called more 686 | # than once by any given script 687 | # 688 | if ${_rc_restart_done:-false}; then 689 | return 0 690 | fi 691 | _rc_restart_done=true 692 | 693 | ( $0 ${rc_force:+force}stop ) 694 | $0 ${rc_force:+force}start 695 | 696 | eval $_postcmd 697 | ;; 698 | 699 | poll) 700 | if [ -n "$rc_pid" ]; then 701 | wait_for_pids $rc_pid 702 | fi 703 | ;; 704 | 705 | rcvar) 706 | ${_RCCMD_echo} "# $name" 707 | if [ -n "$rcvar" ]; then 708 | if checkyesno ${rcvar}; then 709 | ${_RCCMD_echo} "\$${rcvar}=YES" 710 | else 711 | ${_RCCMD_echo} "\$${rcvar}=NO" 712 | fi 713 | fi 714 | ;; 715 | 716 | *) 717 | rc_usage "$_keywords" 718 | ;; 719 | 720 | esac 721 | return 0 722 | done 723 | 724 | ${_RCCMD_echo} 1>&2 "$0: unknown directive '$rc_arg'." 725 | rc_usage "$_keywords" 726 | exit 1 727 | } 728 | 729 | # 730 | # run_rc_script file arg 731 | # Start the script `file' with `arg', and correctly handle the 732 | # return value from the script. If `file' ends with `.sh', it's 733 | # sourced into the current environment. If `file' appears to be 734 | # a backup or scratch file, ignore it. Otherwise if it's 735 | # executable run as a child process. 736 | # 737 | run_rc_script() 738 | { 739 | _file=$1 740 | _arg=$2 741 | if [ -z "$_file" -o -z "$_arg" ]; then 742 | err 3 'USAGE: run_rc_script file arg' 743 | fi 744 | 745 | unset name command command_args command_interpreter \ 746 | extra_commands pidfile procname \ 747 | rcvar required_dirs required_files required_vars 748 | eval unset ${_arg}_cmd ${_arg}_precmd ${_arg}_postcmd 749 | 750 | case "$_file" in 751 | *.sh) # run in current shell 752 | set $_arg ; . $_file 753 | ;; 754 | *[~#]|*.OLD|*.orig) # scratch file; skip 755 | warn "Ignoring scratch file $_file" 756 | ;; 757 | *) # run in subshell 758 | if [ -x $_file ]; then 759 | if [ -n "$rc_fast_and_loose" ]; then 760 | set $_arg ; . $_file 761 | else 762 | ( set $_arg ; . $_file ) 763 | fi 764 | fi 765 | ;; 766 | esac 767 | } 768 | 769 | # 770 | # load_rc_config 771 | # Source in the configuration file for a given command. 772 | # 773 | load_rc_config() 774 | { 775 | _command=$1 776 | if [ -z "$_command" ]; then 777 | err 3 'USAGE: load_rc_config command' 778 | fi 779 | 780 | if ${_rc_conf_loaded:-false}; then 781 | : 782 | else 783 | . /etc/rc.conf 784 | _rc_conf_loaded=true 785 | fi 786 | if [ -f /etc/rc.conf.d/"$_command" ]; then 787 | . /etc/rc.conf.d/"$_command" 788 | fi 789 | } 790 | 791 | 792 | # 793 | # rc_usage commands 794 | # Print a usage string for $0, with `commands' being a list of 795 | # valid commands. 796 | # 797 | rc_usage() 798 | { 799 | ${_RCCMD_echo} -n 1>&2 "Usage: $0 [fast|force](" 800 | 801 | _sep= 802 | for _elem; do 803 | ${_RCCMD_echo} -n 1>&2 "$_sep$_elem" 804 | _sep="|" 805 | done 806 | ${_RCCMD_echo} 1>&2 ")" 807 | exit 1 808 | } 809 | 810 | # 811 | # err exitval message 812 | # Display message to stderr and log to the syslog, and exit with exitval. 813 | # 814 | err() 815 | { 816 | exitval=$1 817 | shift 818 | 819 | if [ -x ${_RCCMD_logger} ]; then 820 | ${_RCCMD_logger} "$0: ERROR: $*" 821 | fi 822 | ${_RCCMD_echo} 1>&2 "$0: ERROR: $*" 823 | exit $exitval 824 | } 825 | 826 | # 827 | # warn message 828 | # Display message to stderr and log to the syslog. 829 | # 830 | warn() 831 | { 832 | if [ -x ${_RCCMD_logger} ]; then 833 | ${_RCCMD_logger} "$0: WARNING: $*" 834 | fi 835 | ${_RCCMD_echo} 1>&2 "$0: WARNING: $*" 836 | } 837 | 838 | # 839 | # backup_file action file cur backup 840 | # Make a backup copy of `file' into `cur', and save the previous 841 | # version of `cur' as `backup' or use rcs for archiving. 842 | # 843 | # This routine checks the value of the backup_uses_rcs variable, 844 | # which can be either YES or NO. 845 | # 846 | # The `action' keyword can be one of the following: 847 | # 848 | # add `file' is now being backed up (and is possibly 849 | # being reentered into the backups system). `cur' 850 | # is created and RCS files, if necessary, are 851 | # created as well. 852 | # 853 | # update `file' has changed and needs to be backed up. 854 | # If `cur' exists, it is copied to to `back' or 855 | # checked into RCS (if the repository file is old), 856 | # and then `file' is copied to `cur'. Another RCS 857 | # check in done here if RCS is being used. 858 | # 859 | # remove `file' is no longer being tracked by the backups 860 | # system. If RCS is not being used, `cur' is moved 861 | # to `back', otherwise an empty file is checked in, 862 | # and then `cur' is removed. 863 | # 864 | # 865 | backup_file() 866 | { 867 | _action=$1 868 | _file=$2 869 | _cur=$3 870 | _back=$4 871 | 872 | if checkyesno backup_uses_rcs; then 873 | _msg0="backup archive" 874 | _msg1="update" 875 | 876 | # ensure that history file is not locked 877 | if [ -f $_cur,v ]; then 878 | ${_RCCMD_rcs} -q -u -U -M $_cur 879 | fi 880 | 881 | # ensure after switching to rcs that the 882 | # current backup is not lost 883 | if [ -f $_cur ]; then 884 | # no archive, or current newer than archive 885 | if [ ! -f $_cur,v -o $_cur -nt $_cur,v ]; then 886 | ${_RCCMD_ci} -q -f -u -t-"$_msg0" \ 887 | -m"$_msg1" $_cur 888 | ${_RCCMD_rcs} -q -kb -U $_cur 889 | ${_RCCMD_co} -q -f -u $_cur 890 | fi 891 | fi 892 | 893 | case $_action in 894 | add|update) 895 | ${_RCCMD_cp} -p $_file $_cur 896 | ${_RCCMD_ci} -q -f -u -t-"$_msg0" -m"$_msg1" $_cur 897 | ${_RCCMD_rcs} -q -kb -U $_cur 898 | ${_RCCMD_co} -q -f -u $_cur 899 | ${_RCCMD_chown} root:wheel $_cur $_cur,v 900 | ;; 901 | remove) 902 | ${_RCCMD_cp} /dev/null $_cur 903 | ${_RCCMD_ci} -q -f -u -t-"$_msg0" -m"$_msg1" $_cur 904 | ${_RCCMD_rcs} -q -kb -U $_cur 905 | ${_RCCMD_chown} root:wheel $_cur $_cur,v 906 | ${_RCCMD_rm} $_cur 907 | ;; 908 | esac 909 | else 910 | case $_action in 911 | add|update) 912 | if [ -f $_cur ]; then 913 | ${_RCCMD_cp} -p $_cur $_back 914 | fi 915 | ${_RCCMD_cp} -p $_file $_cur 916 | ${_RCCMD_chown} root:wheel $_cur 917 | ;; 918 | remove) 919 | ${_RCCMD_mv} -f $_cur $_back 920 | ;; 921 | esac 922 | fi 923 | } 924 | -------------------------------------------------------------------------------- /src/usr/bin/pkgin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "This is the Pür Linux pkgin bootstrapper" 3 | echo "It works similarly to the bootstraper for pkgng on FreeBSD" 4 | echo "This file is located in /usr/bin" 5 | echo "Once it has installed pkgin in /usr/local/bin, it will autoremove itself" 6 | if ls /usr/local/bin | grep -q bmake ;then 7 | echo "Ports already bootstrapped. Updating" 8 | portsnag update 9 | else 10 | echo "Bootstrapping the Ports Tree" 11 | portsnag bootstrap 12 | fi 13 | cd /usr/ports/databases/sqlite3 && make install clean 14 | cd /usr/ports/pkgtools/libnbcompat && make install clean 15 | cd /usr/ports/net/libfetch && make install clean 16 | cd /usr/ports/archivers/libarchive && make install clean 17 | cd /usr/ports/pkgtools/pkgin && make install clean 18 | touch /usr/local/etc/pkgin/repositories.conf 19 | # Add pkgin repo info once the buildhost is up and producing packages. 20 | rm /usr/bin/pkgin 21 | -------------------------------------------------------------------------------- /src/usr/local/etc/mk.conf: -------------------------------------------------------------------------------- 1 | ## Default Pür Linux mk.conf 2 | ## Planned to be stored at /usr/etc/pkgsrcmk.conf and symlinked when portsnag bootstrap is called 3 | ## For now, mk.conf is pulled live from Github. 4 | .ifdef BSD_PKG_MK # begin pkgsrc settings 5 | 6 | 7 | PKG_DBDIR= /usr/local/var/db/pkg 8 | LOCALBASE= /usr/local 9 | VARBASE= /usr/local/var 10 | PKG_TOOLS_BIN= /usr/local/sbin 11 | PKGINFODIR= info 12 | PKGMANDIR= man 13 | 14 | TOOLS_PLATFORM.awk?= /usr/local/bin/nawk 15 | # fetch using wget instead of fetch 16 | FETCH_USING= wget 17 | # Build X11 from pkgsrc since Pür Linux doesn't contain Xorg in Base. 18 | X11_TYPE=modular 19 | # enable automatic management of initscripts for rc.subr in /etc/rc.d 20 | PKG_RCD_SCRIPTS=YES 21 | 22 | .endif # end pkgsrc settin 23 | -------------------------------------------------------------------------------- /src/usr/local/etc/pkgin/repositories.conf: -------------------------------------------------------------------------------- 1 | ## Default /usr/local/etc/pkgin/repositories.conf for Pür Linux 2 | # $Id: repositories.conf,v 1.3 2012/06/13 13:50:17 imilh Exp $ 3 | # 4 | # Pkgin repositories list 5 | # 6 | # Simply add repositories URIs one below the other 7 | # 8 | # WARNING: order matters, duplicates will not be added, if two 9 | # repositories hold the same package, it will be fetched from 10 | # the first one listed in this file. 11 | # 12 | # This file format supports the following macros: 13 | # $arch to define the machine hardware platform 14 | # $osrelease to define the release version for the operating system 15 | # 16 | # Remote ftp repository 17 | # 18 | # ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/$arch/5.1/All 19 | # 20 | # Remote http repository 21 | # 22 | # http://mirror-master.dragonflybsd.org/packages/$arch/DragonFly-$osrelease/stable/All 23 | # 24 | # Local repository (must contain a pkg_summary.gz or bz2) 25 | # 26 | # file:///usr/pkgsrc/packages/All 27 | # 28 | # Default Pür Linux pkgin Repository 29 | http://pkghost1.purlinux.org/packages/$arch/PurLinux/2016.4-RELEASE/All 30 | -------------------------------------------------------------------------------- /src/usr/sbin/portsnag.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Conceptually based on portsnap, from FreeBSD. 4 | # No portsnap code is contained in portsnag. 5 | # I'm not awesome enough to successfully rip off Best OS. 6 | # This script relies on CVS to do the heavy lifting, rather than portsnap's 7 | # inbuilt goodness. 8 | # CVS is included in the base of Pür Linux. 9 | # 10 | # Portsnag replaces portfetch and portupdate for management of 11 | # PürPorts/pkgsrc 12 | # 13 | # This file is located in /usr/sbin/portsnag 14 | # 15 | # Copyright 2016 Pür Linux Project 16 | # Portsnag originally written by Rainbow 17 | # All rights reserved 18 | # 19 | # Redistribution and use in source and binary forms, with or without 20 | # modification, are permitted providing that the following conditions 21 | # are met: 22 | # 1. Redistributions of source code must retain the above copyright 23 | # notice, this list of conditions and the following disclaimer. 24 | # 2. Redistributions in binary form must reproduce the above copyright 25 | # notice, this list of conditions and the following disclaimer in the 26 | # documentation and/or other materials provided with the distribution. 27 | # 28 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 29 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 30 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 32 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 37 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | # POSSIBILITY OF SUCH DAMAGE. 39 | 40 | usage() { 41 | cat <