├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── build.conf.dist ├── builds ├── freenas-11-nightlies │ └── freenas.cfg ├── freenas-11.1-internal │ └── freenas.cfg ├── freenas-11.1-nightlies │ └── freenas.cfg ├── freenas-11.2-internal │ └── freenas.cfg ├── freenas-custom │ └── freenas.cfg ├── freenas-releng-beta │ └── freenas.cfg ├── freenas-releng-rc │ └── freenas.cfg ├── freenas-releng │ └── freenas.cfg ├── freenas-sdk │ └── freenas.cfg ├── freenas │ └── freenas.cfg ├── truenas-11-nightlies │ └── freenas.cfg ├── truenas-11.1-internal │ └── freenas.cfg ├── truenas-11.1-nightlies │ └── freenas.cfg ├── truenas-11.2-internal │ └── freenas.cfg ├── truenas-11.2-nightlies │ └── freenas.cfg ├── truenas-custom │ └── freenas.cfg └── truenas-releng │ └── freenas.cfg ├── freenas ├── Makefile ├── atf │ ├── README │ └── rc.local ├── freenas.cfg.dist └── scripts │ ├── 1.buildiso.sh │ ├── build-iso.sh │ ├── checkprogs.sh │ ├── create-auto-install.sh │ ├── functions-tests.sh │ ├── functions.sh │ └── kludges │ ├── build_jail.sh │ ├── install-info │ ├── makeinfo │ ├── mklocale │ └── mtree ├── functions.sh ├── iocage ├── iocage-ports ├── port-options.conf └── run-poudriere.sh ├── jenkins.sh ├── prepnode ├── freenas-update.conf ├── mknode.sh ├── sudo-ixbuild └── truenas-update.conf └── trueos ├── Makefile ├── kludges └── boot1.efifat ├── pbi-dist ├── pkgng-repo └── repokey.ssl ├── pkg-dist ├── fingerprints │ └── trueos │ │ └── trusted │ │ └── pkg.cdn.pcbsd.org.20131209 └── repos │ └── trueos.conf.dist ├── repo.conf.dist ├── scripts ├── 1.createworld.sh ├── 9.3.makedvd.sh ├── 9.4.makenetiso.sh ├── 9.6.makenetfiles.sh ├── 9.7.makevbox.sh ├── 9.freesbie.sh ├── build-iso.sh ├── checkprogs.sh ├── functions.sh ├── menu.sh ├── mergesvnports ├── portbuild.sh └── pre-installs │ ├── gettytab │ ├── trueos-desktop.cfg │ ├── trueos-server.cfg │ └── ttys └── trueos.cfg.dist /.gitignore: -------------------------------------------------------------------------------- 1 | /build.conf 2 | /freenas/freenas.cfg 3 | __pycache__ 4 | *.xml 5 | *.pyc 6 | .cache 7 | config.py 8 | auto_config.py 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, iXsystems 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #Makefile for prepping a new jenkins node 2 | ############################################################################# 3 | 4 | ####### Prep 5 | 6 | jenkins: 7 | @cd ${.CURDIR}/prepnode/ && sh mknode.sh 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* 4 | 5 | - [Jenkins build framework for iX projects](#jenkins-build-framework-for-ix-projects) 6 | - [Requirements](#requirements) 7 | - [Getting Started](#getting-started) 8 | - [Use Jenkins FreeNAS or TrueNAS update servers (iX Internal only)](#use-jenkins-freenas-or-truenas-update-servers-ix-internal-only) 9 | 10 | 11 | 12 | Jenkins automation framework for iX projects 13 | =========== 14 | 15 | The scripts in this repo will allow you to build TrueOS or FreeNAS, either 16 | as an automated job from Jenkins or manually. It includes support to build 17 | the following: 18 | 19 | * FreeNAS 20 | * TrueOS 21 | * iocage 22 | 23 | 24 | Requirements 25 | ============ 26 | 27 | A system running TrueOS, with at minimum 16GB of memory. 28 | (Building TrueOS packages in a reasonable time works best with 48GB or more) 29 | 30 | Recommended: 31 | * CPU: 8 Cores or more 32 | * Memory: 16GB (For FreeNAS) 48GB (For TrueOS) 33 | * Disk: 20GB (For FreeNAS) 200GB (For TrueOS) 34 | 35 | [TrueOS Download Site](http://download.trueos.org/master/amd64/) 36 | 37 | 38 | Getting Started 39 | ============ 40 | 41 | To prep a new system for building, first download the repo and install with 42 | the following: 43 | 44 | ``` 45 | % git clone --depth=1 https://github.com/iXsystems/ixbuild.git 46 | % cd ixbuild 47 | % sudo make jenkins 48 | ``` 49 | 50 | During the installation you will be asked if you want to make this a "node" or "master", 51 | the "master" setup will install and configure Jenkins. If you already have Jenkins 52 | installed, using the "node" setup will prep the system to act as new builder for 53 | your existing Jenkins service. 54 | 55 | Once a new "master" is deployed, you can access your Jenkins interface from: 56 | 57 | [http://localhost:8180/jenkins/](http://localhost:8180/jenkins/) 58 | 59 | Setting options for jenkins 60 | ============ 61 | 62 | A few common options for FreeNAS builds: 63 | ``` 64 | export BUILDINCREMENTAL=true 65 | export ARTIFACTONFAIL=yes 66 | export ARTIFACTONSUCCESS=yes 67 | ``` 68 | 69 | For more options see: 70 | 71 | https://github.com/iXsystems/ixbuild/blob/master/build.conf.dist 72 | 73 | Build iX projects with jenkins 74 | ============ 75 | 76 | FreeNAS 77 | ``` 78 | sudo /ixbuild/jenkins.sh freenas freenas-11-nightlies 79 | ``` 80 | TrueOS 81 | ``` 82 | sudo /ixbuild/jenkins.sh trueos-world trueos-current production 83 | sudo /ixbuild/jenkins.sh trueos-pkg trueos-current production 84 | sudo /ixbuild/jenkins.sh trueos-iso-pkg trueos-current production 85 | sudo /ixbuild/jenkins.sh trueos-iso trueos-current production 86 | ``` 87 | iocage 88 | ``` 89 | sudo /ixbuild/jenkins.sh iocage_pkgs 90 | ``` 91 | 92 | Use Jenkins FreeNAS or TrueNAS update servers (iX Internal only) 93 | ======= 94 | 95 | If you are on the iXsystems corporate network you can switch to using 96 | the FreeNAS or TrueNAS update servers with the following files: 97 | 98 | https://github.com/iXsystems/ixbuild/blob/master/prepnode/truenas-update.conf 99 | 100 | https://github.com/iXsystems/ixbuild/blob/master/prepnode/freenas-update.conf 101 | 102 | Simply download and rename the file to "update.conf" and upload it to the /data/ 103 | directory on your FreeNAS or TrueNAS box. The next time you check for updates it 104 | will begin pulling from the Jenkins builds. 105 | -------------------------------------------------------------------------------- /build.conf.dist: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # Generic settings 3 | ########################################################################### 4 | 5 | # User / hostname to ssh / sftp into for storing work and finished builds 6 | # (Optional) 7 | SFTPUSER="" 8 | SFTPHOST="" 9 | export SFTPUSER SFTPHOST 10 | 11 | # Set the remote dirs to store finshed ISO/PKGS 12 | # (Optional) 13 | SFTPFINALDIR="" 14 | export SFTPFINALDIR 15 | 16 | # Set the remote dir to use for storing temp build data 17 | # (Optional) 18 | SFTPWORKDIR="" 19 | export SFTPWORKDIR 20 | 21 | # Select which branch of ixbuild repo testing framework to use 22 | # (Optional) 23 | # IXBUILDBRANCH="" 24 | # export IXBUILDBRANCH 25 | 26 | ########################################################################### 27 | # TrueOS specific settings 28 | ########################################################################### 29 | 30 | # Set PBI signing key 31 | # This key is used to sign your PBI repo 32 | PBI_REPO_KEY="" 33 | export PBI_REPO_KEY 34 | 35 | # Command used in 'pkg repo' to sign (I.E. signing_command: ) 36 | PKGSIGNCMD="" 37 | export PKGSIGNCMD 38 | -------------------------------------------------------------------------------- /builds/freenas-11-nightlies/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | GITFNASURL="https://github.com/freenas/build.git" 6 | export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | GITFNASBRANCH="master" 11 | export GITFNASBRANCH 12 | 13 | # Set location for release to be stored 14 | TARGETREL="freenas" 15 | export TARGETREL 16 | 17 | # This is a 9.10 build, Legacy middleware + new build 18 | FREENASLEGACY="910" 19 | export FREENASLEGACY 20 | 21 | # Set which MILESTONE to set 22 | BUILDOPTS="PROFILE=freenas TRAIN=FreeNAS-11-Nightlies" 23 | export BUILDOPTS 24 | -------------------------------------------------------------------------------- /builds/freenas-11.1-internal/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | GITFNASURL="https://github.com/freenas/build.git" 6 | export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | GITFNASBRANCH="freenas/11.1-stable" 11 | export GITFNASBRANCH 12 | 13 | # Set location for release to be stored 14 | TARGETREL="freenas-11.1-internal" 15 | export TARGETREL 16 | 17 | # This is a 9.10 build, Legacy middleware + new build 18 | FREENASLEGACY="910" 19 | export FREENASLEGACY 20 | 21 | # Set which MILESTONE to set 22 | BUILDOPTS="PROFILE=freenas PRODUCTION=yes" 23 | export BUILDOPTS 24 | 25 | # Disable the shallow checkout of sources 26 | DISABLE_SHALLOW_CHECKOUT="YES" 27 | export DISABLE_SHALLOW_CHECKOUT 28 | -------------------------------------------------------------------------------- /builds/freenas-11.1-nightlies/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | GITFNASURL="https://github.com/freenas/build.git" 6 | export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | GITFNASBRANCH="freenas/11.1-stable" 11 | export GITFNASBRANCH 12 | 13 | # Set location for release to be stored 14 | TARGETREL="freenas-11.1-nightlies" 15 | export TARGETREL 16 | 17 | # This is a 9.10 build, Legacy middleware + new build 18 | FREENASLEGACY="910" 19 | export FREENASLEGACY 20 | 21 | # Set which MILESTONE to set 22 | BUILDOPTS="PROFILE=freenas TRAIN=FreeNAS-11.1-Nightlies" 23 | export BUILDOPTS 24 | 25 | # Pushing only internal 26 | FREENAS_KEYFILE="/dev/null" 27 | export FREENAS_KEYFILE 28 | -------------------------------------------------------------------------------- /builds/freenas-11.2-internal/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | GITFNASURL="https://github.com/freenas/build.git" 6 | export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | GITFNASBRANCH="freenas/11.2-stable" 11 | export GITFNASBRANCH 12 | 13 | # Set location for release to be stored 14 | TARGETREL="freenas-11.2-internal" 15 | export TARGETREL 16 | 17 | # This is a 9.10 build, Legacy middleware + new build 18 | FREENASLEGACY="910" 19 | export FREENASLEGACY 20 | 21 | # Set which MILESTONE to set 22 | BUILDOPTS="PROFILE=freenas PRODUCTION=yes" 23 | export BUILDOPTS 24 | 25 | # Disable the shallow checkout of sources 26 | DISABLE_SHALLOW_CHECKOUT="YES" 27 | export DISABLE_SHALLOW_CHECKOUT 28 | -------------------------------------------------------------------------------- /builds/freenas-custom/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | # GITFNASURL="https://github.com/freenas/build.git" 6 | # export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | # GITFNASBRANCH=${CHECKOUT_TAG} 11 | # export GITFNASBRANCH 12 | export SKIP_CHECKOUT="YES" 13 | export BUILDINCREMENTAL="true" 14 | 15 | # Set location for release to be stored 16 | TARGETREL="truenas-custom" 17 | export TARGETREL 18 | 19 | # This is a 9.10 build, Legacy middleware + new build 20 | FREENASLEGACY="910" 21 | export FREENASLEGACY 22 | 23 | # Set which MILESTONE to set 24 | BUILDOPTS="PROFILE=freenas PRODUCTION=yes" 25 | export BUILDOPTS 26 | 27 | # Disable the shallow checkout of sources 28 | DISABLE_SHALLOW_CHECKOUT="YES" 29 | export DISABLE_SHALLOW_CHECKOUT 30 | -------------------------------------------------------------------------------- /builds/freenas-releng-beta/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | GITFNASURL="https://github.com/freenas/build.git" 6 | export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | GITFNASBRANCH=${CHECKOUT_TAG} 11 | export GITFNASBRANCH 12 | 13 | # Set location for release to be stored 14 | TARGETREL="freenas-releng-beta" 15 | export TARGETREL 16 | 17 | # This is a 9.10 build, Legacy middleware + new build 18 | FREENASLEGACY="910" 19 | export FREENASLEGACY 20 | 21 | # Set which MILESTONE to set 22 | BUILDOPTS="PROFILE=freenas PRODUCTION=yes TRAIN=FreeNAS-11.3-BETA" 23 | export BUILDOPTS 24 | 25 | # Disable the shallow checkout of sources 26 | DISABLE_SHALLOW_CHECKOUT="YES" 27 | export DISABLE_SHALLOW_CHECKOUT 28 | -------------------------------------------------------------------------------- /builds/freenas-releng-rc/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | GITFNASURL="https://github.com/freenas/build.git" 6 | export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | GITFNASBRANCH=${CHECKOUT_TAG} 11 | export GITFNASBRANCH 12 | 13 | # Set location for release to be stored 14 | TARGETREL="freenas-releng-rc" 15 | export TARGETREL 16 | 17 | # This is a 9.10 build, Legacy middleware + new build 18 | FREENASLEGACY="910" 19 | export FREENASLEGACY 20 | 21 | # Set which MILESTONE to set 22 | BUILDOPTS="PROFILE=freenas PRODUCTION=yes TRAIN=FreeNAS-11.3-RC" 23 | export BUILDOPTS 24 | 25 | # Disable the shallow checkout of sources 26 | DISABLE_SHALLOW_CHECKOUT="YES" 27 | export DISABLE_SHALLOW_CHECKOUT 28 | -------------------------------------------------------------------------------- /builds/freenas-releng/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | GITFNASURL="https://github.com/freenas/build.git" 6 | export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | GITFNASBRANCH=${CHECKOUT_TAG} 11 | export GITFNASBRANCH 12 | 13 | # Set location for release to be stored 14 | TARGETREL="freenas-releng" 15 | export TARGETREL 16 | 17 | # This is a 9.10 build, Legacy middleware + new build 18 | FREENASLEGACY="910" 19 | export FREENASLEGACY 20 | 21 | # Set which MILESTONE to set 22 | BUILDOPTS="PROFILE=freenas PRODUCTION=yes" 23 | export BUILDOPTS 24 | 25 | # Disable the shallow checkout of sources 26 | DISABLE_SHALLOW_CHECKOUT="YES" 27 | export DISABLE_SHALLOW_CHECKOUT 28 | -------------------------------------------------------------------------------- /builds/freenas-sdk/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | GITFNASURL="https://github.com/freenas/build.git" 6 | export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | GITFNASBRANCH="master" 11 | export GITFNASBRANCH 12 | 13 | # Set location for release to be stored 14 | TARGETREL="freenas-sdk" 15 | export TARGETREL 16 | 17 | # This is a 9.10 build, Legacy middleware + new build 18 | FREENASLEGACY="910" 19 | export FREENASLEGACY 20 | 21 | # Set which MILESTONE to set 22 | BUILDOPTS="PROFILE=freenas TRAIN=FreeNAS-11-Nightlies-SDK BUILD_SDK=yes" 23 | export BUILDOPTS 24 | -------------------------------------------------------------------------------- /builds/freenas/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | GITFNASURL="https://github.com/freenas/build.git" 6 | export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | GITFNASBRANCH="master" 11 | export GITFNASBRANCH 12 | 13 | # Set location for release to be stored 14 | TARGETREL="freenas" 15 | export TARGETREL 16 | 17 | # This is a 9.10 build, Legacy middleware + new build 18 | FREENASLEGACY="910" 19 | export FREENASLEGACY 20 | 21 | # Set which MILESTONE to set 22 | BUILDOPTS="PROFILE=freenas TRAIN=FreeNAS-11-Nightlies" 23 | export BUILDOPTS 24 | -------------------------------------------------------------------------------- /builds/truenas-11-nightlies/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | GITFNASURL="https://github.com/freenas/build.git" 6 | export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | GITFNASBRANCH="master" 11 | export GITFNASBRANCH 12 | 13 | # Set location for release to be stored 14 | TARGETREL="truenas-11-nightlies" 15 | export TARGETREL 16 | 17 | # This is a 9.10 build, Legacy middleware + new build 18 | FREENASLEGACY="910" 19 | export FREENASLEGACY 20 | 21 | # Set which MILESTONE to set 22 | BUILDOPTS="PROFILE=freenas PRODUCT=TrueNAS TRAIN=TrueNAS-11-Nightlies" 23 | export BUILDOPTS 24 | 25 | # Pushing only internal 26 | FREENAS_KEYFILE="/dev/null" 27 | export FREENAS_KEYFILE 28 | -------------------------------------------------------------------------------- /builds/truenas-11.1-internal/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | GITFNASURL="https://github.com/freenas/build.git" 6 | export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | GITFNASBRANCH="freenas/11.1-stable" 11 | export GITFNASBRANCH 12 | 13 | # Set location for release to be stored 14 | TARGETREL="truenas-11.1-internal" 15 | export TARGETREL 16 | 17 | # This is a 9.10 build, Legacy middleware + new build 18 | FREENASLEGACY="910" 19 | export FREENASLEGACY 20 | 21 | # Set which MILESTONE to set 22 | BUILDOPTS="PROFILE=freenas PRODUCTION=yes PRODUCT=TrueNAS" 23 | export BUILDOPTS 24 | 25 | # Disable the shallow checkout of sources 26 | DISABLE_SHALLOW_CHECKOUT="YES" 27 | export DISABLE_SHALLOW_CHECKOUT 28 | -------------------------------------------------------------------------------- /builds/truenas-11.1-nightlies/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | GITFNASURL="https://github.com/freenas/build.git" 6 | export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | GITFNASBRANCH="freenas/11.1-stable" 11 | export GITFNASBRANCH 12 | 13 | # Set location for release to be stored 14 | TARGETREL="truenas-11.1-nightlies" 15 | export TARGETREL 16 | 17 | # This is a 9.10 build, Legacy middleware + new build 18 | FREENASLEGACY="910" 19 | export FREENASLEGACY 20 | 21 | # Set which MILESTONE to set 22 | BUILDOPTS="PROFILE=freenas PRODUCT=TrueNAS TRAIN=TrueNAS-11.1-Nightlies" 23 | export BUILDOPTS 24 | 25 | # Pushing only internal 26 | FREENAS_KEYFILE="/dev/null" 27 | export FREENAS_KEYFILE 28 | 29 | -------------------------------------------------------------------------------- /builds/truenas-11.2-internal/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | GITFNASURL="https://github.com/freenas/build.git" 6 | export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | GITFNASBRANCH="freenas/11.2-stable" 11 | export GITFNASBRANCH 12 | 13 | # Set location for release to be stored 14 | TARGETREL="truenas-11.2-internal" 15 | export TARGETREL 16 | 17 | # This is a 9.10 build, Legacy middleware + new build 18 | FREENASLEGACY="910" 19 | export FREENASLEGACY 20 | 21 | # Set which MILESTONE to set 22 | BUILDOPTS="PROFILE=freenas PRODUCTION=yes PRODUCT=TrueNAS" 23 | export BUILDOPTS 24 | 25 | # Disable the shallow checkout of sources 26 | DISABLE_SHALLOW_CHECKOUT="YES" 27 | export DISABLE_SHALLOW_CHECKOUT 28 | -------------------------------------------------------------------------------- /builds/truenas-11.2-nightlies/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | GITFNASURL="https://github.com/freenas/build.git" 6 | export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | GITFNASBRANCH="freenas/11.2-stable" 11 | export GITFNASBRANCH 12 | 13 | # Set location for release to be stored 14 | TARGETREL="truenas-11.2-nightlies" 15 | export TARGETREL 16 | 17 | # This is a 9.10 build, Legacy middleware + new build 18 | FREENASLEGACY="910" 19 | export FREENASLEGACY 20 | 21 | # Exporting time stamp manually 22 | export BUILD_TIMESTAMP=`date -u '+%Y%m%d%H%M'` 23 | 24 | # Set which MILESTONE to set 25 | BUILDOPTS="PROFILE=freenas PRODUCT=TrueNAS TRAIN=TrueNAS-11.2-Nightlies VERSION=11.2-MASTER-${BUILD_TIMESTAMP}" 26 | export BUILDOPTS 27 | 28 | # Pushing only internal 29 | FREENAS_KEYFILE="/dev/null" 30 | export FREENAS_KEYFILE 31 | -------------------------------------------------------------------------------- /builds/truenas-custom/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | # GITFNASURL="https://github.com/freenas/build.git" 6 | # export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | # GITFNASBRANCH=${CHECKOUT_TAG} 11 | # export GITFNASBRANCH 12 | export SKIP_CHECKOUT="YES" 13 | export BUILDINCREMENTAL="true" 14 | 15 | # Set location for release to be stored 16 | TARGETREL="truenas-custom" 17 | export TARGETREL 18 | 19 | # This is a 9.10 build, Legacy middleware + new build 20 | FREENASLEGACY="910" 21 | export FREENASLEGACY 22 | 23 | # Set which MILESTONE to set 24 | BUILDOPTS="PROFILE=freenas PRODUCTION=yes PRODUCT=TrueNAS" 25 | export BUILDOPTS 26 | 27 | # Disable the shallow checkout of sources 28 | DISABLE_SHALLOW_CHECKOUT="YES" 29 | export DISABLE_SHALLOW_CHECKOUT 30 | -------------------------------------------------------------------------------- /builds/truenas-releng/freenas.cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | GITFNASURL="https://github.com/freenas/build.git" 6 | export GITFNASURL 7 | 8 | # Branch of the FreeNAS repo to build with 9 | # Available (freenas10) 10 | GITFNASBRANCH=${CHECKOUT_TAG} 11 | export GITFNASBRANCH 12 | 13 | # Set location for release to be stored 14 | TARGETREL="truenas-releng" 15 | export TARGETREL 16 | 17 | # This is a 9.10 build, Legacy middleware + new build 18 | FREENASLEGACY="910" 19 | export FREENASLEGACY 20 | 21 | # Set which MILESTONE to set 22 | BUILDOPTS="PROFILE=freenas PRODUCTION=yes PRODUCT=TrueNAS" 23 | export BUILDOPTS 24 | 25 | # Disable the shallow checkout of sources 26 | DISABLE_SHALLOW_CHECKOUT="YES" 27 | export DISABLE_SHALLOW_CHECKOUT 28 | -------------------------------------------------------------------------------- /freenas/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | # Makefile for building: FreeNAS 3 | ############################################################################# 4 | 5 | ####### Install 6 | 7 | all: 8 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh all 9 | image: 10 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh iso 11 | iso: 12 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh iso 13 | api: 14 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh api 15 | docs: 16 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh doc 17 | -------------------------------------------------------------------------------- /freenas/atf/README: -------------------------------------------------------------------------------- 1 | This is a directory copied into FreeNAS during installation 2 | for automated testing of features and regression testing 3 | 4 | The rc.local script will be executed automatically at startup, 5 | and scripts in this directory may be called from it at the 6 | /atf/ location. 7 | -------------------------------------------------------------------------------- /freenas/atf/rc.local: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | TERM="cons25" 3 | PATH="${PATH}:/usr/local/bin:/usr/local/sbin" 4 | 5 | clear 6 | 7 | if [ -e "/etc/netcli" ] ; then 8 | echo "FreeNAS 9 detected.." 9 | 10 | # Check for license 11 | if [ -e "/atf/truenas-license" ] ; then 12 | echo "Installing TrueNAS license..." 13 | cp /atf/truenas-license /data/license 14 | fi 15 | 16 | # Set the default password for 9.x 17 | echo "Setting ROOT password for REST" 18 | /etc/netcli reset_root_pw "testing" 19 | 20 | # Check if we are running in virtualbox 21 | /sbin/ifconfig em0 2>/dev/null >/dev/null 22 | if [ $? -eq 0 ] ; then 23 | /sbin/ifconfig em0 %%IP%% 255.255.255.0 24 | /sbin/dhclient em1 25 | fi 26 | 27 | # Check if we are running in bhyve 28 | /sbin/ifconfig vtnet0 2>/dev/null >/dev/null 29 | if [ $? -eq 0 ] ; then 30 | /sbin/ifconfig vtnet0 %%IP%% 255.255.255.0 31 | fi 32 | 33 | # Display ifconfig settings 34 | /sbin/ifconfig 35 | 36 | # Nuke this file, don't need it after reboot 37 | #echo "" > /conf/default/etc/rc.local 38 | else 39 | echo "FreeNAS 10 detected.." 40 | # Set the IP address we will use for testing 41 | echo "Changing IP address for REST" 42 | /sbin/ifconfig em0 %%IP%% 255.255.255.0 43 | /sbin/dhclient em1 44 | fi 45 | 46 | 47 | sleep 2 48 | -------------------------------------------------------------------------------- /freenas/freenas.cfg.dist: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Which FreeNAS git URL to clone 5 | # For 9.x 6 | GITFNASURL="https://github.com/freenas/freenas.git" 7 | export GITFNASURL 8 | 9 | # Branch of the FreeNAS repo to build with 10 | # Available (master|development) 11 | # For 9.x 12 | GITFNASBRANCH="master" 13 | export GITFNASBRANCH 14 | 15 | # Set location for release to be stored when using Jenkins builds 16 | TARGETREL="freenas-9.10" 17 | export TARGETREL 18 | 19 | # Set that this is a legacy 9.X build 20 | FREENASLEGACY="YES" 21 | export FREENASLEGACY 22 | -------------------------------------------------------------------------------- /freenas/scripts/1.buildiso.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Where is the pcbsd-build program installed 4 | PROGDIR="`realpath | sed 's|/scripts||g'`" ; export PROGDIR 5 | 6 | # Source the config file 7 | . ${PROGDIR}/freenas.cfg 8 | 9 | cd ${PROGDIR}/scripts 10 | 11 | # Source our functions 12 | . ${PROGDIR}/scripts/functions.sh 13 | . ${PROGDIR}/scripts/functions-tests.sh 14 | 15 | # Look through the output log and try to determine the failure 16 | parse_checkout_error() 17 | { 18 | ### TODO - Add error detection of checkout failures 19 | echo '' > ${LOUT} 20 | } 21 | 22 | # Look through the output log and try to determine the failure 23 | parse_build_error() 24 | { 25 | echo '' > ${LOUT} 26 | export TESTSTDERR=${LOUT} 27 | 28 | # Look for some of the common error messages 29 | 30 | # port failed to compile 31 | grep -q "ERROR: Packages installation failed" ${1} 32 | if [ $? -eq 0 ] ; then 33 | grep "====>> Failed" ${1} >> ${LOUT} 34 | grep "====>> Skipped" ${1} >> ${LOUT} 35 | grep "====>> Ignored" ${1} >> ${LOUT} 36 | return 0 37 | fi 38 | 39 | ### TODO - Add various error detection as they occur 40 | 41 | # Look for generic error 42 | grep -q "^ERROR: " ${1} 43 | if [ $? -eq 0 ] ; then 44 | # Use the search function to get some context 45 | ${PROGDIR}/../utils/search -s5 "ERROR: " ${1} >>${LOUT} 46 | return 0 47 | fi 48 | } 49 | 50 | clean_src_repos() 51 | { 52 | 53 | # Clean out source repos which tend to get cranky on force-push 54 | cRepos="webui freenas samba ports iocage os py-licenselib py-bsd py-libzfs freenas-pkgtools freenas-docs truenas mdnsresponder netatalk" 55 | for r in $cRepos 56 | do 57 | if [ -d "${PROFILE}/_BE/${r}" ] ; then 58 | rm -rf ${PROFILE}/_BE/${r} 59 | fi 60 | done 61 | } 62 | 63 | check_pr_profile() 64 | { 65 | if [ -z "$ghprbPullLongDescription" ] ; then return 0; fi 66 | 67 | # Are there PROFILE knobs listed 68 | echo "$ghprbPullLongDescription" | grep -q "PROFILE:" 69 | if [ $? -ne 0 ] ; then return 0; fi 70 | 71 | local _profile=`echo $ghprbPullLongDescription | sed -n -e 's/^.*PROFILE: //p' | cut -d '\' -f 1` 72 | echo "*** Found PR PROFILE: $_profile ***" 73 | 74 | BUILDOPTS="PROFILE=${_profile}" 75 | } 76 | 77 | # Parse the Pull Description and bring in any other things marked as depends 78 | check_pr_depends() 79 | { 80 | if [ -z "$ghprbPullLongDescription" ] ; then return 0; fi 81 | 82 | echo "PRDESC: $ghprbPullLongDescription" 83 | 84 | # Are there DEPENDS listed? 85 | echo "$ghprbPullLongDescription" | grep -q "DEPENDS:" 86 | if [ $? -ne 0 ] ; then return 0; fi 87 | 88 | echo -e "$ghprbPullLongDescription" > /tmp/.depsParse.$$ 89 | while read line 90 | do 91 | echo $line | grep -q "DEPENDS:" 92 | if [ $? -ne 0 ] ; then continue; fi 93 | _depsLine=`echo $line | sed -n -e 's/^.*DEPENDS: //p' | cut -d '\' -f 1` 94 | echo "*** Found PR DEPENDS Line: $_depsLine ***" 95 | _deps="$_deps $_depsLine" 96 | done < /tmp/.depsParse.$$ 97 | rm /tmp/.depsParse.$$ 98 | 99 | 100 | for prtgt in $_deps 101 | do 102 | if [ -z "$prtgt" ] ; then continue ; fi 103 | if [ "$prtgt" = " " ] ; then continue ; fi 104 | echo "*** Found PR DEPENDS: $_prtgt ***" 105 | # Pull the target PR/Repo 106 | tgt=`echo $prtgt | sed 's|http://||g'` 107 | tgt=`echo $tgt | sed 's|https://||g'` 108 | tgt=`echo $tgt | sed 's|www.github.com||g'` 109 | tgt=`echo $tgt | sed 's|github.com||g'` 110 | tgt=`echo $tgt | sed 's|^/||g'` 111 | tproject=`echo $tgt | cut -d '/' -f 1` 112 | trepo=`echo $tgt | cut -d '/' -f 2` 113 | tbranch=`echo $tgt | cut -d '/' -f 3-` 114 | tbranch=`echo $tbranch | sed 's|^tree/||g'` 115 | 116 | if [ -d "${PROFILE}/_BE/${trepo}" ] ; then 117 | rm -rf ${PROFILE}/_BE/${trepo} 118 | else 119 | echo "*** Warning, no such git repo currently checked out: $trepo***" 120 | fi 121 | 122 | echo "*** Cloning DEPENDS repo https://github.com/$tproject/$trepo $tbranch***" 123 | git clone --depth=1 -b ${tbranch} https://github.com/${tproject}/${trepo} ${PROFILE}/_BE/${trepo} 2>/tmp/.ghClone.$$ >/tmp/.ghClone.$$ 124 | if [ $? -ne 0 ] ; then 125 | cat /tmp/.ghClone.$$ 126 | rm /tmp/.ghClone.$$ 127 | echo "**** ERROR: Failed to clone the repo https://github.com/$tproject/$trepo -b $tbranch****" 128 | exit 1 129 | fi 130 | rm /tmp/.ghClone.$$ 131 | done 132 | } 133 | 134 | # If we are building on internal IX network use local git mirrors 135 | check_local_git_repo() 136 | { 137 | if [ -z "$SFTPUSER" -o "$SFTPUSER" != "pkgsync" ]; then 138 | return 0 139 | fi 140 | 141 | echo "*** Using local iX Git Mirror ***" 142 | export REPO_OS_URL=git://10.20.21.137/os 143 | export REPO_FREENAS_URL=git://10.20.21.137/freenas 144 | export REPO_WEBUI_URL=git://10.20.21.137/webui 145 | export REPO_MDNSRESPONDER_URL=git://10.20.21.137/mDNSResponder 146 | export REPO_FREENAS_DOCS_URL=git://10.20.21.137/freenas-docs 147 | export REPO_FREENAS_DOCS_LEGACY_URL=git://10.20.21.137/freenas-docs 148 | export REPO_FREENAS_PKGTOOLS_URL=git://10.20.21.137/freenas-pkgtools 149 | export REPO_PORTS_URL=git://10.20.21.137/ports 150 | export REPO_SAMBA_URL=git://10.20.21.137/samba 151 | export REPO_NETATALK_URL=git://10.20.21.137/Netatalk 152 | export REPO_IX_INSTALLER_URL=git://10.20.21.137/ix-installer 153 | export REPO_PY_LIBZFS_URL=git://10.20.21.137/py-libzfs 154 | export REPO_PY_BSD_URL=git://10.20.21.137/py-bsd 155 | export REPO_IOCAGE_URL=git://10.20.21.137/iocage 156 | } 157 | 158 | check_local_git_repo 159 | 160 | # Allowed settings for BUILDINCREMENTAL 161 | case $BUILDINCREMENTAL in 162 | ON|on|YES|yes|true|TRUE) BUILDINCREMENTAL="true" ;; 163 | *) BUILDINCREMENTAL="false" ;; 164 | esac 165 | 166 | # Set local location of FreeNAS build 167 | if [ -n "$BUILDTAG" ] ; then 168 | FNASBDIR="/$BUILDTAG" 169 | else 170 | FNASBDIR="/freenas" 171 | fi 172 | export FNASBDIR 173 | 174 | # Error output log 175 | LOUT="/tmp/fnas-error-debug.txt" 176 | touch ${LOUT} 177 | 178 | get_bedir 179 | 180 | 181 | # Allow these defaults to be overridden 182 | TMPFSWORK="yes" 183 | BCONF="/usr/local/etc/poudriere-builders.conf" 184 | if [ -e "$BCONF" ] ; then 185 | grep -q "^FNBUILDERS=" ${BCONF} 186 | if [ $? -eq 0 ] ; then 187 | POUDRIERE_JOBS=$(grep "^FNBUILDERS=" ${BCONF} | cut -d '=' -f 2) 188 | echo "Setting POUDRIERE_JOBS=$POUDRIERE_JOBS" 189 | export POUDRIERE_JOBS 190 | export BUILDWORLD_JOBS="20" 191 | else 192 | CPUS=$(sysctl -n kern.smp.cpus) 193 | if [ $CPUS -gt 8 ] ; then 194 | echo "Setting POUDRIERE_JOBS=8" 195 | export POUDRIERE_JOBS="8" 196 | export BUILDWORLD_JOBS="20" 197 | fi 198 | fi 199 | grep -q "^TMPFSWORK=" ${BCONF} 200 | if [ $? -eq 0 ] ; then 201 | TMPFSWORK=$(grep "^TMPFSWORK=" ${BCONF} | cut -d '=' -f 2) 202 | fi 203 | else 204 | # Some tuning for our big build boxes 205 | CPUS=$(sysctl -n kern.smp.cpus) 206 | if [ $CPUS -gt 8 ] ; then 207 | echo "Setting POUDRIERE_JOBS=8" 208 | export POUDRIERE_JOBS="8" 209 | export BUILDWORLD_JOBS="20" 210 | fi 211 | fi 212 | 213 | # Check if we are building with an alt profile 214 | check_pr_profile 215 | 216 | # Cleanup any hanging mounts left over from prior crashed builds 217 | _hMounts=$(mount | grep "on ${FNASBDIR}/") 218 | if [ -n "$_hMounts" ] ; then 219 | echo "Cleaning hanging mounts: $_hMounts" 220 | mount | grep "on ${FNASBDIR}/" | awk '{print $1}' | xargs umount -f 221 | fi 222 | 223 | # Rotate an old build 224 | if [ -d "${FNASBDIR}" -a "${BUILDINCREMENTAL}" != "true" ] ; then 225 | echo "Doing fresh build!" 226 | cd ${FNASBDIR} 227 | chflags -R 0 ${BEDIR} 228 | rm -rf ${BEDIR} 229 | fi 230 | 231 | # If this is a github pull request builder, check if branch needs to be overridden 232 | if [ -n "$ghprbTargetBranch" ] ; then 233 | GITFNASBRANCH="$ghprbTargetBranch" 234 | if [ "$GITFNASBRANCH" = "freenas/master" -a "$PRBUILDER" = "os" ] ; then 235 | # When building PRs for the "os" repo on freenas/master branch, use right PROFILE 236 | echo "*** Building with PROFILE=fn_head ***" 237 | BUILDOPTS="PROFILE=fn_head" 238 | PROFILEARGS="PROFILE=fn_head" 239 | fi 240 | if [ "$GITFNASBRANCH" = "freenas/master" ] ; then 241 | # Because freenas/master in some branches aligns to master branch of build 242 | GITFNASBRANCH="master" 243 | fi 244 | if [ "$GITFNASBRANCH" = "freenas/11-stable" -a "$PRBUILDER" = "os" ] ; then 245 | # Because freenas/master in some branches aligns to master branch of build 246 | GITFNASBRANCH="master" 247 | fi 248 | echo "$GITFNASBRANCH" | grep -q "^truenas/" 249 | if [ $? -eq 0 ] ; then 250 | # truenas/ -> freenas/ 251 | GITFNASBRANCH="$(echo $GITFNASBRANCH | sed 's|truenas/|freenas/|g')" 252 | fi 253 | echo "*** Building GitHub PR, using builder branch: $GITFNASBRANCH ***" 254 | newTrain="PR-${PRBUILDER}-`echo $ghprbSourceBranch | sed 's|/|-|g'`" 255 | echo "*** Setting new TRAIN=$newTrain ***" 256 | BUILDOPTS="$BUILDOPTS TRAIN=$newTrain" 257 | rm -rf "${WORKSPACE}/artifacts" 258 | fi 259 | 260 | if [ "$BUILDINCREMENTAL" = "true" ] ; then 261 | echo "Doing incremental build!" 262 | if [ -d "${FNASBDIR}" ] ; then 263 | cd ${FNASBDIR} 264 | # Nuke old ISO's / builds 265 | echo "Removing old build ISOs" 266 | rm -rf ${BEDIR}/release 2>/dev/null 267 | fi 268 | fi 269 | 270 | # Figure out the flavor for this test 271 | echo $BUILDTAG | grep -q "truenas" 272 | if [ $? -eq 0 ] ; then 273 | FLAVOR="TRUENAS" 274 | else 275 | FLAVOR="FREENAS" 276 | fi 277 | 278 | # Add JENKINSBUILDSENV to one specified by the build itself 279 | if [ -n "$JENKINSBUILDSENV" ] ; then 280 | BUILDSENV="$BUILDSENV $JENKINSBUILDSENV" 281 | fi 282 | 283 | # Throw env command on the front 284 | if [ -n "$BUILDSENV" ] ; then 285 | BUILDSENV="env $BUILDSENV" 286 | fi 287 | 288 | if [ -n "$PRBUILDER" ] ; then 289 | # Nuke the build dir if doing Pull Request Build 290 | echo "*** Cleaning old PR build directory ***" 291 | cd ${PROGDIR} 292 | mount | grep "on ${FNASBDIR}/" | awk '{print $3}' | xargs umount -f 293 | rm -rf ${FNASBDIR} 2>/dev/null 294 | mount | grep "on ${FNASBDIR}/" | awk '{print $3}' | xargs umount -f 295 | chflags -R noschg ${FNASBDIR} 2>/dev/null 296 | mount | grep "on ${FNASBDIR}/" | awk '{print $3}' | xargs umount -f 297 | rm -rf ${FNASBDIR} 2>/dev/null 298 | if [ -d "${FNASBDIR}" ] ; then 299 | echo "ERROR: Failed to cleanup ${FNASBDIR}" 300 | exit 1 301 | fi 302 | 303 | if [ "$PRBUILDER" = "build" ] ; then 304 | # PR Build 305 | echo "*** Doing PR build of the build/ repo ***" 306 | echo "${WORKSPACE} -> ${FNASBDIR}" 307 | mkdir "${FNASBDIR}" 308 | tar cf - -C "${WORKSPACE}" . | tar xf - -C "${FNASBDIR}" 309 | if [ $? -ne 0 ] ; then exit_clean; fi 310 | else 311 | # Make sure we have our freenas build sources updated 312 | if [ -d "${FNASBDIR}" ]; then 313 | git_fnas_up "${FNASBDIR}" 314 | else 315 | rc_halt "git clone --depth=1 -b ${GITFNASBRANCH} ${GITFNASURL} ${FNASBDIR}" 316 | fi 317 | fi 318 | else 319 | if [ -d "${FNASBDIR}" ]; then 320 | git_fnas_up "${FNASBDIR}" 321 | else 322 | rc_halt "git clone --depth=1 -b ${GITFNASBRANCH} ${GITFNASURL} ${FNASBDIR}" 323 | fi 324 | fi 325 | rc_halt "ln -fs ${FNASBDIR} ${FNASSRC}" 326 | 327 | # Lets keep our distfiles around and use previous ones 328 | if [ ! -d "/usr/ports/distfiles" ] ; then 329 | mkdir -p /usr/ports/distfiles 330 | fi 331 | if [ -e "${FNASSRC}/build/config/env.pyd" ] ; then 332 | # FreeNAS 9.10 / 10 333 | sed -i '' 's|${OBJDIR}/ports/distfiles|/usr/ports/distfiles|g' ${FNASSRC}/build/config/env.pyd 334 | else 335 | # FreeNAS / TrueNAS 9 336 | export PORTS_DISTFILES_CACHE="/usr/ports/distfiles" 337 | fi 338 | 339 | # Now create the world / kernel / distribution 340 | cd ${FNASSRC} 341 | 342 | # Check if we have optional build options 343 | if [ -n "$BUILDOPTS" ] ; then 344 | BUILDOPTS=`echo $BUILDOPTS | sed "s|%BUILDID%|${BUILD_ID}|g"` 345 | PROFILEARGS="$PROFILEARGS $BUILDOPTS" 346 | 347 | # Unset so we don't conflict with anything 348 | export OLDBUILDOPTS="$BUILDOPTS" 349 | unset BUILDOPTS 350 | fi 351 | 352 | echo $PROFILEARGS | grep -q "PRODUCTION=yes" 353 | if [ $? -eq 0 ] ; then 354 | # PRODUCTION is enabled, make sure VERSION was specified 355 | if [ -z "$JENKINSVERSION" ] ; then 356 | echo "PRODUCTION=yes is SET, but no JENKINSVERSION= is set!" 357 | exit 1 358 | fi 359 | PROFILEARGS="${PROFILEARGS} VERSION=$JENKINSVERSION" 360 | 361 | # Cleanup before the build if doing PRODUCTION and INCREMENTAL is set 362 | if [ "$BUILDINCREMENTAL" != "true" ] ; then 363 | echo "Running cleandist" 364 | make cleandist 365 | fi 366 | fi 367 | 368 | # Are we building docs / API? 369 | if [ "$1" = "docs" -o "$1" = "api-docs" ] ; then 370 | echo "Creating $1" 371 | cd ${FNASBDIR} 372 | rc_halt "make checkout $PROFILEARGS" 373 | rc_halt "make clean-docs $PROFILEARGS" 374 | rc_halt "make $1 $PROFILEARGS" 375 | exit 0 376 | fi 377 | 378 | # If we have the saved objects from a previous PR build run 379 | # lets extract those to do an INCREMENTAL build and save 380 | # some time 381 | if [ -n "$PRBUILDER" -a -n "${GH_REPO}" ] ; then 382 | TGBRANCH=$(echo ${ghprbTargetBranch} | sed 's|/|-|g') 383 | if [ -e "/pr-objs/objs-${GH_REPO}-${TGBRANCH}" ] ; then 384 | cd ${FNASBDIR} 385 | BELOC=$(cat /pr-objs/objs-${GH_REPO}-${TGBRANCH}/belocation) 386 | BELOC=$(dirname $BELOC) 387 | if [ -n "$BELOC" ] ; then 388 | mkdir -p ${BELOC} 2>/dev/null 389 | echo "*** Using previous PR build objects... ***" 390 | rm -rf ${BELOC}/objs 391 | echo "mv /pr-objs/objs-${GH_REPO}-${TGBRANCH} ${BELOC}/objs" 392 | mv /pr-objs/objs-${GH_REPO}-${TGBRANCH} ${BELOC}/objs 393 | if [ -d "${BELOC}/objs/os" ] ; then 394 | rm -rf ${BELOC}/os 2>/dev/null 395 | echo "*** Using previous PR build OS source... ***" 396 | mv ${BELOC}/objs/os ${BELOC}/os 397 | fi 398 | fi 399 | fi 400 | fi 401 | 402 | # Start the XML reporting 403 | clean_xml_results "Clean previous results" 404 | start_xml_results "FreeNAS Build Process" 405 | set_test_group_text "Build phase tests" "2" 406 | 407 | OUTFILE="/tmp/fnas-build.out.$$" 408 | 409 | echo_test_title "${BUILDSENV} make checkout ${PROFILEARGS}" 2>/dev/null >/dev/null 410 | echo "*** Running: ${BUILDSENV} make checkout ${PROFILEARGS} ***" 411 | ${BUILDSENV} make checkout ${PROFILEARGS} 2>&1 #| tee -a ${OUTFILE} 412 | if [ $? -ne 0 ] ; then 413 | # Try re-checking out SRC bits 414 | clean_src_repos 415 | echo "*** Running: ${BUILDSENV} make checkout ${PROFILEARGS} - Clean Checkout ***" 416 | ${BUILDSENV} make checkout ${PROFILEARGS} 2>&1 #| tee -a ${OUTFILE} 417 | if [ $? -ne 0 ] ; then 418 | echo_fail "*** Failed running make checkout ***" 419 | cat ${OUTFILE} 420 | finish_xml_results "make" 421 | exit 1 422 | fi 423 | fi 424 | echo_ok 425 | 426 | # If this build is on the nightlies train, make the changelog 427 | echo ${PROFILEARGS} | grep -q "Nightlies" 428 | if [ $? -eq 0 ] ; then 429 | echo "Building nightlies ChangeLog" 430 | make changelog-nightly 431 | 432 | # Set CHANGELOG 433 | CHANGELOG="${FNASBDIR}/ChangeLog" 434 | export CHANGELOG 435 | fi 436 | 437 | # Ugly hack to get freenas 9.x to build on CURRENT 438 | if [ "$FREENASLEGACY" = "YES" ] ; then 439 | 440 | # Add all the fixes to use a 9.10 version of mtree 441 | sed -i '' "s|mtree -deU|${PROGDIR}/scripts/kludges/mtree -deU|g" ${FNASSRC}/FreeBSD/src/Makefile.inc1 442 | sed -i '' "s|mtree -deU|${PROGDIR}/scripts/kludges/mtree -deU|g" ${FNASSRC}/FreeBSD/src/release/Makefile.sysinstall 443 | sed -i '' "s|mtree -deU|${PROGDIR}/scripts/kludges/mtree -deU|g" ${FNASSRC}/FreeBSD/src/release/picobsd/build/picobsd 444 | sed -i '' "s|mtree -deU|${PROGDIR}/scripts/kludges/mtree -deU|g" ${FNASSRC}/FreeBSD/src/tools/tools/tinybsd/tinybsd 445 | sed -i '' "s|mtree -deU|${PROGDIR}/scripts/kludges/mtree -deU|g" ${FNASSRC}/FreeBSD/src/share/examples/Makefile 446 | sed -i '' "s|mtree -deU|${PROGDIR}/scripts/kludges/mtree -deU|g" ${FNASSRC}/FreeBSD/src/include/Makefile 447 | sed -i '' "s|mtree -deU|${PROGDIR}/scripts/kludges/mtree -deU|g" ${FNASSRC}/FreeBSD/src/usr.sbin/sysinstall/install.c 448 | MTREE_CMD="${PROGDIR}/scripts/kludges/mtree" 449 | export MTREE_CMD 450 | 451 | if [ ! -e "/usr/bin/makeinfo" ] ; then 452 | cp ${PROGDIR}/scripts/kludges/makeinfo /usr/bin/makeinfo 453 | chmod 755 /usr/bin/makeinfo 454 | fi 455 | if [ ! -e "/usr/bin/mklocale" ] ; then 456 | cp ${PROGDIR}/scripts/kludges/mklocale /usr/bin/mklocale 457 | chmod 755 /usr/bin/mklocale 458 | fi 459 | if [ ! -e "/usr/bin/install-info" ] ; then 460 | cp ${PROGDIR}/scripts/kludges/install-info /usr/bin/install-info 461 | chmod 755 /usr/bin/install-info 462 | fi 463 | 464 | # Copy our kludged build_jail.sh 465 | cp ${PROGDIR}/scripts/kludges/build_jail.sh ${FNASSRC}/build/build_jail.sh 466 | 467 | # NANO_WORLDDIR expects this to exist 468 | if [ ! -d "/var/home" ] ; then 469 | mkdir /var/home 470 | fi 471 | 472 | # Fix a missing directory in NANO_WORLDDIR 473 | sed -i '' 's|geom_gate.ko|geom_gate.ko;mkdir -p ${NANO_WORLDDIR}/usr/src/sys|g' ${FNASSRC}/build/nanobsd-cfg/os-base-functions.sh 474 | 475 | # Check if grub2-efi is on the builder, remove it so 476 | pkg info -q grub2-efi 477 | if [ $? -eq 0 ] ; then 478 | pkg delete -y grub2-efi 479 | fi 480 | fi 481 | 482 | # Set to use TMPFS for everything 483 | if [ -e "build/config/templates/poudriere.conf" ] ; then 484 | echo "*** Enabling USE_TMPFS=$TMPFSWORK ***" 485 | sed -i '' "s|USE_TMPFS=yes|USE_TMPFS=$TMPFSWORK|g" build/config/templates/poudriere.conf 486 | # Set the jail name to use for these builds 487 | export POUDRIERE_JAILNAME="`echo ${BUILDTAG} | sed 's|\.||g'`" 488 | 489 | fi 490 | 491 | 492 | # We are doing a build as a result of a PR 493 | # Lets copy the repo from WORKSPACE into the correct location 494 | if [ -n "${PRBUILDER}" -a "$PRBUILDER" != "build" ] ; then 495 | cd ${FNASBDIR} 496 | eval $PROFILEARGS 497 | 498 | echo "*** Replacing repo with PR-updated version ***" 499 | rm -rf "${PROFILE}/_BE/${PRBUILDER}" 500 | mkdir "${PROFILE}/_BE/${PRBUILDER}" 501 | echo "${WORKSPACE} -> ${PROFILE}/_BE/${PRBUILDER}" 502 | tar cf - -C "${WORKSPACE}" . | tar xf - -C "${PROFILE}/_BE/${PRBUILDER}" 503 | if [ $? -ne 0 ] ; then exit_clean; fi 504 | fi 505 | 506 | # Check for other PR repos to pull in 507 | check_pr_depends 508 | 509 | # FreeBSD head removed lint, disable it 510 | export LINT="" 511 | 512 | # Clear the OUTFILE 513 | echo "" > ${OUTFILE} 514 | 515 | echo_test_title "${BUILDSENV} make release ${PROFILEARGS}" 2>/dev/null >/dev/null 516 | echo "*** ${BUILDSENV} make release ${PROFILEARGS} ***" 517 | ${BUILDSENV} make release ${PROFILEARGS} 2>&1 #| tee -a ${OUTFILE} 518 | if [ $? -ne 0 ] ; then 519 | echo_fail "Failed running make release" 520 | #parse_build_error "${OUTFILE}" 521 | clean_artifacts 522 | save_artifacts_on_fail 523 | finish_xml_results "make" 524 | exit 1 525 | fi 526 | export ARTIFACTONSUCCESS=TRUE 527 | echo_ok 528 | clean_artifacts 529 | save_artifacts_on_success 530 | finish_xml_results "make" 531 | 532 | cd ${FNASBDIR} 533 | eval $PROFILEARGS 534 | if [ ! -d "${PROFILE}/_BE/release" ] ; then 535 | echo "ERROR: Could not locate release dir: ${PROFILE}/_BE/release" 536 | fi 537 | echo "*** Saving build artifacts ***" 538 | if [ ! -d "${WORKSPACE}/artifacts" ] ; then 539 | mkdir -p "${WORKSPACE}/artifacts/" 540 | fi 541 | cp -r ${PROFILE}/_BE/release/* "${WORKSPACE}/artifacts/" 542 | 543 | # Locate the ISO file 544 | ISOFILE=`find "${WORKSPACE}/artifacts" | grep \.iso$ | head -n 1` 545 | ISODIR="`dirname $ISOFILE 2>/dev/null`" 546 | if [ -d "$ISODIR" ] ; then 547 | echo "*** Moving ISO files ($ISODIR) to artifacts/iso ***" 548 | rm -rf "${WORKSPACE}/artifacts/iso" 549 | mv "${ISODIR}" "${WORKSPACE}/artifacts/iso" 550 | else 551 | # Copy ISO's from objs/ if they exist 552 | echo "*** Copy ISO files (${PROFILE}/_BE/objs/) to artifacts/iso ***" 553 | mkdir -p "${WORKSPACE}/artifacts/iso" 554 | mv ${PROFILE}/_BE/objs/*.iso "${WORKSPACE}/artifacts/iso/" 555 | fi 556 | 557 | # Copy the sources into the artifact repo as well 558 | echo "*** Copying sources to artifacts/ ***" 559 | rm -rf "${WORKSPACE}/artifacts/src" 560 | mkdir -p "${WORKSPACE}/artifacts/src" 561 | 562 | eval $PROFILEARGS 563 | 564 | # Disable for now, we may be able to use the already-checked out dirs via pipelines for QA testing now 565 | # KPM - 2-3-2018 566 | #for srcdir in freenas webui 567 | #do 568 | # echo "*** Copying $srcdir to artifacts/src/$srcdir ***" 569 | # mkdir -p "${WORKSPACE}/artifacts/src/${srcdir}" 570 | # tar cf - -C "${FNASBDIR}/${PROFILE}/_BE/${srcdir}" . | tar xf - -C "${WORKSPACE}/artifacts/src/$srcdir" 571 | # if [ $? -ne 0 ] ; then exit_clean; fi 572 | #done 573 | 574 | echo "*** Flushing artifacts to disk ***" 575 | chown -R jenkins:jenkins "${WORKSPACE}" 576 | if [ -d "${WORKSPACE}/artifacts/logs" ] ; then 577 | chmod -R 755 "${WORKSPACE}/artifacts/logs" 578 | fi 579 | sync 580 | 581 | # Kris Moore (2-2-2018) 582 | # 583 | # The PR builder needs to try and be incremental whenever possible 584 | # This is to keep build times at a minimum so those waiting on merges 585 | # can get their fixes in without horrible wait times (2-5 hours in some cases) 586 | # 587 | # To do this we are going to save a copy of the build objs dir at 588 | # the end of every successful build. 589 | # 590 | # This will be restored before the next build allowing the job to 591 | # only rebuild the world / kernel / pkg bits that have specifically 592 | # changed from the previous run of that particular PR type 593 | if [ -n "${PRBUILDER}" -a -n "$GH_REPO" ] ; then 594 | cd ${FNASBDIR} 595 | 596 | # First locate the _BE dir 597 | if [ -d "freenas/_BE/objs" ] ; then 598 | _BEDIR="freenas/_BE" 599 | elif [ -d "fn_head/_BE/objs" ] ; then 600 | _BEDIR="fn_head/_BE" 601 | elif [ -d "_BE/objs" ] ; then 602 | _BEDIR="_BE" 603 | else 604 | rm ${OUTFILE} 605 | exit 0 606 | fi 607 | 608 | # Tar up the objs dir 609 | if [ ! -d "/pr-objs" ] ; then 610 | mkdir /pr-objs 611 | fi 612 | 613 | TGBRANCH=$(echo ${ghprbTargetBranch} | sed 's|/|-|g') 614 | if [ -d "/pr-objs/objs-${GH_REPO}-${TGBRANCH}" ] ; then 615 | echo "*** Removing previous PR objects... ***" 616 | rm -rf /pr-objs/objs-${GH_REPO}-${TGBRANCH} 2>/dev/null 617 | chflags -R noschg /pr-objs/objs-${GH_REPO}-${TGBRANCH} 2>/dev/null 618 | rm -rf /pr-objs/objs-${GH_REPO}-${TGBRANCH} 2>/dev/null 619 | fi 620 | if [ -d "/pr-objs/objs-${GH_REPO}-${TGBRANCH}" ] ; then 621 | echo "Warning: Failed to remove previous PR objects:" 622 | echo "/pr-objs/objs-${GH_REPO}-${TGBRANCH}" 623 | rm ${OUTFILE} 624 | exit 0 625 | fi 626 | 627 | echo "*** Saving PR objects for next run... ***" 628 | mv ${_BEDIR}/objs /pr-objs/objs-${GH_REPO}-${TGBRANCH} 629 | if [ $? -ne 0 ] ; then 630 | echo "Warning: Errors returned saving PR objects" 631 | fi 632 | echo "*** Saving PR world for next run... ***" 633 | mv ${_BEDIR}/os /pr-objs/objs-${GH_REPO}-${TGBRANCH}/ 634 | 635 | # Save the location we need to restore to 636 | echo "${_BEDIR}/objs" > /pr-objs/objs-${GH_REPO}-${TGBRANCH}/belocation 637 | 638 | fi 639 | 640 | rm ${OUTFILE} 641 | exit 0 642 | -------------------------------------------------------------------------------- /freenas/scripts/build-iso.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # FreeNAS Build configuration settings 3 | 4 | # Where is the pcbsd-build program installed 5 | PROGDIR="`realpath | sed 's|/scripts||g'`" ; export PROGDIR 6 | 7 | # Copy .dist files if necessary 8 | if [ ! -e "${PROGDIR}/freenas.cfg" ] ; then 9 | cp ${PROGDIR}/freenas.cfg.dist ${PROGDIR}/freenas.cfg 10 | fi 11 | 12 | cd ${PROGDIR}/scripts 13 | 14 | # Source the config file 15 | . ${PROGDIR}/freenas.cfg 16 | 17 | # First, lets check if we have all the required programs to build an ISO 18 | . ${PROGDIR}/scripts/functions.sh 19 | 20 | # Check if we have required programs 21 | # echo "*** Prepping Jenkins Node ***" 22 | # sh ${PROGDIR}/scripts/checkprogs.sh 2>&1 >/var/tmp/.cProgs.$$ 23 | # cStat=$? 24 | # if [ $cStat -ne 0 ] ; then 25 | # cat /var/tmp/.cProgs.$$ 26 | # rm /var/tmp/.cProgs.$$ 27 | # exit $cStat 28 | # fi 29 | # rm /var/tmp/.cProgs.$$ 30 | 31 | do_iso() { 32 | 33 | echo "Starting build of FreeNAS" 34 | ${PROGDIR}/scripts/1.buildiso.sh 35 | if [ $? -ne 0 ] ; then 36 | echo "Script failed!" 37 | exit 1 38 | fi 39 | } 40 | 41 | do_doc() { 42 | 43 | echo "Starting build of FreeNAS handbook" 44 | ${PROGDIR}/scripts/1.buildiso.sh docs 45 | if [ $? -ne 0 ] ; then 46 | echo "Script failed!" 47 | exit 1 48 | fi 49 | } 50 | 51 | do_api() { 52 | 53 | echo "Starting build of FreeNAS API handbook" 54 | ${PROGDIR}/scripts/1.buildiso.sh api-docs 55 | if [ $? -ne 0 ] ; then 56 | echo "Script failed!" 57 | exit 1 58 | fi 59 | } 60 | 61 | 62 | do_live_tests() { 63 | 64 | echo "Starting FreeNAS Live regression testing" 65 | ${PROGDIR}/scripts/3.runlivetests.sh 66 | if [ $? -ne 0 ] ; then 67 | echo "Script failed!" 68 | exit 1 69 | fi 70 | } 71 | 72 | do_live_upgrade() { 73 | 74 | echo "Starting FreeNAS Live upgrade testing" 75 | ${PROGDIR}/scripts/3.runliveupgrade.sh 76 | if [ $? -ne 0 ] ; then 77 | echo "Script failed!" 78 | exit 1 79 | fi 80 | } 81 | 82 | 83 | do_tests() { 84 | 85 | echo "Starting FreeNAS regression testing" 86 | ${PROGDIR}/scripts/2.runtests.sh 87 | if [ $? -ne 0 ] ; then 88 | echo "Script failed!" 89 | exit 1 90 | fi 91 | } 92 | 93 | echo "Operation started: `date`" 94 | 95 | TARGET="$1" 96 | if [ -z "$TARGET" ] ; then TARGET="all"; fi 97 | 98 | case $TARGET in 99 | all) do_iso ; do_tests ;; 100 | iso) do_iso ;; 101 | doc) do_doc ;; 102 | api) do_api ;; 103 | tests) do_tests ;; 104 | livetests) do_live_tests ;; 105 | liveupgrade) do_live_upgrade ;; 106 | *) ;; 107 | esac 108 | 109 | 110 | echo "Operation finished: `date`" 111 | exit 0 112 | -------------------------------------------------------------------------------- /freenas/scripts/checkprogs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Source our functions 4 | if [ -z "$PROGDIR" ] ; then 5 | . functions.sh 6 | else 7 | . ${PROGDIR}/scripts/functions.sh 8 | fi 9 | 10 | # Make sure we have some directories we need 11 | mkdir -p ${PROGDIR}/iso >/dev/null 2>/dev/null 12 | mkdir -p ${PROGDIR}/log >/dev/null 2>/dev/null 13 | 14 | which git >/dev/null 2>/dev/null 15 | if [ "$?" != "0" ]; then 16 | echo "Installing git.." 17 | rc_halt "pkg-static install -y git" 18 | fi 19 | 20 | which bash >/dev/null 2>/dev/null 21 | if [ "$?" != "0" ]; then 22 | echo "Installing bash.." 23 | rc_halt "pkg-static install -y bash" 24 | fi 25 | 26 | which grub-mkrescue >/dev/null 2>/dev/null 27 | if [ "$?" != "0" ]; then 28 | echo "Installing grub-mkrescue.." 29 | rc_halt "pkg-static install -y grub2-pcbsd" 30 | fi 31 | 32 | pkg info -q sysutils/grub2-efi 33 | if [ "$?" != "0" ]; then 34 | echo "Installing sysutils/grub2-efi" 35 | rc_halt "pkg-static install -y grub2-efi" 36 | fi 37 | 38 | which mkisofs >/dev/null 2>/dev/null 39 | if [ "$?" != "0" ]; then 40 | echo "Installing cdrtools.." 41 | rc_halt "pkg-static install -y cdrtools" 42 | fi 43 | 44 | which xorriso >/dev/null 2>/dev/null 45 | if [ "$?" != "0" ]; then 46 | echo "Installing xorriso.." 47 | rc_halt "pkg-static install -y xorriso" 48 | fi 49 | 50 | pkg info "devel/gmake" >/dev/null 2>/dev/null 51 | if [ "$?" != "0" ]; then 52 | echo "Installing devel/gmake.." 53 | rc_halt "pkg-static install -y gmake" 54 | fi 55 | 56 | which curl >/dev/null 2>/dev/null 57 | if [ "$?" != "0" ]; then 58 | echo "Installing ftp/curl.." 59 | rc_halt "pkg-static install -y curl" 60 | fi 61 | 62 | which wget >/dev/null 2>/dev/null 63 | if [ "$?" != "0" ]; then 64 | echo "Installing wget.." 65 | rc_halt "pkg-static install -y wget" 66 | fi 67 | 68 | pkg info -q jq 69 | if [ "$?" != "0" ]; then 70 | echo "Installing jq.." 71 | rc_halt "pkg-static install -y jq" 72 | fi 73 | 74 | pkg info -q python27 >/dev/null 2>/dev/null 75 | if [ "$?" != "0" ]; then 76 | echo "Installing lang/python27.." 77 | rc_halt "pkg-static install -y python27" 78 | fi 79 | 80 | pkg info python >/dev/null 2>&1 81 | if [ "$?" != "0" ]; then 82 | echo "Installing lang/python.." 83 | rc_halt "pkg-static install -y python" 84 | fi 85 | 86 | pkg info python36 >/dev/null 2>&1 87 | if [ "$?" != "0" ]; then 88 | echo "Installing python36.." 89 | rc_halt "pkg-static install -y python36" 90 | fi 91 | 92 | pkg info -q py27-sphinx >/dev/null 2>/dev/null 93 | if [ "$?" != "0" ]; then 94 | echo "Installing sphinx.." 95 | rc_halt "pkg-static install -y py27-sphinx" 96 | fi 97 | 98 | pkg info -q py27-sphinx-intl >/dev/null 2>/dev/null 99 | if [ "$?" != "0" ]; then 100 | echo "Installing sphinx-intl.." 101 | rc_halt "pkg-static install -y py27-sphinx-intl" 102 | fi 103 | 104 | pkg info -q py27-sphinx_numfig >/dev/null 2>/dev/null 105 | if [ "$?" != "0" ]; then 106 | echo "Installing sphinx_numfig.." 107 | rc_halt "pkg-static install -y py27-sphinx_numfig" 108 | fi 109 | 110 | pkg info -q py27-sphinx_rtd_theme >/dev/null 2>/dev/null 111 | if [ "$?" != "0" ]; then 112 | echo "Installing sphinx_rtd_theme.." 113 | rc_halt "pkg-static install -y py27-sphinx_rtd_theme" 114 | fi 115 | 116 | pkg info -q py27-sphinx_wikipedia >/dev/null 2>/dev/null 117 | if [ "$?" != "0" ]; then 118 | echo "Installing sphinx_wikipedia.." 119 | rc_halt "pkg-static install -y py27-sphinx_wikipedia" 120 | fi 121 | 122 | pkg info -q py27-sphinxcontrib-httpdomain >/dev/null 2>/dev/null 123 | if [ "$?" != "0" ]; then 124 | echo "Installing sphinxcontrib-httpdomain.." 125 | rc_halt "pkg-static install -y py27-sphinxcontrib-httpdomain" 126 | fi 127 | 128 | pkg info -q compat9x-amd64 >/dev/null 2>/dev/null 129 | if [ "$?" != "0" ]; then 130 | echo "Installing compat9x-amd64.." 131 | rc_halt "pkg-static install -y compat9x-amd64" 132 | fi 133 | 134 | which pxz >/dev/null 2>/dev/null 135 | if [ "$?" != "0" ]; then 136 | echo "Installing archivers/pxz" 137 | rc_halt "pkg-static install -y pxz" 138 | fi 139 | 140 | which poudriere >/dev/null 2>/dev/null 141 | if [ "$?" != "0" ]; then 142 | echo "Installing ports-mgmt/poudriere-devel" 143 | rc_halt "pkg-static install -y poudriere-devel" 144 | fi 145 | -------------------------------------------------------------------------------- /freenas/scripts/create-auto-install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # Author: Kris Moore / iXsystems 3 | # Usage: ./create-auto-install.sh 4 | ######################################################## 5 | 6 | # Settings 7 | 8 | # DISK name for VM 9 | VMDISK="ada0" 10 | 11 | ######################################################## 12 | 13 | # Where is the program installed 14 | PROGDIR="`realpath ${0} | sed 's|/create-auto-install.sh||g'`/../" ; export PROGDIR 15 | 16 | # Source our functions 17 | . ${PROGDIR}/scripts/functions.sh 18 | 19 | ISO="$1" 20 | 21 | # Extract the ISO file 22 | MD=`mdconfig -a -t vnode $ISO` 23 | if [ $? -ne 0 ] ; then exit 1; fi 24 | cd / 25 | mkdir isomnt 2>/dev/null 26 | mkdir isodir 2>/dev/null 27 | 28 | mount_cd9660 /dev/$MD isomnt 29 | if [ $? -ne 0 ] ; then exit 1; fi 30 | 31 | echo "Copying ISO data..." 32 | tar cvf - -C ./isomnt . 2>/dev/null | tar xvpf - -C ./isodir 2>/dev/null 33 | if [ $? -ne 0 ] ; then exit 1; fi 34 | sleep 2 35 | 36 | umount -f isomnt 37 | if [ $? -ne 0 ] ; then exit 1; fi 38 | 39 | rmdir isomnt 40 | mdconfig -d -u $MD 41 | if [ $? -ne 0 ] ; then exit 1; fi 42 | 43 | # Load geom_uzip if necessary 44 | kldstat | grep -q 'geom_uzip' 45 | if [ $? -ne 0 ] ; then 46 | kldload geom_uzip 2>/dev/null & 47 | fi 48 | 49 | # Set kernel to boot in serial mode 50 | sed -i '' "s|/boot/kernel/kernel|/boot/kernel/kernel -D -h|g" isodir/boot/grub/grub.cfg 51 | if [ $? -ne 0 ] ; then exit 1; fi 52 | 53 | # Now extract the UZIP file 54 | MD=`mdconfig -a -t vnode isodir/data/base.ufs.uzip` 55 | if [ $? -ne 0 ] ; then exit 1; fi 56 | mkdir uzipmnt 57 | mkdir uzipdir 58 | 59 | mount -o ro /dev/${MD}.uzip uzipmnt 60 | if [ $? -ne 0 ] ; then exit 1; fi 61 | 62 | echo "Copying uzip data..." 63 | tar cvf - -C ./uzipmnt . 2>/dev/null | tar xvpf - -C ./uzipdir 2>/dev/null 64 | if [ $? -ne 0 ] ; then exit 1; fi 65 | sleep 2 66 | 67 | umount -f uzipmnt 68 | if [ $? -ne 0 ] ; then exit 1; fi 69 | 70 | rmdir uzipmnt 71 | mdconfig -d -u $MD 72 | if [ $? -ne 0 ] ; then exit 1; fi 73 | 74 | # Now massage the install image 75 | ############################################### 76 | 77 | # Setup install to be automated 78 | sed -i '' "s|/etc/install.sh|/etc/install.sh ${VMDISK};/sbin/mount -t zfs freenas-boot/ROOT/default /mnt;/rescue/chroot /mnt /usr/local/bin/sqlite3 /data/freenas-v1.db 'update system_advanced set adv_serialconsole = 1, adv_serialport = 0x3f8';/sbin/umount /mnt;/sbin/halt -p|g" uzipdir/etc/rc 79 | if [ $? -ne 0 ] ; then exit 1; fi 80 | 81 | # Now setup ATF to run at first boot after install 82 | sed -i '' "s|# zpool scrub freenas-boot|cp -r /atf /tmp/data/atf;mkdir -p /tmp/data/conf/default/etc;cp /atf/rc.local /tmp/data/conf/default/etc/rc.local;chmod 755 /tmp/data/conf/default/etc/rc.local;zpool scrub freenas-boot|g" uzipdir/conf/default/etc/install.sh 83 | if [ $? -ne 0 ] ; then exit 1; fi 84 | sed -i '' "s|# zpool scrub freenas-boot|cp -r /atf /tmp/data/atf;mkdir -p /tmp/data/conf/default/etc;cp /atf/rc.local /tmp/data/conf/default/etc/rc.local;chmod 755 /tmp/data/conf/default/etc/rc.local;zpool scrub freenas-boot|g" uzipdir/etc/install.sh 85 | if [ $? -ne 0 ] ; then exit 1; fi 86 | 87 | # Set serial mode 88 | sed -i '' 's|# And now move the backup files back in place|chroot \${_mnt} sed -i "" "s;kernel/kernel;kernel/kernel -D -h;g" /boot/grub/grub.cfg|g' uzipdir/conf/default/etc/install.sh 89 | if [ $? -ne 0 ] ; then exit 1; fi 90 | 91 | # Copy over the ATF scripts 92 | cp -r ${PROGDIR}/atf uzipdir/ 93 | if [ $? -ne 0 ] ; then exit 1; fi 94 | 95 | # Copy over custom rc.local if it exists 96 | if [ -e "/atf/rc.local" ] ; then 97 | cp /atf/rc.local uzipdir/atf/ 98 | fi 99 | 100 | # Copy over custom etc overlay if it exists 101 | if [ -d "/atf/etc" ] ; then 102 | cp -R /atf/etc uzipdir/atf/ 103 | fi 104 | 105 | # Set the IP address in rc.local 106 | sed -i '' "s|%%IP%%|${FNASTESTIP}|g" uzipdir/atf/rc.local 107 | 108 | # Check if we have a truenas license dir 109 | if [ -e "/etc/truenas-license" ] ; then 110 | cp /etc/truenas-license uzipdir/atf/ 111 | fi 112 | 113 | echo "#### Creating uzip file ####" 114 | # Figure out disk size and set up a vnode 115 | UFSFILE=base.ufs 116 | sync 117 | cd uzipdir 118 | DIRSIZE=$(($(du -kd 0 | cut -f 1))) 119 | FSSIZE=$(($DIRSIZE + $DIRSIZE + 1000000)) 120 | cd .. 121 | rc_halt "dd if=/dev/zero of=${UFSFILE} bs=1k count=${FSSIZE}" 122 | 123 | MD=$(mdconfig -a -t vnode -f ${UFSFILE}) 124 | rc_halt "newfs -b 4096 -n -o space /dev/${MD}" 125 | 126 | mkdir uzipmnt 127 | sleep 2 128 | mount -o noatime /dev/${MD} uzipmnt 129 | if [ $? -ne 0 ] ; then exit 1; fi 130 | 131 | # Now copy the usr filesystem 132 | echo "Creating base.ufs... Please wait..." 133 | cd uzipdir 134 | find . -print -depth 2>/dev/null | cpio -dump -v ../uzipmnt 2>/dev/null 135 | cd .. 136 | 137 | # Remove old usrmnt and remount 138 | umount -f /dev/${MD} 139 | 140 | sleep 1 141 | chflags -R noschg uzipdir 142 | rm -rf uzipdir 143 | rc_halt "mdconfig -d -u $MD" 144 | 145 | echo "Compressing with uzip..." 146 | rc_halt "mkuzip -v -s 65536 -o base.ufs.uzip ${UFSFILE}" >/dev/null 2>/dev/null 147 | 148 | # Cleanup after ourselves 149 | rmdir uzipmnt 150 | rm base.ufs 151 | 152 | rc_halt "mv base.ufs.uzip isodir/data/base.ufs.uzip" 153 | 154 | # Create the new ISO file 155 | if [ -e "$BUILDTAG.iso" ] ; then 156 | rm $BUILDTAG.iso 157 | fi 158 | 159 | if [ "$FLAVOR" = "TRUENAS" ] ; then 160 | VOLID="TrueNAS" 161 | else 162 | VOLID="FreeNAS" 163 | fi 164 | 165 | cat << EOF >/tmp/xorriso 166 | ARGS=\`echo \$@ | sed 's|-hfsplus -apm-block-size 2048 -hfsplus-file-creator-type chrp tbxj /System/Library/CoreServices/.disk_label -hfs-bless-by i /System/Library/CoreServices/boot.efi||g'\` 167 | xorriso \$ARGS 168 | EOF 169 | chmod 755 /tmp/xorriso 170 | grub-mkrescue --xorriso=/tmp/xorriso -o $BUILDTAG.iso isodir -- -volid ${VOLID} 171 | if [ $? -ne 0 ] ; then exit 1; fi 172 | 173 | 174 | # Cleanup old iso dir 175 | rm -rf isodir 176 | -------------------------------------------------------------------------------- /freenas/scripts/functions-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # Log files 3 | export RESTYOUT=/tmp/resty.out 4 | export RESTYERR=/tmp/resty.err 5 | 6 | # $1 = Test Description 7 | clean_xml_results() { 8 | if [ -d "$RESULTSDIR" ] ; then 9 | rm -rf "$RESULTSDIR" 10 | fi 11 | if [ -d "${WORKSPACE}/results" ] ; then 12 | rm -rf "${WORKSPACE}/results" 13 | fi 14 | } 15 | 16 | start_xml_results() { 17 | # Set total number of tests 18 | export TOTALCOUNT="0" 19 | 20 | if [ -n "${1}" ] ; then 21 | tnick="${1}" 22 | else 23 | tnick="FreeNAS QA Tests" 24 | fi 25 | if [ ! -d "$RESULTSDIR" ] ; then 26 | mkdir -p "$RESULTSDIR" 27 | fi 28 | export XMLRESULTS="$RESULTSDIR/results.xml.$$" 29 | cat >${XMLRESULTS} << EOF 30 | 31 | 32 | EOF 33 | } 34 | 35 | # $1 = true/false 36 | # $2 = error message 37 | # $CLASSNAME = Sub class of test results 38 | # $TESTNAME = Specific test name 39 | # $TESTSTDOUT = stdout file of test results 40 | # $TESTSTDERR = stderr file of test results 41 | add_xml_result() { 42 | 43 | # If called when no tests have been setup, we can safely return 44 | if [ -z "$TESTNAME" ] ; then return 0 ; fi 45 | 46 | if [ -n "$TIMESTART" -a "$TIMESTART" != "0" ] ; then 47 | TIMEEND=`date +%s` 48 | TIMEELAPSED=`expr $TIMEEND - $TIMESTART` 49 | fi 50 | 51 | if [ "$1" = "true" ] ; then 52 | cat >>${XMLRESULTS} << EOF 53 | 54 | EOF 55 | elif [ "$1" = "skipped" ] ; then 56 | cat >>${XMLRESULTS} << EOF 57 | 58 | EOF 59 | else 60 | # Failed! 61 | cat >>${XMLRESULTS} << EOF 62 | 63 | $2 64 | EOF 65 | fi 66 | 67 | local ESCAPED_TESTCMD=$(echo $TESTCMD | sed "s|&|&|g") 68 | 69 | # Optional stdout / stderr logs 70 | if [ -n "$TESTSTDOUT" -a -e "$TESTSTDOUT" ] ; then 71 | echo -e " Command Run:\n$ESCAPE_TESTCMD\n\nResponse:\n" >> ${XMLRESULTS} 72 | echo "`cat $TESTSTDOUT | sed 's|<||g' | sed 's|>||g' | tr -d '\r'`" >> ${XMLRESULTS} 73 | fi 74 | if [ -n "$TESTSTDERR" -a -e "$TESTSTDERR" ] ; then 75 | echo " `cat $TESTSTDERR | sed 's|<||g' | sed 's|>||g' | tr -d '\r'`" >> ${XMLRESULTS} 76 | fi 77 | 78 | # Close the error tag 79 | cat >> ${XMLRESULTS} << EOF 80 | 81 | EOF 82 | 83 | unset TESTNAME TESTSTDOUT TESTSTDERR TESTCMD 84 | } 85 | 86 | # $1 = Optional tag for results file 87 | finish_xml_results() { 88 | if [ -z "$1" ] ; then 89 | rTag="tests" 90 | else 91 | rTag="$1" 92 | fi 93 | 94 | cat >>${XMLRESULTS} << EOF 95 | 96 | EOF 97 | 98 | # Set the total number of tests run 99 | sed -i '' "s|TOTALTESTS|$1|g" ${XMLRESULTS} 100 | 101 | # Move results to pre-defined location 102 | if [ -n "$WORKSPACE" ] ; then 103 | if [ ! -d "${WORKSPACE}/results" ] ; then 104 | mkdir "${WORKSPACE}/results" 105 | chown jenkins:jenkins "${WORKSPACE}/results" 106 | fi 107 | tStamp=$(date +%s) 108 | echo "Saving jUnit results ${RESULTSDIR} -> ${WORKSPACE}/results/" 109 | mv $RESULTSDIR/results.xml.* "${WORKSPACE}/results/" 110 | chown -R jenkins:jenkins "${WORKSPACE}/results/" 111 | else 112 | echo "Saving jUnit results to: /tmp/test-results.xml" 113 | mv ${XMLRESULTS} /tmp/test-results.xml 114 | fi 115 | } 116 | 117 | publish_pytest_results() { 118 | # Set the total number of tests run 119 | sed -i '' "s|TOTALTESTS|$1|g" ${XMLRESULTS} 120 | 121 | # Move results to pre-defined location 122 | if [ -n "$WORKSPACE" ] ; then 123 | if [ ! -d "${WORKSPACE}/results" ] ; then 124 | mkdir "${WORKSPACE}/results" 125 | chown jenkins:jenkins "${WORKSPACE}/results" 126 | fi 127 | tStamp=$(date +%s) 128 | echo "Saving jUnit results ${RESULTSDIR} -> ${WORKSPACE}/results/" 129 | mv $RESULTSDIR/results.xml.* "${WORKSPACE}/results/" 130 | chown -R jenkins:jenkins "${WORKSPACE}/results/" 131 | else 132 | echo "Saving jUnit results to: /tmp/test-results.xml" 133 | mv ${XMLRESULTS} /tmp/test-results.xml 134 | fi 135 | } 136 | 137 | 138 | # $1 = RESTY type to run 139 | # $2 = RESTY URL 140 | # $3 = JSON to pass to RESTY 141 | rest_request() 142 | { 143 | export TESTCMD="$2 $3" 144 | 145 | case $1 in 146 | DELETE) DELETE ${2} "${3}" -v >${RESTYOUT} 2>${RESTYERR} ; return $? ;; 147 | GET) GET ${2} "$3" -v >${RESTYOUT} 2>${RESTYERR} ; return $? ;; 148 | PATCH) PATCH ${2} "$3" -v >${RESTYOUT} 2>${RESTYERR} ; return $? ;; 149 | PUT) PUT ${2} "$3" -v >${RESTYOUT} 2>${RESTYERR} ; return $? ;; 150 | POST) POST ${2} "$3" -v >${RESTYOUT} 2>${RESTYERR} ; return $? ;; 151 | TRACE) POST ${2} "$3" -v >${RESTYOUT} 2>${RESTYERR} ; return $? ;; 152 | *) echo "Unknown RESTY command: $1" ; return 1 ;; 153 | esac 154 | 155 | # Shouldn't get here 156 | return 1; 157 | } 158 | 159 | # $1 = Command to run 160 | # $2 = Command to run if $1 fails 161 | # $3 = Optional timeout 162 | rc_test() 163 | { 164 | export TESTCMD="$1" 165 | export TESTSTDOUT="/tmp/.cmdTestStdOut" 166 | export TESTSTDERR="/tmp/.cmdTestStdErr" 167 | touch $TESTSTDOUT 168 | touch $TESTSTDERR 169 | 170 | if [ -z "$3" ] ; then 171 | eval "${1}" >${TESTSTDOUT} 2>${TESTSTDERR} 172 | if [ $? -ne 0 ] ; then 173 | echo_fail 174 | if [ -n "$2" ] ; then 175 | eval "${2}" 176 | fi 177 | echo "Failed running: $1" 178 | return 1 179 | else 180 | echo_ok 181 | return 0 182 | fi 183 | fi 184 | 185 | 186 | # Running with timeout 187 | ( ${1} >${TESTSTDOUT} 2>${TESTSTDERR} ; echo $? > /tmp/.rc-result.$$ ) & 188 | echo "$!" > /tmp/.rc-pid.$$ 189 | timeout=0 190 | while : 191 | do 192 | # See if the process stopped yet 193 | pgrep -F /tmp/.rc-pid.$$ >/dev/null 2>/dev/null 194 | if [ $? -ne 0 ] ; then 195 | # Check if it was 0 196 | if [ "$(cat /tmp/.rc-result.$$)" = "0" ] ; then 197 | echo_ok 198 | rm /tmp/.rc-result.$$ 199 | return 0 200 | fi 201 | rm /tmp/.rc-result.$$ 202 | break 203 | fi 204 | 205 | # Check the timeout 206 | sleep 1 207 | timeout=$(expr $timeout + 1) 208 | if [ $timeout -gt $3 ] ; then break; fi 209 | done 210 | 211 | kill -9 $(cat /tmp/.rc-pid.$$) 212 | rm /tmp/.rc-pid.$$ 213 | rm /tmp/.rc-result.$$ 2>/dev/null 214 | echo_fail 215 | eval "${2}" 216 | echo "Timeout running: $1" 217 | return 1 218 | } 219 | 220 | # $1 = Command to run 221 | ssh_test() 222 | { 223 | export TESTSTDOUT="/tmp/.sshCmdTestStdOut" 224 | export TESTSTDERR="/tmp/.sshCmdTestStdErr" 225 | touch $TESTSTDOUT 226 | touch $TESTSTDERR 227 | 228 | sshserver=${ip} 229 | if [ -z "$sshserver" ] ; then 230 | sshserver=$FNASTESTIP 231 | fi 232 | 233 | if [ -z "$sshserver" ] ; then 234 | echo "SSH server IP address required for ssh_test()." 235 | return 1 236 | fi 237 | 238 | # Test fuser value 239 | if [ -z "${fuser}" ] ; then 240 | echo "SSH server username required for ssh_test()." 241 | return 1 242 | fi 243 | 244 | # Use password auth if password set and no local ssh key found 245 | if [ -n "${fpass}" ] && ssh-add -l | grep -q 'The agent has no identities.'; then 246 | sshpass -p ${fpass} \ 247 | ssh -o StrictHostKeyChecking=no \ 248 | -o UserKnownHostsFile=/dev/null \ 249 | -o VerifyHostKeyDNS=no \ 250 | ${fuser}@${sshserver} ${1} >$TESTSTDOUT 2>$TESTSTDERR 251 | else 252 | ssh -o StrictHostKeyChecking=no \ 253 | -o UserKnownHostsFile=/dev/null \ 254 | -o VerifyHostKeyDNS=no \ 255 | ${fuser}@${sshserver} ${1} >$TESTSTDOUT 2>$TESTSTDERR 256 | fi 257 | 258 | return $? 259 | } 260 | 261 | # $1 = Local file to copy to the remote host 262 | # $2 = Location to store file on remote host 263 | scp_to_test() 264 | { 265 | _scp_test "${1}" "${fuser}@${sshserver}:${2}" 266 | } 267 | 268 | # $1 = File to copy from the remote host 269 | # $2 = Location to copy file to 270 | scp_from_test() 271 | { 272 | _scp_test "${fuser}@${sshserver}:${1}" "${2}" 273 | } 274 | 275 | # Private method, see scp_from_test or scp_to_test 276 | # $1 = SCP from [[user@]host1:]file1 277 | # $2 = SCP to [[user@]host1:]file1 278 | _scp_test() 279 | { 280 | export TESTSTDOUT="/tmp/.scpCmdTestStdOut" 281 | export TESTSTDERR="/tmp/.scpCmdTestStdErr" 282 | touch $TESTSTDOUT 283 | touch $TESTSTDERR 284 | 285 | sshserver=${ip} 286 | 287 | if [ -z "$sshserver" ]; then 288 | sshserver=$FNASTESTIP 289 | fi 290 | 291 | if [ -z "$sshserver" ]; then 292 | echo "SCP server IP address request for scp_test()." 293 | return 1 294 | fi 295 | 296 | # Test fuser value 297 | if [ -z "${fuser}" ] ; then 298 | echo "SCP server username required for scp_test()." 299 | return 1 300 | fi 301 | 302 | # Use password auth if password set and no local ssh key found 303 | if [ -n "${fpass}" ] && ssh-add -l | grep -q 'The agent has no identities.'; then 304 | sshpass -p ${fpass} \ 305 | scp -o StrictHostKeyChecking=no \ 306 | -o UserKnownHostsFile=/dev/null \ 307 | -o VerifyHostKeyDNS=no \ 308 | "${1}" "${2}" >$TESTSTDOUT 2>$TESTSTDERR 309 | else 310 | scp -o StrictHostKeyChecking=no \ 311 | -o UserKnownHostsFile=/dev/null \ 312 | -o VerifyHostKeyDNS=no \ 313 | "${1}" "${2}" >$TESTSTDOUT 2>$TESTSTDERR 314 | fi 315 | SCP_CMD_RESULTS=$? 316 | 317 | if [ $SCP_CMD_RESULTS -ne 0 ]; then 318 | echo "Failed on test module: $1" 319 | FAILEDMODULES="${FAILEDMODULES}:::${1}:::" 320 | return 1 321 | fi 322 | 323 | return $SCP_CMD_RESULTS 324 | } 325 | 326 | # $1 = Command to run 327 | osx_test() 328 | { 329 | export TESTSTDOUT="/tmp/.osxCmdTestStdOut" 330 | export TESTSTDERR="/tmp/.osxCmdTestStdErr" 331 | touch $TESTSTDOUT 332 | touch $TESTSTDERR 333 | 334 | if [ -z "${OSX_HOST}" ] ; then 335 | echo "SSH server IP address required for osx_test()." 336 | return 1 337 | fi 338 | 339 | if [ -z "${OSX_USERNAME}" ] ; then 340 | echo "SSH server username required for osx_test()." 341 | return 1 342 | fi 343 | 344 | # Use SSH keys if the $OSX_PASSWORD is not set 345 | if [ -n "${OSX_PASSWORD}" ]; then 346 | sshpass -p ${OSX_PASSWORD} \ 347 | ssh -o StrictHostKeyChecking=no \ 348 | -o UserKnownHostsFile=/dev/null \ 349 | -o VerifyHostKeyDNS=no \ 350 | ${OSX_USERNAME}@${OSX_HOST} ${1} >$TESTSTDOUT 2>$TESTSTDERR 351 | else 352 | ssh -o StrictHostKeyChecking=no \ 353 | -o UserKnownHostsFile=/dev/null \ 354 | -o VerifyHostKeyDNS=no \ 355 | ${OSX_USERNAME}@${OSX_HOST} ${1} >$TESTSTDOUT 2>$TESTSTDERR 356 | fi 357 | 358 | return $? 359 | } 360 | 361 | # $1 = Command to run 362 | bsd_test() 363 | { 364 | export TESTSTDOUT="/tmp/.bsdCmdTestStdOut" 365 | export TESTSTDERR="/tmp/.bsdCmdTestStdErr" 366 | touch $TESTSTDOUT 367 | touch $TESTSTDERR 368 | 369 | if [ -z "${BSD_HOST}" ] ; then 370 | echo "SSH server IP address required for bsd_test()." 371 | return 1 372 | fi 373 | 374 | if [ -z "${BSD_USERNAME}" ] ; then 375 | echo "SSH server username required for bsd_test()." 376 | return 1 377 | fi 378 | 379 | # Use SSH keys if the $BSD_PASSWORD is not set 380 | if [ -n "${BSD_PASSWORD}" ]; then 381 | sshpass -p ${BSD_PASSWORD} \ 382 | ssh -o StrictHostKeyChecking=no \ 383 | -o UserKnownHostsFile=/dev/null \ 384 | -o VerifyHostKeyDNS=no \ 385 | ${BSD_USERNAME}@${BSD_HOST} ${1} >$TESTSTDOUT 2>$TESTSTDERR 386 | else 387 | ssh -o StrictHostKeyChecking=no \ 388 | -o UserKnownHostsFile=/dev/null \ 389 | -o VerifyHostKeyDNS=no \ 390 | ${BSD_USERNAME}@${BSD_HOST} ${1} >$TESTSTDOUT 2>$TESTSTDERR 391 | fi 392 | 393 | return $? 394 | } 395 | 396 | echo_ok() 397 | { 398 | echo -e " - OK" 399 | add_xml_result "true" "Valid test response" 400 | } 401 | 402 | echo_fail() 403 | { 404 | if [ -z "$1" ] ; then 405 | errStr="Invalid test repsonse!" 406 | else 407 | errStr="$1" 408 | fi 409 | 410 | echo -e " - FAILED" 411 | add_xml_result "false" "$errStr" 412 | } 413 | 414 | echo_skipped() 415 | { 416 | echo -e " - SKIPPED" 417 | add_xml_result "skipped" "Skipped test!" 418 | } 419 | 420 | # Checks the exit status_code from previous command 421 | # (Optional) -q switch as first argument silences std_out 422 | check_exit_status() 423 | { 424 | STATUSCODE=$? 425 | SILENT="false" 426 | if [ "$1" == "-q" ]; then 427 | SILENT="true" 428 | shift 429 | fi 430 | 431 | if [ $STATUSCODE -eq 0 ]; then 432 | if [ "$SILENT" == "false" ]; then 433 | echo_ok 434 | fi 435 | return 0 436 | else 437 | if [ "$SILENT" == "false" ]; then 438 | echo_fail 439 | fi 440 | return 1 441 | fi 442 | } 443 | 444 | # $1 = Expected status value for service state property (STOPPED|RUNNING|CRASHED) 445 | # (Optional) -q switch as first argument silences std_out 446 | check_service_status() 447 | { 448 | SRV_PROPERTY='return this.srv_state' 449 | if [ "${1}" == "-q" ]; then 450 | check_property_value $1 "${SRV_PROPERTY}" $2 451 | else 452 | check_property_value "${SRV_PROPERTY}" $1 453 | fi 454 | return $? 455 | } 456 | 457 | # $1 = JSON property to check $2 (value) against, using JSAWK syntax 458 | # $2 = Expected value returned by API property specified in $1 459 | # (Optional) -q switch as first argument silences std_out 460 | check_property_value() 461 | { 462 | export TESTSTDOUT="$RESTYOUT" 463 | export TESTSTDERR="$RESTYERR" 464 | 465 | SILENT="false" 466 | if [ "${1}" == "-q" ]; then 467 | SILENT="true" 468 | shift 469 | fi 470 | 471 | grep -q "200 OK" ${RESTYERR} 472 | if [ $? -ne 0 ] ; then 473 | if [ "$SILENT" == "false" ]; then 474 | cat ${RESTYERR} 475 | cat ${RESTYOUT} 476 | echo_fail 477 | fi 478 | return 1 479 | fi 480 | 481 | PROP_VALUE=`cat ${RESTYOUT} | ${JSAWK} "${1}"` 482 | # If 'srv_state' property not found, return 'SKIPPED' status 483 | # This can be removed once the API is in sync with TrueNAS/FreeNAS stable - 03/17/17, CD 484 | if [ "${1}" == "return this.srv_state" -a -z "$PROP_VALUE" ]; then 485 | if [ "$SILENT" == "false" ]; then 486 | echo_skipped 487 | fi 488 | return 0 489 | fi 490 | echo $PROP_VALUE | grep -q "${2}" 491 | if [ $? -ne 0 ]; then 492 | if [ "$SILENT" == "false" ]; then 493 | echo_fail 494 | echo "Expected: \"${2}\", Observed: \"${PROP_VALUE}\"" 495 | fi 496 | return 1 497 | fi 498 | 499 | if [ "$SILENT" == "false" ]; then 500 | echo_ok 501 | fi 502 | return 0 503 | } 504 | 505 | # Check for $1 REST response, error out if not found 506 | check_rest_response() 507 | { 508 | export TESTSTDOUT="$RESTYOUT" 509 | export TESTSTDERR="$RESTYERR" 510 | 511 | grep HTTP/1.1 ${RESTYERR}| grep -qi "$1" 512 | if [ $? -ne 0 ] ; then 513 | cat ${RESTYERR} 514 | cat ${RESTYOUT} 515 | echo_fail 516 | return 1 517 | fi 518 | 519 | echo_ok 520 | return 0 521 | } 522 | 523 | check_rest_response_continue() 524 | { 525 | grep -q "$1" ${RESTYERR} 526 | return $? 527 | } 528 | 529 | set_test_group_text() 530 | { 531 | GROUPTEXT="$1" 532 | CLASSNAME="$1" 533 | TOTALTESTS="$2" 534 | TCOUNT=0 535 | } 536 | 537 | echo_test_title() 538 | { 539 | TESTNAME="$1" 540 | TCOUNT=`expr $TCOUNT + 1` 541 | TOTALCOUNT=`expr $TOTALCOUNT + 1` 542 | TIMESTART=`date +%s` 543 | sync 544 | echo -e "Running $GROUPTEXT ($TCOUNT/$TOTALTESTS) - $1\c" 545 | } 546 | 547 | # 548 | set_defaults() 549 | { 550 | fuser="root" 551 | fpass="testing" 552 | } 553 | 554 | wait_for_avail() 555 | { 556 | # Sum: wait for 720 secs 557 | local LOOP_SLEEP=3 558 | local LOOP_LIMIT=240 559 | local ENDPOINT="/system/version/" 560 | 561 | local count=0 562 | while : 563 | do 564 | GET "${ENDPOINT}" -v 2>${RESTYERR} >${RESTYOUT} 565 | check_rest_response_continue "200 OK" 566 | check_exit_status -q && break 567 | echo -n "." 568 | sleep $LOOP_SLEEP 569 | if [ $count -gt $LOOP_LIMIT ] ; then 570 | echo_fail 571 | exit 1 572 | fi 573 | (( count++ )) 574 | done 575 | } 576 | 577 | # Use netcat to determine if a service port is open on FreeNAS 578 | # $1 = Port number to check against 579 | # $2 = (optional) Override $LOOP_SLEEP which determines how long to wait before retrying command 580 | # $3 = (optional) Override $LOOP_LIMIT which determines how many loops before exiting with failure 581 | wait_for_avail_port() 582 | { 583 | local LOOP_SLEEP=1 584 | local LOOP_LIMIT=10 585 | local PORT=$1 586 | 587 | if [ -z "${PORT}" ]; then 588 | echo -n " wait_for_avail_port(): \$1 argument should be a port number to verify" 589 | return 1 590 | fi 591 | 592 | if [ -n "${2}" ]; then 593 | local LOOP_SLEEP=$2 594 | fi 595 | 596 | if [ -n "${3}" ]; then 597 | local LOOP_LIMIT=$3 598 | fi 599 | 600 | local loop_cnt=0 601 | while : 602 | do 603 | nc -z -n -v ${FNASTESTIP} ${PORT} 2>&1 | awk '$5 == "succeeded!" || $5 == "open"' >/dev/null 2>/dev/null 604 | check_exit_status -q && break 605 | echo -n "." 606 | sleep $LOOP_SLEEP 607 | if [ $loop_cnt -gt $LOOP_LIMIT ]; then 608 | return 1 609 | fi 610 | (( loop_cnt++ )) 611 | done 612 | return 0 613 | } 614 | 615 | # Use mount -l[ist] to determine if mounted share shows up 616 | # $1 = Mountpoint to be used by share 617 | # $2 = Share filesystem type (eg, smbfs) 618 | wait_for_bsd_mnt() 619 | { 620 | local LOOP_SLEEP=5 621 | local LOOP_LIMIT=60 622 | 623 | local loop_cnt=0 624 | 625 | while : 626 | do 627 | bsd_test "mount -l | grep -q \"${1}\"" 628 | check_exit_status -q && break 629 | (( loop_cnt++ )) 630 | if [ $loop_cnt -gt $LOOP_LIMIT ]; then 631 | return 1 632 | fi 633 | sleep $LOOP_SLEEP 634 | done 635 | 636 | return 0 637 | } 638 | 639 | # Use mount to determine if mounted share shows up on OSX 640 | # $1 = Mountpoint to be used by share 641 | wait_for_osx_mnt() 642 | { 643 | local LOOP_SLEEP=5 644 | local LOOP_LIMIT=60 645 | 646 | local pattern="${1}" 647 | local loop_cnt=0 648 | 649 | while : 650 | do 651 | osx_test "mount | grep -q \"${pattern}\"" 652 | check_exit_status -q && break 653 | (( loop_cnt++ )) 654 | if [ $loop_cnt -gt $LOOP_LIMIT ]; then 655 | return 1 656 | fi 657 | sleep $LOOP_SLEEP 658 | done 659 | 660 | return 0 661 | } 662 | 663 | 664 | # SSH into OSX box and poll FreeNAS for running AFP service 665 | wait_for_afp_from_osx() 666 | { 667 | local LOOP_SLEEP=1 668 | local LOOP_LIMIT=10 669 | local AFP_PORT="548" 670 | 671 | local loop_cnt=0 672 | while : 673 | do 674 | osx_test "/System/Library/CoreServices/Applications/Network\ Utility.app/Contents/Resources/stroke ${BRIDGEIP} ${AFP_PORT} ${AFP_PORT} | grep ${AFP_PORT}" 675 | check_exit_status -q && break 676 | echo -n "." 677 | sleep $LOOP_SLEEP 678 | if [ $loop_cnt -gt $LOOP_LIMIT ]; then 679 | return 1 680 | fi 681 | (( loop_cnt++ )) 682 | done 683 | return 0 684 | } 685 | 686 | # Poll the FreeNAS host to verify when a share has been created by checking showmount -e results 687 | # $1 = Mount path to check showmount results for 688 | # $2 = (Optional) Access type of share (eg, "Everyone") 689 | wait_for_fnas_mnt() 690 | { 691 | local LOOP_SLEEP=2 692 | local LOOP_LIMIT=40 693 | 694 | local mntpoint=$1 695 | local permissions="" 696 | 697 | if [ -n "${2}" ]; then 698 | permissions=" && \$2 == \"${2}\"" 699 | fi 700 | 701 | while : 702 | do 703 | ssh_test "showmount -e | awk '\$1 == \"${mntpoint}\"${permissions}' " 704 | check_exit_status -q && break 705 | echo -n "." 706 | sleep $LOOP_SLEEP 707 | if [ $loop_cnt -gt $LOOP_LIMIT ]; then 708 | return 1 709 | fi 710 | (( loop_cnt++ )) 711 | done 712 | return 0 713 | } 714 | 715 | run_module() { 716 | unset REQUIRES 717 | 718 | # Source the module now 719 | cd ${TDIR} 720 | . ./${1} 721 | if [ $? -ne 0 ] ; then 722 | echo "Failed sourcing ${1}" 723 | FAILEDMODULES="${FAILEDMODULES}:::${1}:::" 724 | return 1 725 | fi 726 | 727 | # Make sure any required module have been run first 728 | local modreq="$REQUIRES" 729 | local nofails="true" 730 | if [ -n "$modreq" ] ; then 731 | for i in $modreq 732 | do 733 | # Check if this module has already been run 734 | echo $RUNMODULES | grep -q ":::${i}:::" 735 | if [ $? -eq 0 ] ; then continue; fi 736 | 737 | echo $FAILEDMODULES | grep -q ":::${i}:::" 738 | if [ $? -eq 0 ] ; then 739 | CLASSNAME="$1" 740 | TESTNAME="all" 741 | TIMESTART="0" 742 | TOTALCOUNT=`expr $TOTALCOUNT + 1` 743 | echo "***** Skipping test module: $1 ($i failed) *****" 744 | add_xml_result "skipped" "Skipped due to $i requirement failing" 745 | FAILEDMODULES="${FAILEDMODULES}:::${1}:::" 746 | return 1 747 | fi 748 | 749 | # Need to run another module first 750 | echo "***** Running module dependancy: $i *****" 751 | run_module "$i" "quiet" 752 | if [ $? -ne 0 ] ; then 753 | nofails="false" 754 | fi 755 | done 756 | fi 757 | 758 | if [ "$nofails" = "false" ] ; then 759 | CLASSNAME="$1" 760 | TESTNAME="all" 761 | TIMESTART="0" 762 | TOTALCOUNT=`expr $TOTALCOUNT + 1` 763 | echo "***** Skipping test module: $1 (Dep failed) *****" 764 | add_xml_result "skipped" "Skipped test module: $i requirement failing" 765 | return 1 766 | fi 767 | 768 | # Run the target module 769 | if [ -z "$2" ] ; then 770 | echo "***** Running module: $1 *****" 771 | fi 772 | eval "${1}_init" 773 | if [ $? -ne 0 ] ; then 774 | echo "Failed on test module: $1" 775 | FAILEDMODULES="${FAILEDMODULES}:::${1}:::" 776 | return 1 777 | fi 778 | 779 | # Save that this test was already run 780 | RUNMODULES="${RUNMODULES}:::${1}:::" 781 | return 0 782 | } 783 | 784 | # Read through the test modules and start running them 785 | read_module_dir() { 786 | cd ${TDIR} 787 | if [ $? -ne 0 ] ; then 788 | echo "Missing test module dir" 789 | exit 1 790 | fi 791 | 792 | RUNMODULES="" 793 | ANYFAILS="false" 794 | 795 | for module in `ls` 796 | do 797 | # Skip the README, other files should be valid though 798 | if [ "$module" = "README" ] ; then continue ; fi 799 | if [ "$module" = "example" ] ; then continue ; fi 800 | 801 | # Check if this module has already been run 802 | echo $RUNMODULES | grep -q ":::${module}:::" 803 | if [ $? -eq 0 ] ; then continue ; fi 804 | 805 | # Check if this module has already been skipped 806 | echo $FAILEDMODULES | grep -q ":::${module}:::" 807 | if [ $? -eq 0 ] ; then continue ; fi 808 | 809 | run_module "$module" 810 | if [ $? -ne 0 ] ; then 811 | ANYFAILS="true" 812 | fi 813 | done 814 | 815 | if [ "$ANYFAILS" = "true" ] ; then return 1; fi 816 | return 0 817 | } 818 | 819 | run_tests() { 820 | /ixbuild/jenkins.sh freenas-run-tests ${BUILDTAG} 821 | } 822 | 823 | # Do a TrueNAS HA failover 824 | # $1 = reboot/panic 825 | trigger_ha_failover() { 826 | case $1 in 827 | reboot) do_ha_reboot ;; 828 | panic) do_ha_panic ;; 829 | *) do_ha_reboot ;; 830 | esac 831 | } 832 | 833 | do_ha_panic() { 834 | export SSHPASS="$LIVEPASS" 835 | echo_test_title "Simulating kernel panic" 836 | sshpass -e ssh -o StrictHostKeyChecking=no ${LIVEUSER}@${LIVEHOST} sysctl debug.kdb.panic=1 >/dev/null 2>/dev/null 837 | echo_ok 838 | sleep 10 839 | 840 | echo_test_title "Waiting for active node response" 841 | sleep 20 842 | wait_for_avail 843 | echo_ok 844 | } 845 | 846 | do_ha_reboot() { 847 | echo_test_title "Rebooting to promote passive node to active" 848 | rest_request "POST" "/system/reboot/" "''" 849 | echo_ok 850 | 851 | echo_test_title "Waiting for active node response" 852 | sleep 20 853 | wait_for_avail 854 | echo_ok 855 | } 856 | 857 | do_ha_status() { 858 | # Verify each node is now in a normal state 859 | count=0 860 | while : 861 | do 862 | # Check the status of each node to make sure all nodes are online 863 | echo_test_title "Checking the alert level for each node" 864 | rest_request "GET" "/system/alert/" "" 865 | check_rest_response "200 OK" 866 | NODESTATUS=$(cat ${RESTYOUT} | ${JSAWK} 'return this.message') 867 | echo "NODESTATUS: $NODESTATUS" 868 | echo $NODESTATUS | grep -q 'Failed to check failover status with the other node: timed out' 869 | if [ $? -ne 0 ] ; then 870 | break 871 | else 872 | sleep 30 873 | fi 874 | count=$(expr $count + 1) 875 | if [ $count -gt 20 ] ; 876 | then 877 | echo_fail 878 | finish_xml_results 879 | exit 1 880 | fi 881 | done 882 | } 883 | -------------------------------------------------------------------------------- /freenas/scripts/functions.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Most of these dont need to be modified 4 | ######################################################### 5 | 6 | # Source vars 7 | if [ -z "${PROGDIR}" ] ; then 8 | . ../freenas.cfg 9 | else 10 | . ${PROGDIR}/freenas.cfg 11 | fi 12 | 13 | # Where on disk is the FreeNAS GIT branch 14 | if [ -n "$FNASGITDIR" ] ; then 15 | FNASSRC="${FNASGITDIR}" 16 | export FNASSRC 17 | else 18 | FNASSRC="${PROGDIR}/freenas" 19 | export FNASSRC 20 | fi 21 | 22 | # Set the local location of XML results 23 | if [ -z "$RESULTSDIR" ] ; then 24 | RESULTSDIR="/tmp/results/${BUILDTAG}" 25 | export RESULTSDIR 26 | fi 27 | 28 | # Default IP4 Pool of addresses 29 | DEFAULT_IP4POOL="$(grep ^IP4POOL: /ixbuild/build.conf | cut -d' ' -f2)" 30 | if [ -z "$DEFAULT_IP4POOL" ] ; then 31 | DEFAULT_IP4POOL="192.168.0.220" 32 | export DEFAULT_IP4POOL 33 | fi 34 | 35 | git_fnas_up() 36 | { 37 | local lDir=${1} 38 | local oDir=`pwd` 39 | if [ ! -d "$lDir" ] ; then return 0; fi 40 | cd "${lDir}" 41 | echo "*** $0: Updating git sources in ${lDir} ***" 42 | 43 | git reset --hard >/dev/null 2>/dev/null 44 | echo "GIT pull" 45 | git pull 46 | if [ $? -ne 0 ] ; then 47 | exit_err "Failed doing a git pull" 48 | fi 49 | 50 | echo "*** $0: Done with git_fnas_up() ***" 51 | cd "${oDir}" 52 | return 0 53 | } 54 | 55 | exit_err() { 56 | echo "ERROR: $@" 57 | exit 1 58 | } 59 | 60 | clean_artifacts() 61 | { 62 | # Move artifacts to pre-defined location 63 | echo "Cleaning previous artifacts" 64 | rm -rf "${WORKSPACE}/artifacts/" 65 | } 66 | 67 | save_artifacts_on_fail() 68 | { 69 | get_bedir 70 | 71 | # Move artifacts to pre-defined location 72 | if [ -n "$ARTIFACTONFAIL" ] ; then 73 | if [ -n "$WORKSPACE" ] ; then 74 | if [ ! -d "${WORKSPACE}/artifacts" ] ; then 75 | mkdir "${WORKSPACE}/artifacts" 76 | chown jenkins:jenkins "${WORKSPACE}/artifacts" 77 | if [ ! -d "${WORKSPACE}/artifacts/logs" ] ; then 78 | mkdir "${WORKSPACE}/artifacts/logs" 79 | chown jenkins:jenkins "${WORKSPACE}/artifacts/logs" 80 | if [ ! -d "${WORKSPACE}/artifacts/ports" ] ; then 81 | mkdir "${WORKSPACE}/artifacts/ports" 82 | chown jenkins:jenkins "${WORKSPACE}/artifacts/ports" 83 | fi 84 | fi 85 | fi 86 | fi 87 | echo "Saving artifacts to: ${WORKSPACE}/artifacts" 88 | cp -R "${BEDIR}/objs/logs/" "${WORKSPACE}/artifacts/logs/" 89 | cp -R "${BEDIR}/objs/ports/data/logs/bulk/" "${WORKSPACE}/artifacts/ports/" 90 | chown -R jenkins:jenkins "${WORKSPACE}/artifacts/" 91 | else 92 | echo "Skip saving artificats on failure / ARTIFACTONFAIL not set" 93 | fi 94 | } 95 | 96 | save_artifacts_on_success() 97 | { 98 | # Move artifacts to pre-defined location 99 | if [ -n "$ARTIFACTONSUCCESS" ] ; then 100 | if [ -n "$WORKSPACE" ] ; then 101 | if [ ! -d "${WORKSPACE}/artifacts" ] ; then 102 | mkdir "${WORKSPACE}/artifacts" 103 | chown jenkins:jenkins "${WORKSPACE}/artifacts" 104 | if [ ! -d "${WORKSPACE}/artifacts/logs" ] ; then 105 | mkdir "${WORKSPACE}/artifacts/logs" 106 | chown jenkins:jenkins "${WORKSPACE}/artifacts/logs" 107 | if [ ! -d "${WORKSPACE}/artifacts/ports" ] ; then 108 | mkdir "${WORKSPACE}/artifacts/ports" 109 | chown jenkins:jenkins "${WORKSPACE}/artifacts/ports" 110 | fi 111 | fi 112 | fi 113 | fi 114 | echo "Saving artifacts to: ${WORKSPACE}/artifacts" 115 | cp -R "${BEDIR}/objs/logs/" "${WORKSPACE}/artifacts/logs/" 116 | cp -R "${BEDIR}/objs/ports/data/logs/bulk/" "${WORKSPACE}/artifacts/ports/" 117 | chown -R jenkins:jenkins "${WORKSPACE}/artifacts/" 118 | else 119 | echo "Skip saving artificats on success / ARTIFACTONSUCCESS not set" 120 | fi 121 | } 122 | 123 | # Run-command, don't halt if command exits with non-0 124 | rc_nohalt() 125 | { 126 | local CMD="$1" 127 | 128 | if [ -z "${CMD}" ] 129 | then 130 | exit_err "Error: missing argument in rc_nohalt()" 131 | fi 132 | 133 | ${CMD} 2>/dev/null >/dev/null 134 | 135 | }; 136 | 137 | # Run-command, halt if command exits with non-0 138 | rc_halt() 139 | { 140 | local CMD="$1" 141 | if [ -z "${CMD}" ]; then 142 | exit_err "Error: missing argument in rc_halt()" 143 | fi 144 | 145 | echo "Running command: $CMD" 146 | ${CMD} 147 | if [ $? -ne 0 ]; then 148 | exit_err "Error ${STATUS}: ${CMD}" 149 | fi 150 | }; 151 | 152 | # Set the FreeNAS _BE directory location 153 | get_bedir() 154 | { 155 | # Some overrides for github PRs 156 | if [ -n "$ghprbPullLongDescription" ] ; then 157 | GITFNASBRANCH="$ghprbTargetBranch" 158 | if [ "$GITFNASBRANCH" = "freenas/master" -a "$PRBUILDER" = "os" ] ; then 159 | # When building PRs for the "os" repo on freenas/master branch, use right PROFILE 160 | BUILDOPTS="PROFILE=fn_head" 161 | fi 162 | 163 | # Are there PROFILE knobs listed 164 | echo "$ghprbPullLongDescription" | grep -q "PROFILE:" 165 | if [ $? -eq 0 ] ; then 166 | local _profile=`echo $ghprbPullLongDescription | sed -n -e 's/^.*PROFILE: //p' | cut -d '\' -f 1` 167 | BUILDOPTS="PROFILE=${_profile}" 168 | fi 169 | fi 170 | 171 | if [ -n "$OLDBUILDOPTS" ] ; then 172 | eval $OLDBUILDOPTS 173 | fi 174 | 175 | if [ -n "$BUILDOPTS" ] ; then 176 | eval $BUILDOPTS 177 | fi 178 | 179 | echo $BUILDOPTS | grep -q fn_head 180 | if [ $? -eq 0 ] ; then 181 | PROFILE="fn_head" 182 | export PROFILE 183 | fi 184 | 185 | if [ -z "$LEGACYBEDIR" -a -n "${PROFILE}" ] ; then 186 | export BEDIR="${FNASBDIR}/${PROFILE}/_BE" 187 | return 0 188 | else 189 | export BEDIR="${FNASBDIR}/_BE" 190 | return 0 191 | fi 192 | } 193 | 194 | -------------------------------------------------------------------------------- /freenas/scripts/kludges/build_jail.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # See README for up to date usage examples. 4 | # vim: syntax=sh noexpandtab 5 | # 6 | 7 | # KPM - 6-5-2015 - Pulled from poudriere so we can build ports on -CURRENT 8 | # Set specified version into login.conf 9 | update_version_env() { 10 | echo "Applying kludge to set UNAME_r to $1" 11 | local release="$1" 12 | local login_env osversion 13 | 14 | osversion=`awk '/\#define __FreeBSD_version/ { print $3 }' ${NANO_WORLDDIR}/usr/include/sys/param.h` 15 | login_env=",UNAME_r=${release% *},UNAME_v=FreeBSD ${release},OSVERSION=${osversion}" 16 | 17 | sed -i "" -e "s/,UNAME_r.*:/:/ ; s/:\(setenv.*\):/:\1${login_env}:/" ${NANO_WORLDDIR}/etc/login.conf 18 | cap_mkdb ${NANO_WORLDDIR}/etc/login.conf 19 | } 20 | 21 | umask 022 22 | cd "$(dirname "$0")/.." 23 | TOP="$(pwd)" 24 | 25 | . build/nano_env 26 | . build/functions.sh 27 | . build/repos.sh 28 | 29 | . build/nanobsd/nanobsd_funcs.sh 30 | 31 | setup_and_export_internal_variables 32 | 33 | # File descriptor 3 is used for logging output, see pprint 34 | exec 3>&1 35 | 36 | NANO_STARTTIME=`date +%s` 37 | pprint 1 "NanoBSD image ${NANO_NAME} build starting" 38 | 39 | trap on_exit EXIT 40 | 41 | # Number of jobs to pass to make. Only applies to src so far. 42 | MAKE_JOBS=$(( 2 * $(sysctl -n kern.smp.cpus) + 1 )) 43 | if [ ${MAKE_JOBS} -gt 10 ]; then 44 | MAKE_JOBS=4 45 | fi 46 | export MAKE_JOBS 47 | 48 | NANO_PMAKE="${NANO_PMAKE} -j ${MAKE_JOBS}" 49 | 50 | mkdir -p ${MAKEOBJDIRPREFIX} 51 | printenv > ${MAKEOBJDIRPREFIX}/_.env 52 | make_conf_build 53 | build_world 54 | build_kernel 55 | 56 | # Override NANO_WORLDDIR, so that we create 57 | # the jail for building ports in a different 58 | # place from the directory used for creating 59 | # the final package. 60 | NANO_WORLDDIR=${NANO_OBJ}/_.j 61 | rm -fr ${NANO_WORLDDIR} 62 | mkdir -p ${NANO_OBJ} ${NANO_WORLDDIR} 63 | printenv > ${NANO_OBJ}/_.env 64 | make_conf_install 65 | install_world LOG=_.ij 66 | install_etc LOG=_.etcj 67 | setup_nanobsd_etc 68 | install_kernel LOG=_.ikj 69 | 70 | mkdir -p ${NANO_WORLDDIR}/wrkdirs 71 | 72 | if [ -e "${NANO_WORLDDIR}/bin/freebsd-version" ] ; then 73 | nVer=`${NANO_WORLDDIR}/bin/freebsd-version | cut -d '-' -f 1-2` 74 | update_version_env "$nVer" 75 | else 76 | update_version_env "10.3-RELEASE" 77 | fi 78 | -------------------------------------------------------------------------------- /freenas/scripts/kludges/install-info: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iXsystems/ixbuild/82222852bbf2aa85487d47465c1539f750c78906/freenas/scripts/kludges/install-info -------------------------------------------------------------------------------- /freenas/scripts/kludges/makeinfo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iXsystems/ixbuild/82222852bbf2aa85487d47465c1539f750c78906/freenas/scripts/kludges/makeinfo -------------------------------------------------------------------------------- /freenas/scripts/kludges/mklocale: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iXsystems/ixbuild/82222852bbf2aa85487d47465c1539f750c78906/freenas/scripts/kludges/mklocale -------------------------------------------------------------------------------- /freenas/scripts/kludges/mtree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iXsystems/ixbuild/82222852bbf2aa85487d47465c1539f750c78906/freenas/scripts/kludges/mtree -------------------------------------------------------------------------------- /iocage/iocage-ports: -------------------------------------------------------------------------------- 1 | archivers/par2cmdline-tbb 2 | databases/mysql56-server 3 | databases/rrdtool 4 | databases/postgresql95-client 5 | databases/postgresql95-contrib 6 | databases/postgresql95-server 7 | databases/postgresql96-client 8 | databases/postgresql96-contrib 9 | databases/postgresql96-server 10 | devel/cloudstack 11 | devel/gettext-runtime 12 | devel/icu 13 | devel/jenkins 14 | devel/jenkins-lts 15 | devel/gitlab-runner 16 | graphics/pecl-imagick 17 | graphics/pecl-imagick@php71 18 | games/minecraft-server 19 | irc/irssi 20 | irc/quassel-core 21 | irc/weechat 22 | multimedia/emby-server 23 | multimedia/plexmediaserver 24 | multimedia/plexmediaserver-plexpass 25 | multimedia/zoneminder 26 | multimedia/x264 27 | net/nss_ldap 28 | net/openldap24-client 29 | net/samba48 30 | net/rsync 31 | net/rsync-bpc 32 | net-p2p/btsync 33 | net-p2p/bitcoin-daemon 34 | net-p2p/bitcoin-utils 35 | net-p2p/couchpotato 36 | net-p2p/deluge-cli 37 | net-p2p/qbittorrent@nox 38 | net-p2p/radarr 39 | net-p2p/sonarr 40 | net-p2p/transmission-daemon 41 | www/transmission-web 42 | net-p2p/xmrig 43 | net/syncthing 44 | net-mgmt/unifi5 45 | net-mgmt/unifi-lts 46 | news/sabnzbdplus 47 | print/indexinfo 48 | security/clamav 49 | security/pam_ldap 50 | security/sudo 51 | sysutils/backuppc4 52 | sysutils/bacula9-client 53 | sysutils/bacula9-server 54 | sysutils/bacula-client 55 | sysutils/bacula-server 56 | sysutils/cdrtools 57 | sysutils/munin-node 58 | sysutils/kiconvtool 59 | sysutils/tarsnap 60 | textproc/libxml2 61 | textproc/p5-XML-RSS 62 | www/apache24 63 | www/fcgiwrap 64 | www/gitlab-ce 65 | www/madsonic-standalone 66 | www/nextcloud 67 | www/nextcloud@php71 68 | www/nginx 69 | www/redmine 70 | www/subsonic-standalone 71 | www/transmission-web 72 | www/tt-rss 73 | www/mod_perl2 74 | -------------------------------------------------------------------------------- /iocage/port-options.conf: -------------------------------------------------------------------------------- 1 | multimedia_ffmpeg_SET=X11GRAB SDL AACPLUS LAME FDK_AAC V4L AAS OPUS X265 2 | graphics_ImageMagick_UNSET=16BIT_PIXEL 3 | www_nextcloud_SET=IMAGICK 4 | net-p2p_bitcoin-daemon_SET=ZMQ 5 | -------------------------------------------------------------------------------- /iocage/run-poudriere.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | PJAILNAME="iocage" 4 | PPORTS="iocports" 5 | ZROOT="/poud" 6 | POUDCONFDIR="${PROGDIR}/poudriere" 7 | PORTS_GIT_URL="https://github.com/freenas/iocage-ports.git" 8 | PORTS_GIT_BRANCH="master" 9 | JAILVER="11.2-RELEASE" 10 | PPKGDIR="${ZROOT}/data/packages/${PJAILNAME}-${PPORTS}" 11 | PPORTSDIR="${ZROOT}/ports/${PPORTS}" 12 | 13 | if [ ! -d "$POUDCONFDIR" ] ; then 14 | mkdir -p ${POUDCONFDIR} 15 | fi 16 | 17 | mk_poud_config() 18 | { 19 | 20 | # Get the memory in MB on system 21 | MEM=$(sysctl -n hw.physmem) 22 | MEM=$(expr $MEM / 1024) 23 | MEM=$(expr $MEM / 1024) 24 | 25 | CPUS=$(sysctl -n kern.smp.cpus) 26 | if [ $CPUS -gt 64 ] ; then 27 | BUILDERS="64" 28 | JOBS="YES" 29 | else 30 | BUILDERS="$CPUS" 31 | JOBS="NO" 32 | fi 33 | 34 | # Determine TMPFS usage based upon Memory to CPUs ratio 35 | MEMPERBUILDER=$(expr $MEM / $CPUS) 36 | if [ $MEMPERBUILDER -gt 1500 ]; then 37 | TMPWRK="all" 38 | elif [ $MEMPERBUILDER -gt 750 ] ; then 39 | TMPWRK="wrkdirs" 40 | else 41 | TMPWRK="no" 42 | fi 43 | 44 | # Allow these defaults to be overridden 45 | BCONF="/usr/local/etc/poudriere-builders.conf" 46 | if [ -e "$BCONF" ] ; then 47 | grep -q "^BUILDERS=" ${BCONF} 48 | if [ $? -eq 0 ] ; then 49 | BUILDERS=$(grep "^BUILDERS=" ${BCONF} | cut -d '=' -f 2) 50 | fi 51 | grep -q "^JOBS=" ${BCONF} 52 | if [ $? -eq 0 ] ; then 53 | JOBS=$(grep "^JOBS=" ${BCONF} | cut -d '=' -f 2) 54 | fi 55 | grep -q "^TMPFSWORK=" ${BCONF} 56 | if [ $? -eq 0 ] ; then 57 | TMPWRK=$(grep "^TMPFSWORK=" ${BCONF} | cut -d '=' -f 2) 58 | fi 59 | fi 60 | 61 | # Figure out ZFS settings 62 | ZPOOL=$(mount | grep 'on / ' | cut -d '/' -f 1) 63 | 64 | cat >${POUDCONFDIR}/poudriere.conf << EOF 65 | ZPOOL=$ZPOOL 66 | ZROOTFS=$ZROOT 67 | FREEBSD_HOST=file://${DISTDIR} 68 | BUILD_AS_NON_ROOT=no 69 | RESOLV_CONF=/etc/resolv.conf 70 | BASEFS=/poud 71 | USE_PORTLINT=no 72 | USE_TMPFS=${TMPWRK} 73 | DISTFILES_CACHE=/usr/ports/distfiles 74 | CHECK_CHANGED_OPTIONS=verbose 75 | CHECK_CHANGED_DEPS=yes 76 | PARALLEL_JOBS=${BUILDERS} 77 | WRKDIR_ARCHIVE_FORMAT=txz 78 | ALLOW_MAKE_JOBS_PACKAGES="pkg ccache py* llvm* libreoffice* apache-openoffice* webkit* firefox* chrom* gcc* qt5-*" 79 | MAX_EXECUTION_TIME=86400 80 | NOHANG_TIME=12600 81 | ATOMIC_PACKAGE_REPOSITORY=no 82 | PKG_REPO_FROM_HOST=yes 83 | BUILDER_HOSTNAME=builds.trueos.org 84 | PRIORITY_BOOST="pypy openoffice* paraview webkit* llvm*" 85 | GIT_URL=${PORTS_GIT_URL} 86 | FREEBSD_HOST=https://download.freebsd.org 87 | USE_COLORS=yes 88 | NOLINUX=yes 89 | EOF 90 | 91 | if [ "$JOBS" = "yes" ] ; then 92 | echo "ALLOW_MAKE_JOBS=yes" >> ${POUDCONFDIR}/poudriere.conf 93 | fi 94 | # Check if we have a ccache dir to be used 95 | if [ -e "/ccache" ] ; then 96 | echo "CCACHE_DIR=/ccache" >> ${POUDCONFDIR}/poudriere.conf 97 | fi 98 | 99 | # Set any port make options 100 | if [ ! -d "${POUDCONFDIR}/poudriere.d" ] ; then 101 | mkdir -p ${POUDCONFDIR}/poudriere.d 102 | fi 103 | cp ${PROGDIR}/iocage/port-options.conf ${POUDCONFDIR}/poudriere.d/${PJAILNAME}-make.conf 104 | 105 | } 106 | 107 | do_portsnap() 108 | { 109 | mk_poud_config 110 | 111 | # Kill any previous running jail 112 | poudriere -e ${POUDCONFDIR} jail -k -j ${PJAILNAME} -p ${PPORTS} 2>/dev/null 113 | 114 | echo "Removing old ports dir..." 115 | poudriere -e ${POUDCONFDIR} ports -p ${PPORTS} -d 116 | rm -rf /poud/ports/${PPORTS} 117 | 118 | echo "Pulling ports from ${PORTS_GIT_URL} - ${PORTS_GIT_BRANCH}" 119 | poudriere -e ${POUDCONFDIR} ports -c -p ${PPORTS} -B ${PORTS_GIT_BRANCH} -m git 120 | if [ $? -ne 0 ] ; then 121 | exit_err "Failed pulling ports tree" 122 | fi 123 | 124 | # Adjust the minecraft-server Makefile 125 | cat ${PPORTSDIR}/games/minecraft-server/Makefile \ 126 | | grep -v "^LICENSE" > ${PPORTSDIR}/games/minecraft-server/Makefile.new 127 | mv ${PPORTSDIR}/games/minecraft-server/Makefile.new \ 128 | ${PPORTSDIR}/games/minecraft-server/Makefile 129 | } 130 | 131 | update_poud_world() 132 | { 133 | echo "Removing old jail - $PJAILNAME" 134 | poudriere -e ${POUDCONFDIR} jail -d -j $PJAILNAME 135 | rm -rf /poud/jails/$PJAILNAME 136 | 137 | echo "Creating new jail: $PJAILNAME - $JAILVER" 138 | poudriere -e ${POUDCONFDIR} jail -c -j $PJAILNAME -v $JAILVER -m http 139 | if [ $? -ne 0 ] ; then 140 | exit_err "Failed creating poudriere jail" 141 | fi 142 | } 143 | 144 | # Kill any previous running jail 145 | poudriere -e ${POUDCONFDIR} jail -k -j ${PJAILNAME} -p ${PPORTS} 2>/dev/null 146 | 147 | # Cleanup old packages? 148 | POUDFLAGS="" 149 | if [ "$WIPEPOUDRIERE" = "true" ] ; then 150 | POUDFLAGS="-c" 151 | fi 152 | 153 | # Create the poud config 154 | mk_poud_config 155 | 156 | # Extract the world for this poud build 157 | update_poud_world 158 | 159 | # Update the ports tree 160 | do_portsnap 161 | 162 | # Start the build 163 | poudriere -e ${POUDCONFDIR} bulk ${POUDFLAGS} -j ${PJAILNAME} -p ${PPORTS} -f ${PROGDIR}/iocage/iocage-ports 164 | if [ $? -ne 0 ] ; then 165 | echo "Failed poudriere build..." 166 | exit 1 167 | fi 168 | 169 | # Signing script 170 | if [ -n "$PKGSIGNCMD" ] ; then 171 | echo "Signing the packages with: ${PKGSIGNCMD}" 172 | cd ${PPKGDIR} 173 | if [ $? -ne 0 ] ; then exit 1 ; fi 174 | pkg repo . signing_command: ${PKGSIGNCMD} 175 | if [ $? -ne 0 ] ; then exit 1 ; fi 176 | fi 177 | 178 | 179 | # Build passed, lets rsync it off this node 180 | if [ -z "$SFTPHOST" ] ; then return 0 ; fi 181 | 182 | # Now rsync this sucker 183 | echo "Copying packages to staging area... ${PPKGDIR}/ -> ${SFTPFINALDIR}/pkg/iocage" 184 | rsync -a --delete ${PPKGDIR}/ ${SFTPFINALDIR}/pkg/iocage/unstable 185 | if [ $? -ne 0 ] ; then exit 1 ; fi 186 | -------------------------------------------------------------------------------- /jenkins.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Change directory 4 | mypath=`realpath $0` 5 | cd `dirname $mypath` 6 | export PROGDIR="`realpath`" 7 | 8 | if [ -z "$JENKINS_DO_UPDATE" ] ; then 9 | 10 | # Git pull may fail if this isn't set 11 | if [ -z "$(git config --global user.email)" ] ; then 12 | git config --global user.email "jenkins@example.com" 13 | git config --global user.name "Jenkins Node" 14 | fi 15 | 16 | # Before we begin any build, make sure we are updated from git 17 | git reset --hard 18 | git pull 19 | export JENKINS_DO_UPDATE="YES" 20 | ./jenkins.sh "$1" "$2" "$3" 21 | exit $? 22 | fi 23 | 24 | # Set the variables 25 | TYPE="${1}" 26 | BUILD="${2}" 27 | BRANCH="${3}" 28 | 29 | # Set JENKINS var 30 | export USING_JENKINS="YES" 31 | 32 | # Pkg does stuff now with ABIs and it prevents updating the database 33 | export IGNORE_OSVERSION="YES" 34 | 35 | display_usage() { 36 | 37 | cat << EOF 38 | Available Commands: 39 | 40 | -- FreeNAS Commands -- 41 | freenas - Builds FreeNAS release 42 | freenas-docs - Create FreeNAS Handbook 43 | freenas-tn-docs - Create TrueNAS Handbook 44 | freenas-api - Create FreeNAS API 45 | freenas-push-docs - Push FreeNAS Docs 46 | freenas-push-tn-docs - Push TrueNAS Docs 47 | freenas-push-api - Push FreeNAS API 48 | freenas-push-nightly - Run 'release-push' for FreeNAS Nightly 49 | freenas-push - Run 'release-push' for FreeNAS / TrueNAS 50 | mkcustard - Build a Custard VM 51 | mktrueview - Build a TrueView VM 52 | 53 | -- TrueOS Commands -- 54 | trueos-world - Builds the world 55 | trueos-pkg - Builds the entire pkg repo 56 | trueos-iso-pkg - Builds just the pkgs needed for ISO creation 57 | trueos-iso - Builds the ISO files 58 | trueos-vm - Builds the VM images 59 | publish-iso - Upload ISO files to ScaleEngine 60 | publish-iso-edge - Upload ISO files to ScaleEngine (Bleeding Edge) 61 | publish-pkg - Upload PKG files to ScaleEngine 62 | publish-pkg-edge - Upload PKG files to ScaleEngine (Bleeding Edge) 63 | publish-pkg-unstable - Upload PKG files to ScaleEngine (Unstable) 64 | publish-pkg-ipfs - Add and pin PKG files to IPFS repo 65 | promote-pkg - Promote packages from UNSTABLE -> STABLE 66 | trueos-docs - Create TrueOS handbook 67 | push-trueos-docs - Upload TrueOS handbook 68 | lumina-docs - Create lumina handbook 69 | push-lumina-docs - Upload lumina handbook 70 | ports-tests - Test building a repo port files 71 | 72 | -- SysAdm Commands -- 73 | sysadm-docs - Build SysAdm handbook 74 | push-sysadm-docs - Upload SysAdm handbook 75 | sysadm-api - Build SysAdm API handbook 76 | push-sysadm-api - Upload SysAdm API handbook 77 | 78 | -- iocage Commands -- 79 | iocage_pkgs - Build iocage package set 80 | iocage_pkgs_push - Push iocage package set public 81 | EOF 82 | 83 | } 84 | 85 | if [ -z "$1" ] ; then 86 | display_usage 87 | exit 1 88 | fi 89 | 90 | # Source our functions 91 | . build.conf 92 | . functions.sh 93 | 94 | ###################################################### 95 | 96 | case $TYPE in 97 | trueos-world) jenkins_world ;; 98 | trueos-pkg) jenkins_pkg "release" ;; 99 | trueos-iso-pkg) jenkins_pkg "iso" ;; 100 | sysadm-api) jenkins_sysadm_api ;; 101 | push-sysadm-api) jenkins_sysadm_push_api ;; 102 | sysadm-docs) jenkins_sysadm_docs ;; 103 | push-sysadm-docs) jenkins_sysadm_push_docs ;; 104 | trueos-docs) jenkins_trueos_docs ;; 105 | push-trueos-docs) jenkins_trueos_push_docs ;; 106 | lumina-docs) jenkins_trueos_lumina_docs ;; 107 | push-lumina-docs) jenkins_trueos_push_lumina_docs ;; 108 | trueos-iso) jenkins_iso ;; 109 | publish-iso) jenkins_publish_iso ;; 110 | publish-iso-edge) jenkins_publish_iso "edge" ;; 111 | publish-pkg) jenkins_publish_pkg ;; 112 | publish-pkg-edge) jenkins_publish_pkg "edge" ;; 113 | publish-pkg-unstable) jenkins_publish_pkg "unstable" ;; 114 | publish-pkg-ipfs) jenkins_publish_pkg_ipfs ;; 115 | publish-pkg-ipfs-stable) jenkins_publish_pkg_ipfs "stable" ;; 116 | promote-pkg) jenkins_promote_pkg ;; 117 | trueos-vm) jenkins_vm ;; 118 | jail) jenkins_jail ;; 119 | iocage_pkgs) jenkins_iocage_pkgs ;; 120 | iocage_pkgs_push) jenkins_iocage_pkgs_push ;; 121 | freenas) jenkins_freenas ;; 122 | freenas-tn-docs) jenkins_truenas_docs ;; 123 | freenas-docs) jenkins_freenas_docs ;; 124 | freenas-push-docs) jenkins_freenas_push_docs "freenas" ;; 125 | freenas-push-tn-docs) jenkins_freenas_push_docs "truenas" ;; 126 | freenas-api) jenkins_freenas_api ;; 127 | freenas-push-api) jenkins_freenas_push_api ;; 128 | freenas-push-be) jenkins_freenas_push_be ;; 129 | freenas-push-nightly) jenkins_freenas_push_nightly ;; 130 | freenas-push) jenkins_freenas_push ;; 131 | freenas-combo) jenkins_freenas 132 | jenkins_freenas_tests 133 | ;; 134 | mkcustard) jenkins_mkcustard ;; 135 | mktrueview) jenkins_mktrueview ;; 136 | ports-tests) jenkins_ports_tests ;; 137 | *) echo "Invalid command: $1" 138 | display_usage 139 | exit 1 140 | ;; 141 | esac 142 | -------------------------------------------------------------------------------- /prepnode/freenas-update.conf: -------------------------------------------------------------------------------- 1 | [Defaults] 2 | update_server = internal 3 | [internal] 4 | name = QA Update Server 5 | url = http://builds.ixsystems.com/updates/FreeNAS/ 6 | signing = False 7 | -------------------------------------------------------------------------------- /prepnode/mknode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ $(id -u) != "0" ] ; then 4 | echo "This must be run as root!" 5 | exit 1 6 | fi 7 | 8 | echo "How do you wish to prep this system?" 9 | echo "node - Builder to connect to existing Jenkins server" 10 | echo "master - Deploy Jenkins server and run local node" 11 | echo -e "node>\c" 12 | read ans 13 | if [ -z "$ans" ] ; then ans="node"; fi 14 | case $ans in 15 | node|NODE) PREPTYPE="NODE";; 16 | master|MASTER) PREPTYPE="MASTER";; 17 | *) ;; 18 | esac 19 | 20 | which sudo >/dev/null 2>/dev/null 21 | if [ $? -ne 0 ]; then 22 | echo "Installing sudo.." 23 | pkg install -y security/sudo 24 | fi 25 | 26 | which pigz >/dev/null 2>/dev/null 27 | if [ $? -eq 0 ]; then 28 | pkg install -y pigz 29 | fi 30 | 31 | which git >/dev/null 2>/dev/null 32 | if [ $? -ne 0 ]; then 33 | echo "Installing git.." 34 | pkg install -y devel/git 35 | fi 36 | 37 | pkg info -q python3 >/dev/null 2>/dev/null 38 | if [ $? -ne 0 ]; then 39 | echo "Installing python3.." 40 | pkg install -y python3 41 | fi 42 | 43 | which jq >/dev/null 2>/dev/null 44 | if [ $? -ne 0 ]; then 45 | echo "Installing jq.." 46 | pkg install -y jq 47 | fi 48 | 49 | which git >/dev/null 2>/dev/null 50 | if [ $? -ne 0 ]; then 51 | echo "Failed installing git!" 52 | exit 1 53 | fi 54 | 55 | if [ "$PREPTYPE" = "NODE" ] ; then 56 | pkg info -q openjdk8 >/dev/null 2>/dev/null 57 | if [ "$?" != "0" ]; then 58 | pkg install -y openjdk8 59 | # we need to add the jenkins group otherwise build failes 60 | pw groupadd jenkins 61 | if [ "$?" != "0" ]; then 62 | echo "Failed installing openjdk8!" 63 | exit 1 64 | fi 65 | fi 66 | 67 | if [ -d "/ixbuild" ] ; then 68 | echo "/ixbuild already exists! Remove this directory to continue!" 69 | exit 1 70 | fi 71 | 72 | git clone --depth=1 https://github.com/iXsystems/ixbuild.git /ixbuild 73 | if [ $? -ne 0 ] ; then 74 | echo "Failed cloning into /ixbuild" 75 | exit 1 76 | fi 77 | 78 | if [ ! -d "/usr/local/etc/sudoers.d" ] ; then 79 | mkdir -p /usr/local/etc/sudoers.d 80 | fi 81 | cp ./sudo-ixbuild /usr/local/etc/sudoers.d/ixbuild 82 | chmod 644 /usr/local/etc/sudoers.d/ixbuild 83 | 84 | # Copy over the build.conf defaults 85 | cp /ixbuild/build.conf.dist /ixbuild/build.conf 86 | 87 | if [ "$PREPTYPE" = "MASTER" ] ; then 88 | pkg info -q jenkins >/dev/null 2>/dev/null 89 | if [ "$?" != "0" ]; then 90 | pkg install -y jenkins 91 | if [ "$?" != "0" ]; then 92 | echo "Failed installing jenkins!" 93 | exit 1 94 | fi 95 | fi 96 | 97 | # Get the pre-built jenkins config 98 | rm -rf /usr/local/jenkins >/dev/null 2>/dev/null 99 | echo "Downloading Jenkins config..." 100 | fetch -o /tmp/jenkins-master.txz http://update.cdn.pcbsd.org/jenkins-config/master.txz 101 | if [ $? -ne 0 ] ; then 102 | echo "Failed downloading Jenkins config!" 103 | exit 1 104 | fi 105 | tar xvpf /tmp/jenkins-master.txz -C /usr/local >/dev/null 2>/dev/null 106 | if [ $? -ne 0 ] ; then 107 | echo "Failed extracting Jenkins config!" 108 | exit 1 109 | fi 110 | rm /tmp/jenkins-master.txz 111 | chown -R jenkins:jenkins /usr/local/jenkins 112 | 113 | # Enable Jenkins 114 | sysrc -f /etc/rc.conf jenkins_enable="YES" 115 | 116 | # Start Jenkins 117 | service jenkins start 118 | if [ $? -ne 0 ] ; then 119 | echo "Failed starting Jenkins!" 120 | exit 1 121 | fi 122 | 123 | echo "" 124 | echo "**************************************************************" 125 | echo "Jenkins is started and running on http://localhost:8180/jenkins/" 126 | echo "You should connect and setup a username / password!" 127 | echo "**************************************************************" 128 | 129 | else 130 | echo "" 131 | echo "**************************************************************" 132 | echo "Jenkins node is ready to begin builds." 133 | echo " " 134 | echo "Build targets in /ixbuild/builds/" 135 | echo "Run /ixbuild/jenkins.sh for list of build commands" 136 | echo " " 137 | echo "EXAMPLE:" 138 | echo "sudo /ixbuild/jenkins.sh freenas-combo freenas-9" 139 | fi 140 | 141 | 142 | -------------------------------------------------------------------------------- /prepnode/sudo-ixbuild: -------------------------------------------------------------------------------- 1 | %jenkins ALL = NOPASSWD: /ixbuild/jenkins.sh 2 | Defaults env_keep += "BUILD_NUMBER BUILD_ID BUILD_DISPLAY_NAME JOB_NAME BUILD_TAG EXECUTOR_NUMBER" 3 | Defaults env_keep += "NODE_NAME NODE_LABELS WORKSPACE JENKINS_HOME JENKINS_URL BUILD_URL IXBUILDBRANCH" 4 | Defaults env_keep += "BUILDINCREMENTAL LIVEHOST LIVEUSER LIVEPASS ARTIFACTONFAIL ARTIFACTONSUCCESS" 5 | Defaults env_keep += "JENKINSPRODUCTION JENKINSVERSION JENKINSINTUPDATE RELENG_PASSWORD WIPEPOUDRIERE" 6 | Defaults env_keep += "DELPOUDRIEREPKGS PKGSIGNCMD TARGETDATE PRBUILDER" 7 | Defaults env_keep += "BRIDGEIP BRIDGENETMASK BRIDGEGW BRIDGEDNS BRIDGEHOST BRIDGEHOST_B BRIDGEDOMAIN" 8 | Defaults env_keep += "JENKINSBUILDENV DEFAULT_IP4POOL FNASTESTIP JAILIP JAILNETMASK JAILGW" 9 | Defaults env_keep += "VI_SERVER VI_USERNAME VI_PASSWORD VI_CFG VM VMBACKEND ADUSERNAME ADPASSWORD ADUSERNAME2" 10 | Defaults env_keep += "ADPASSWORD2 NOIPUSERNAME NOIPPASSWORD NOIPHOST LDAPHOSTNAME LDAPBASEDN LDAPBINDDN LDAPBINDPASSWORD" 11 | Defaults env_keep += "OSX_HOST OSX_USERNAME OSX_PASSWORD BSD_HOST BSD_USERNAME BSD_PASSWORD" 12 | Defaults env_keep += "LDAPHOSTNAME2 LDAPBASEDN2 LDAPBINDDN2 LDAPBINDPASSWORD2 PRODUCTNAME RSYNCHOST PUSHPATH" 13 | Defaults env_keep += "ghprbTargetBranch ghprbSourceBranch ghprbGhRepository ghprbCommentBody ghprbPullDescription" 14 | Defaults env_keep += "ghprbPullLongDescription" 15 | Defaults env_keep += "NOMIDDLEWARED" 16 | -------------------------------------------------------------------------------- /prepnode/truenas-update.conf: -------------------------------------------------------------------------------- 1 | [Defaults] 2 | update_server = internal 3 | [internal] 4 | name = QA Update Server 5 | url = http://builds.ixsystems.com/updates/TrueNAS/ 6 | signing = False 7 | -------------------------------------------------------------------------------- /trueos/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | # Makefile for building: PCBSD 3 | ############################################################################# 4 | 5 | ####### Install 6 | 7 | all: 8 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh all 9 | image: 10 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh iso 11 | iso: 12 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh iso 13 | vm: 14 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh vm 15 | world: 16 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh world 17 | jail: 18 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh jail 19 | check-ports: 20 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh check-ports 21 | ports: 22 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh ports 23 | iso-ports: 24 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh iso-ports 25 | ports-update-all: 26 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh ports-update-all 27 | ports-update-pcbsd: 28 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh ports-update-pcbsd 29 | pbi-index: 30 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh pbi-index 31 | clean: 32 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh clean 33 | menu: 34 | @cd ${.CURDIR}/scripts/ && sh build-iso.sh menu 35 | -------------------------------------------------------------------------------- /trueos/kludges/boot1.efifat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iXsystems/ixbuild/82222852bbf2aa85487d47465c1539f750c78906/trueos/kludges/boot1.efifat -------------------------------------------------------------------------------- /trueos/pbi-dist/pkgng-repo: -------------------------------------------------------------------------------- 1 | pcbsd-major:/usr/local/etc/pkg/repos/pcbsd.conf 2 | -------------------------------------------------------------------------------- /trueos/pbi-dist/repokey.ssl: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIICHTANBgkqhkiG9w0BAQEFAAOCAgoAMIICBQKCAfwA62ZwkgVMfiu2nwplXCjr 3 | CEozHYghv3voPnW/4fNaG0fUrlTBTMEGJxA3y2Gpsft182tcXcU+jZ1FgcshHE2P 4 | MpIfYW11hngEmPtB4LnsKhz0ZjcxkibwW9THCMZTJ3YU04D8xJbWHufvUGw/hxHT 5 | HWHfOysgJBzU8/XGL9x++2b2KCdLlvGZWdCtpNxUF91quAyohAR1oBx7wZFlrg3O 6 | yTTQ+CVFrTdts71e543B6YEhfkqjEo2+mzEawX2bsrZWAxfiQepVViUYwegxRwuY 7 | GmF2avAT9nHKkaHpmgS1mE7agQ3MRJv9I2btfAtqlnuNlqnyMMeh5uBoZuIfjfUH 8 | OoNMRlAY2jfKClJysESvqZyoRgycYSddA26hiq6GLncO5v7FaaJlw6koEwqy7RA7 9 | wFmfoIOLbHG5hPIC4LNPkq3PqGo0nxJYNk0SaIu3vCfbaPmL2o0gzJ412j/5m2kq 10 | vra58J4kGgHL09p3hzU8XwRvegdplHjZrKY8Hl2C4kCMfXGOuuTf+fY3LisFK7am 11 | EAjH1/5Y+C3HQZTKHJ8rQbbQtKv7pzsowfTGYgQ7MzrRBu9QJ8HtXYiiLESIIgjp 12 | o2bBCFYZCsFjgkIABaEAZiMp2zy7xsyXoLvdvQsDMwS2C7N428E4n7tLHPreIZ8J 13 | pT0X/R7TNn6c4kqRAgMBAAE= 14 | -----END PUBLIC KEY----- 15 | -------------------------------------------------------------------------------- /trueos/pkg-dist/fingerprints/trueos/trusted/pkg.cdn.pcbsd.org.20131209: -------------------------------------------------------------------------------- 1 | function: sha256 2 | fingerprint: b2b9e037f938cf20ba68aa85ac88c15889c729a7f6b70c25069774308e760a03 3 | -------------------------------------------------------------------------------- /trueos/pkg-dist/repos/trueos.conf.dist: -------------------------------------------------------------------------------- 1 | pcbsd: { 2 | url: "http://pkg.cdn.pcbsd.org/VERSION/ARCH", 3 | signature_type: "fingerprints", 4 | fingerprints: "/usr/local/etc/pkg/fingerprints/pcbsd", 5 | enabled: true 6 | } 7 | -------------------------------------------------------------------------------- /trueos/repo.conf.dist: -------------------------------------------------------------------------------- 1 | pcbsd-build: { 2 | url: "http://pkg.cdn.pcbsd.org/%RELVERSION%/%ARCH%", 3 | enabled: true 4 | } 5 | -------------------------------------------------------------------------------- /trueos/scripts/1.createworld.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Where is the build program installed 4 | PROGDIR="`realpath | sed 's|/scripts||g'`" ; export PROGDIR 5 | 6 | # Source the config file 7 | . ${PROGDIR}/trueos.cfg 8 | 9 | cd ${PROGDIR}/scripts 10 | 11 | # Source our functions 12 | . ${PROGDIR}/scripts/functions.sh 13 | 14 | create_dist_files() { 15 | 16 | # Create the FreeBSD Dist Files 17 | if [ -n "${DISTDIR}" -a -d "${DISTDIR}" ] ; then 18 | rm -rf ${DISTDIR} 19 | fi 20 | mkdir ${DISTDIR} 2>/dev/null 21 | 22 | # cd to release dir, and clean and make 23 | cd ${WORLDSRC}/release 24 | make clean ${SYS_MAKEFLAGS} 25 | 26 | # Create the FTP files 27 | make ftp NOPORTS=yes ${SYS_MAKEFLAGS} 28 | if [ $? -ne 0 ] ; then 29 | echo "Failed running: make ftp NOPORTS=yes ${SYS_MAKEFLAGS}" 30 | exit 1 31 | fi 32 | rc_halt "mv ${WORLDSRC}/release/ftp/* ${DISTDIR}/" 33 | 34 | # Cleanup old .txz files 35 | cd ${WORLDSRC}/release 36 | make clean ${SYS_MAKEFLAGS} 37 | 38 | return 0 39 | } 40 | 41 | create_base_pkg_files() 42 | { 43 | cd ${WORLDSRC} 44 | 45 | if [ -n "${PROGDIR}/fbsd-pkg" -a -d "${PROGDIR}/fbsd-pkg" ] ; then 46 | rm -rf ${PROGDIR}/fbsd-pkg 47 | fi 48 | mkdir ${PROGDIR}/fbsd-pkg 2>/dev/null 49 | 50 | # Unset some variables which may be getting in the way 51 | ODISTDIR="$DISTDIR" 52 | OWORLDSRC="$WORLDSRC" 53 | unset DISTDIR WORLDSRC 54 | 55 | # Create the package files now 56 | make packages ${SYS_MAKEFLAGS} 57 | if [ $? -ne 0 ] ; then 58 | env 59 | echo "Failed running: make packages ${SYS_MAKEFLAGS}" 60 | exit 1 61 | fi 62 | 63 | # Move the package files and prep them 64 | mv /usr/obj/usr/src/repo/*/latest/* ${PROGDIR}/fbsd-pkg/ 65 | if [ $? -ne 0 ] ; then 66 | echo "Failed moving packages" 67 | exit 1 68 | fi 69 | 70 | # This is super ugly, remove it once they properly fix pkg 71 | # grab all the distrib files 72 | rc_halt "mkdir ${PROGDIR}/fbsd-distrib" 73 | cd /usr/src 74 | make distrib-dirs DESTDIR=${PROGDIR}/fbsd-distrib ${SYS_MAKEFLAGS} 75 | if [ $? -ne 0 ] ; then 76 | env 77 | echo "Failed running: make distrib-dirs ${SYS_MAKEFLAGS}" 78 | exit 1 79 | fi 80 | make distribution DESTDIR=${PROGDIR}/fbsd-distrib ${SYS_MAKEFLAGS} 81 | if [ $? -ne 0 ] ; then 82 | env 83 | echo "Failed running: make distribution ${SYS_MAKEFLAGS}" 84 | exit 1 85 | fi 86 | 87 | # Couple of files also missed by pkg base 88 | rc_halt "tar xvpf ${ODISTDIR}/base.txz -C ${PROGDIR}/fbsd-distrib ./usr/lib/libgcc_eh.a ./usr/lib/libgcc_eh_p.a" 89 | rc_halt "tar xvpf ${ODISTDIR}/base.txz -C ${PROGDIR}/fbsd-distrib ./usr/share/examples" 90 | rc_halt "tar xvpf ${ODISTDIR}/base.txz -C ${PROGDIR}/fbsd-distrib ./usr/share/calendar" 91 | rc_nohalt "tar xvpf ${ODISTDIR}/base.txz -C ${PROGDIR}/fbsd-distrib ./usr/share/tmac" 92 | rc_halt "tar xvpf ${ODISTDIR}/base.txz -C ${PROGDIR}/fbsd-distrib ./usr/include" 93 | 94 | # Signing script 95 | if [ -n "$PKGSIGNCMD" ] ; then 96 | echo "Signing base packages..." 97 | rc_halt "cd ${PROGDIR}/fbsd-pkg/" 98 | rc_halt "pkg repo . signing_command: ${PKGSIGNCMD}" 99 | fi 100 | 101 | rc_halt "tar cvJf ${PROGDIR}/fbsd-pkg/fbsd-distrib.txz -C ${PROGDIR}/fbsd-distrib ." 102 | rc_halt "openssl dgst -sha1 -sign /etc/ssl/pcbsd-pkgng.key -out ${PROGDIR}/fbsd-pkg/fbsd-distrib.txz.sha1 ${PROGDIR}/fbsd-pkg/fbsd-distrib.txz" 103 | rm -rf ${PROGDIR}/fbsd-distrib 104 | 105 | WORLDSRC="$OWORLDSRC" 106 | DISTDIR="$ODISTDIR" 107 | return 0 108 | } 109 | 110 | # Create a static tarball 111 | create_tarball() { 112 | 113 | if [ -n "${DISTDIR}" -a -d "${DISTDIR}" ] ; then 114 | rm -rf ${DISTDIR} 115 | fi 116 | mkdir ${DISTDIR} 2>/dev/null 117 | 118 | rc_halt "mkdir ${PROGDIR}/fbsd-distrib" 119 | make installworld DESTDIR=${PROGDIR}/fbsd-distrib ${SYS_MAKEFLAGS} 120 | if [ $? -ne 0 ] ; then 121 | echo "Failed running: make installworld ${SYS_MAKEFLAGS}" 122 | exit 1 123 | fi 124 | 125 | make distribution DESTDIR=${PROGDIR}/fbsd-distrib ${SYS_MAKEFLAGS} 126 | if [ $? -ne 0 ] ; then 127 | echo "Failed running: make distribution ${SYS_MAKEFLAGS}" 128 | exit 1 129 | fi 130 | 131 | make installkernel DESTDIR=${PROGDIR}/fbsd-distrib ${SYS_MAKEFLAGS} 132 | if [ $? -ne 0 ] ; then 133 | echo "Failed running: make installkernel ${SYS_MAKEFLAGS}" 134 | exit 1 135 | fi 136 | 137 | # Create the tarball 138 | rc_halt "tar cvJf ${DISTDIR}/fbsd-dist.txz -C ${PROGDIR}/fbsd-distrib ." 139 | rm -rf ${PROGDIR}/fbsd-distrib 140 | chflags -R noschg ${PROGDIR}/fbsd-distrib 2>/dev/null 141 | rm -rf ${PROGDIR}/fbsd-distrib 2>/dev/null 142 | 143 | return 0 144 | } 145 | 146 | if [ -z "$DISTDIR" ] ; then 147 | DISTDIR="${PROGDIR}/fbsd-dist" 148 | fi 149 | 150 | # Ugly, but freebsd packages like to be built here for now 151 | if [ -n "$PKGBASE" ] ; then 152 | WORLDSRC="/usr/src" 153 | rm -rf /usr/obj/usr/src/repo/ >/dev/null 2>/dev/null 154 | fi 155 | 156 | # Make sure we have our freebsd sources 157 | if [ -d "${WORLDSRC}" ]; then 158 | rm -rf ${WORLDSRC} 159 | chflags -R noschg ${WORLDSRC} >/dev/null 2>/dev/null 160 | rm -rf ${WORLDSRC} >/dev/null 2>/dev/null 161 | fi 162 | mkdir -p ${WORLDSRC} 163 | rc_halt "git clone --depth=1 -b ${GITFBSDBRANCH} ${GITFBSDURL} ${WORLDSRC}" 164 | 165 | # Now create the world / kernel / distribution 166 | cd ${WORLDSRC} 167 | 168 | CPUS=`sysctl -n kern.smp.cpus` 169 | 170 | if [ "$BUILDTAG" = "trueos-ino64" ] ; then 171 | # Special build instructions 172 | echo "Doing ino64 setup..." 173 | cd ${WORLDSRC} 174 | cd sys/kern && touch syscalls.master && make sysent 175 | cd ${WORLDSRC} 176 | cd sys/compat/freebsd32 && touch syscalls.master && make sysent 177 | cd ${WORLDSRC} 178 | fi 179 | 180 | make -j $CPUS buildworld buildkernel ${SYS_MAKEFLAGS} 181 | if [ $? -ne 0 ] ; then 182 | echo "Failed running: make buildworld buildkernel ${SYS_MAKEFLAGS}" 183 | exit 1 184 | fi 185 | 186 | if [ -z "$BUILDTYPE" ] ; then 187 | BUILDTYPE="amd64" 188 | fi 189 | 190 | echo "Packaging as: $BUILDTYPE" 191 | case ${BUILDTYPE} in 192 | PICO) create_tarball && exit $? ;; 193 | *) create_dist_files 194 | if [ -n "$PKGBASE" ] ; then 195 | create_base_pkg_files 196 | fi 197 | ;; 198 | esac 199 | 200 | exit 0 201 | -------------------------------------------------------------------------------- /trueos/scripts/9.3.makedvd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Author: Kris Moore 3 | # Description: Creates the ISO file 4 | # Copyright: 2010 PC-BSD Software / iXsystems 5 | ############################################################################ 6 | 7 | # Where is the build program installed 8 | PROGDIR="`realpath | sed 's|/scripts||g'`" ; export PROGDIR 9 | 10 | # Source the config file 11 | . ${PROGDIR}/trueos.cfg 12 | 13 | cd ${PROGDIR}/scripts 14 | 15 | # Source our functions 16 | . ${PROGDIR}/scripts/functions.sh 17 | 18 | echo "Building DVD images.." 19 | 20 | ISODISTDIR="${PDESTDIR9}/dist" 21 | 22 | # Remove archive files 23 | if [ -d "${ISODISTDIR}" ] ; then 24 | echo "Removing ${ISODISTDIR}" 25 | rm -rf ${ISODISTDIR} 26 | fi 27 | mkdir ${ISODISTDIR} 28 | 29 | rc_halt "mkdir -p ${ISODISTDIR}/packages" 30 | rc_halt "mount_nullfs ${METAPKGDIR} ${ISODISTDIR}/packages" 31 | 32 | # Set the file-date 33 | fDate="`date '+%Y-%m-%d'`" 34 | 35 | if [ $DEFAULTPKGBRANCH = "UNSTABLE" ] ; then 36 | fDate="${fDate}-UNSTABLE" 37 | fi 38 | 39 | # Base file name 40 | if [ "$SYSBUILD" = "server" ] ; then 41 | if [ "$DEFAULTPKGBRANCH" = "UNSTABLE" ] ; then 42 | bFile="TrueOS-Server-${fDate}-${FARCH}" 43 | else 44 | bFile="TrueOS-Server-${ISOVER}-${FARCH}" 45 | fi 46 | bTitle="TrueOS" 47 | brand="trueos" 48 | touch ${PDESTDIR9}/trueos-server 49 | else 50 | if [ "$DEFAULTPKGBRANCH" = "UNSTABLE" ] ; then 51 | bFile="TrueOS-Desktop-${fDate}-${FARCH}" 52 | else 53 | bFile="TrueOS-Desktop-${ISOVER}-${FARCH}" 54 | fi 55 | bTitle="TrueOS" 56 | brand="trueos" 57 | touch ${PDESTDIR9}/trueos-desktop 58 | fi 59 | export bFile 60 | 61 | # Set the trueos-media-details file marker on this media 62 | echo "TrueOS ${TRUEOSVER} "$ARCH" INSTALL DVD - `date`" > ${PDESTDIR9}/trueos-media-details 63 | touch ${PDESTDIR9}/trueos-media-local 64 | 65 | echo "Creating ISO..." 66 | # Stolen from FreeBSD's build scripts 67 | # This is highly x86-centric and will be used directly below. 68 | bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot" 69 | 70 | # Make EFI system partition (should be done with makefs in the future) 71 | rc_halt "dd if=/dev/zero of=efiboot.img bs=4k count=500" 72 | device=`mdconfig -a -t vnode -f efiboot.img` 73 | rc_halt "newfs_msdos -F 12 -m 0xf8 /dev/$device" 74 | rc_nohalt "mkdir efi" 75 | rc_halt "mount -t msdosfs /dev/$device efi" 76 | rc_halt "mkdir -p efi/efi/boot" 77 | rc_halt "cp ${PDESTDIR9}/boot/loader.efi efi/efi/boot/bootx64.efi" 78 | rc_halt "umount efi" 79 | rc_halt "rmdir efi" 80 | rc_halt "mdconfig -d -u $device" 81 | bootable="-o bootimage=i386;efiboot.img -o no-emul-boot $bootable" 82 | 83 | LABEL="TRUEOS_INSTALL" 84 | publisher="The TrueOS Project. http://www.trueos.org/" 85 | echo "Running makefs..." 86 | echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > ${PDESTDIR9}/etc/fstab 87 | 88 | # Set some initial loader.conf values 89 | cp ${PDESTDIR9}/boot/loader.conf ${PDESTDIR9}/boot/loader.conf.orig 90 | 91 | cat >${PDESTDIR9}/boot/loader.conf << EOF 92 | vfs.root.mountfrom="cd9660:/dev/iso9660/$LABEL" 93 | loader_menu_title="Welcome to $bTitle" 94 | loader_logo="$brand" 95 | loader_brand="$brand" 96 | EOF 97 | 98 | # Throw back in the pre-supplied settings 99 | cat ${PDESTDIR9}/boot/loader.conf.orig >> ${PDESTDIR9}/boot/loader.conf 100 | 101 | makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" ${PROGDIR}/iso/${bFile}-DVD.iso ${PDESTDIR9} 102 | rm ${PDESTDIR9}/etc/fstab 103 | rm -f efiboot.img 104 | 105 | 106 | # Run MD5 command 107 | cd ${PROGDIR}/iso 108 | md5 -q ${bFile}-DVD.iso >${bFile}-DVD.iso.md5 109 | sha256 -q ${bFile}-DVD.iso >${bFile}-DVD.iso.sha256 110 | if [ ! -e "latest.iso" ] ; then 111 | ln -s ${bFile}-DVD.iso latest-${SYSBUILD}.iso 112 | ln -s ${bFile}-DVD.iso.torrent latest-${SYSBUILD}.iso.torrent 113 | ln -s ${bFile}-DVD.iso.md5 latest-${SYSBUILD}.iso.md5 114 | ln -s ${bFile}-DVD.iso.sha256 latest-${SYSBUILD}.iso.sha256 115 | fi 116 | 117 | if [ $DEFAULTPKGBRANCH = "UNSTABLE" ] ; then 118 | tdir="unstable" 119 | else 120 | tdir="master" 121 | fi 122 | 123 | # Create the .torrent 124 | mktorrent -a udp://tracker.coppersurfer.tk:6969 -w http://download.trueos.org/$tdir/amd64/${bFile}-DVD.iso ${bFile}-DVD.iso 125 | 126 | ###### 127 | # Create the USB images 128 | ###### 129 | 130 | OUTFILE="${PROGDIR}/iso/${bFile}-USB.img" 131 | 132 | # Set the trueos-media-details file marker on this media 133 | echo "TrueOS ${TRUEOSVER} "$ARCH" INSTALL USB - `date`" > ${PDESTDIR9}/trueos-media-details 134 | touch ${PDESTDIR9}/trueos-media-local 135 | 136 | echo "Creating IMG..." 137 | echo '/dev/ufs/TRUEOS_INSTALL / ufs ro,noatime 1 1' > ${PDESTDIR9}/etc/fstab 138 | 139 | # Make EFI system partition (should be done with makefs in the future) 140 | cd ${PROGDIR}/iso 141 | 142 | # Set some initial loader.conf values 143 | cat >${PDESTDIR9}/boot/loader.conf << EOF 144 | vfs.root.mountfrom="ufs:/dev/ufs/$LABEL" 145 | loader_menu_title="Welcome to $bTitle" 146 | loader_logo="$brand" 147 | loader_brand="$brand" 148 | EOF 149 | 150 | # Throw back in the pre-supplied settings 151 | cat ${PDESTDIR9}/boot/loader.conf.orig >> ${PDESTDIR9}/boot/loader.conf 152 | 153 | echo "Running makefs..." 154 | rc_halt "makefs -B little -o label=${LABEL} ${OUTFILE}.part ${PDESTDIR9}" 155 | rm ${PDESTDIR9}/etc/fstab 156 | 157 | # Create the USB image now 158 | echo "Running mkimg..." 159 | rc_halt "mkimg -s gpt -b ${PDESTDIR9}/boot/pmbr -p efi:=${PDESTDIR9}/boot/boot1.efifat -p freebsd-boot:=${PDESTDIR9}/boot/gptboot -p freebsd-ufs:=${OUTFILE}.part -p freebsd-swap::1M -o ${OUTFILE}" 160 | rm ${OUTFILE}.part 161 | rm ${FAT_FILE} 162 | 163 | rc_halt "umount ${ISODISTDIR}/packages" 164 | 165 | # Run MD5 command 166 | cd ${PROGDIR}/iso 167 | md5 -q ${OUTFILE} >${OUTFILE}.md5 168 | sha256 -q ${OUTFILE} >${OUTFILE}.sha256 169 | if [ ! -e "latest.img" ] ; then 170 | ln -s `basename ${OUTFILE}` latest-${SYSBUILD}.img 171 | ln -s `basename ${OUTFILE}` latest-${SYSBUILD}.img.torrent 172 | ln -s `basename ${OUTFILE}.md5` latest-${SYSBUILD}.img.md5 173 | ln -s `basename ${OUTFILE}.sha256` latest-${SYSBUILD}.img.sha256 174 | fi 175 | 176 | # Create the .torrent 177 | mktorrent -a udp://tracker.coppersurfer.tk:6969 -w http://download.trueos.org/$tdir/amd64/`basename ${OUTFILE}` ${OUTFILE} 178 | 179 | exit 0 180 | -------------------------------------------------------------------------------- /trueos/scripts/9.4.makenetiso.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Author: Kris Moore 3 | # Description: Creates the network install ISO file 4 | # Copyright: 2015 PC-BSD Software / iXsystems 5 | ############################################################################ 6 | 7 | # Where is the build program installed 8 | PROGDIR="`realpath | sed 's|/scripts||g'`" ; export PROGDIR 9 | 10 | # Source the config file 11 | . ${PROGDIR}/trueos.cfg 12 | 13 | cd ${PROGDIR}/scripts 14 | 15 | # Source our functions 16 | . ${PROGDIR}/scripts/functions.sh 17 | 18 | echo "Building DVD images.." 19 | 20 | ISODISTDIR="${PDESTDIR9}/dist" 21 | 22 | # Remove archive files 23 | if [ -d "${ISODISTDIR}" ] ; then 24 | echo "Removing ${ISODISTDIR}" 25 | rm -rf ${ISODISTDIR} 26 | fi 27 | mkdir ${ISODISTDIR} 28 | 29 | # Set the file-date 30 | fDate="-`date '+%Y-%m-%d'`" 31 | 32 | # Base file name 33 | if [ "$SYSBUILD" = "trueos" ] ; then 34 | bFile="TrueOS-Server-${fDate}-${FARCH}" 35 | bTitle="TrueOS" 36 | brand="trueos" 37 | else 38 | bFile="TrueOS-Desktop-${fDate}-${FARCH}" 39 | bTitle="TrueOS" 40 | brand="trueos" 41 | fi 42 | export bFile 43 | 44 | # Set the media-details file marker on this media 45 | echo "TrueOS ${TRUEOSVER} "$ARCH" INSTALL DVD/USB - `date`" > ${PDESTDIR9}/trueos-media-details 46 | touch ${PDESTDIR9}/trueos-media-network 47 | 48 | # Stolen from FreeBSD's build scripts 49 | # This is highly x86-centric and will be used directly below. 50 | bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot" 51 | 52 | # Make EFI system partition (should be done with makefs in the future) 53 | rc_halt "dd if=/dev/zero of=efiboot.img bs=4k count=500" 54 | device=`mdconfig -a -t vnode -f efiboot.img` 55 | rc_halt "newfs_msdos -F 12 -m 0xf8 /dev/$device" 56 | rc_nohalt "mkdir efi" 57 | rc_halt "mount -t msdosfs /dev/$device efi" 58 | rc_halt "mkdir -p efi/efi/boot" 59 | rc_halt "cp ${PDESTDIR9}/boot/loader.efi efi/efi/boot/bootx64.efi" 60 | rc_halt "umount efi" 61 | rc_halt "rmdir efi" 62 | rc_halt "mdconfig -d -u $device" 63 | bootable="-o bootimage=i386;efiboot.img -o no-emul-boot $bootable" 64 | 65 | LABEL="TRUEOS_INSTALL" 66 | publisher="The PC-BSD Project. http://www.trueos.org/" 67 | echo "Running makefs..." 68 | echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > ${PDESTDIR9}/etc/fstab 69 | 70 | # Set some initial loader.conf values 71 | cat >${PDESTDIR9}/boot/loader.conf << EOF 72 | vfs.root.mountfrom="cd9660:/dev/iso9660/$LABEL" 73 | loader_menu_title="Welcome to $bTitle" 74 | loader_logo="$brand" 75 | loader_brand="$brand" 76 | EOF 77 | cat ${PDESTDIR9}/boot/loader.conf.orig >> ${PDESTDIR9}/boot/loader.conf 78 | 79 | makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" ${PROGDIR}/iso/${bFile}-netinstall.iso ${PDESTDIR9} 80 | rm ${PDESTDIR9}/etc/fstab 81 | rm -f efiboot.img 82 | 83 | # Run MD5 command 84 | cd ${PROGDIR}/iso 85 | md5 -q ${bFile}-netinstall.iso >${bFile}-netinstall.iso.md5 86 | sha256 -q ${bFile}-netinstall.iso >${bFile}-netinstall.iso.sha256 87 | if [ ! -e "latest.iso" ] ; then 88 | ln -s ${bFile}-netinstall.iso latest.iso 89 | ln -s ${bFile}-netinstall.iso.md5 latest.iso.md5 90 | ln -s ${bFile}-netinstall.iso.sha256 latest.iso.sha256 91 | fi 92 | 93 | ###### 94 | # Create the USB images 95 | ###### 96 | 97 | OUTFILE="${PROGDIR}/iso/${bFile}-netinstall-USB.img" 98 | 99 | # Set the media-details file marker on this media 100 | echo "TrueOS ${TRUEOSVER} "$ARCH" INSTALL USB - `date`" > ${PDESTDIR9}/trueos-media-details 101 | touch ${PDESTDIR9}/trueos-media-local 102 | 103 | echo "Creating IMG..." 104 | echo '/dev/ufs/TRUEOS_INSTALL / ufs ro,noatime 1 1' > ${PDESTDIR9}/etc/fstab 105 | # Set some initial loader.conf values 106 | cat >${PDESTDIR9}/boot/loader.conf << EOF 107 | vfs.root.mountfrom="ufs:/dev/ufs/$LABEL" 108 | loader_menu_title="Welcome to $bTitle" 109 | loader_logo="$brand" 110 | loader_brand="$brand" 111 | EOF 112 | cat ${PDESTDIR9}/boot/loader.conf.orig >> ${PDESTDIR9}/boot/loader.conf 113 | 114 | echo "Running makefs..." 115 | rc_halt "makefs -B little -o label=${LABEL} ${OUTFILE}.part ${PDESTDIR9}" 116 | rm ${PDESTDIR9}/etc/fstab 117 | 118 | echo "Running mkimg..." 119 | rc_halt "mkimg -s gpt -b ${PDESTDIR9}/boot/pmbr -p efi:=${PDESTDIR9}/boot/boot1.efifat -p freebsd-boot:=${PDESTDIR9}/boot/gptboot -p freebsd-ufs:=${OUTFILE}.part -p freebsd-swap::1M -o ${OUTFILE}" 120 | rm ${OUTFILE}.part 121 | 122 | # Run MD5 command 123 | cd ${PROGDIR}/iso 124 | md5 -q ${OUTFILE} >${OUTFILE}.md5 125 | sha256 -q ${OUTFILE} >${OUTFILE}.sha256 126 | if [ ! -e "latest.img" ] ; then 127 | ln -s ${OUTFILE} latest.img 128 | ln -s ${OUTFILE}.md5 latest.img.md5 129 | ln -s ${OUTFILE}.sha256 latest.img.sha256 130 | fi 131 | 132 | exit 0 133 | -------------------------------------------------------------------------------- /trueos/scripts/9.6.makenetfiles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Author: Kris Moore 3 | # Description: Makes the DVD ISO 4 | # Copyright: 2008 PC-BSD Software / iXsystems 5 | ############################################################################ 6 | 7 | # Check if we have sourced the variables yet 8 | if [ -z $PDESTDIR ] 9 | then 10 | . ../trueos.cfg 11 | fi 12 | 13 | # Source our functions 14 | . ${PROGDIR}/scripts/functions.sh 15 | 16 | # All the dist files 17 | rc_nohalt "rm -rf ${PROGDIR}/iso/dist" 18 | rc_halt "mkdir ${PROGDIR}/iso/dist" 19 | rc_halt "cp ${DISTDIR}/* ${PROGDIR}/iso/dist/" 20 | 21 | exit 0 22 | -------------------------------------------------------------------------------- /trueos/scripts/9.7.makevbox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Author: Kris Moore 3 | # Description: Creates a vbox disk image 4 | # Copyright: 2011 PC-BSD Software / iXsystems 5 | ############################################################################ 6 | 7 | # Check if we have sourced the variables yet 8 | # Where is the build program installed 9 | PROGDIR="`realpath | sed 's|/scripts||g'`" ; export PROGDIR 10 | 11 | # Source our functions 12 | . ${PROGDIR}/scripts/functions.sh 13 | 14 | # Source the config file 15 | . ${PROGDIR}/trueos.cfg 16 | 17 | cd ${PROGDIR}/scripts 18 | 19 | 20 | if [ -z ${PDESTDIR} ] 21 | then 22 | echo "ERROR: PDESTDIR is still unset!" 23 | exit 1 24 | fi 25 | 26 | # VFS FILE 27 | MFSFILE="${PROGDIR}/iso/TrueOS${TRUEOSVER}-${FARCH}.img" 28 | ISODIR="${PDESTDIR9}-vm" 29 | 30 | 31 | VPKGLIST="trueos-desktop archivers/unzip archivers/unrar trueos-meta-virtualboxguest trueos-meta-vwmareguest" 32 | 33 | # Cleanup any failed build 34 | umount ${ISODIR} 2>/dev/null 35 | umount ${ISODIR}-tmp 2>/dev/null 36 | rmdir ${ISODIR}-tmp 2>/dev/null 37 | sleep 1 38 | 39 | # Create the tmp dir we will be using 40 | mk_tmpfs_wrkdir ${ISODIR} 41 | mkdir ${ISODIR}-tmp 42 | 43 | 44 | # Extract the ISO file 45 | DVDFILE=`ls ${PROGDIR}/iso/TrueOS*DVD-USB.iso` 46 | if [ ! -e "$DVDFILE" ] ; then 47 | echo "No such ISO file: $DVDFILE" 48 | exit 1 49 | fi 50 | 51 | # We now run virtualbox headless 52 | # This is because grub-bhyve can't boot FreeBSD on root/zfs 53 | # Once bhyve matures we can switch this back over 54 | kldunload vmm 2>/dev/null >/dev/null 55 | # Remove bridge0/tap0 so vbox bridge mode works 56 | ifconfig bridge0 destroy >/dev/null 2>/dev/null 57 | ifconfig tap0 destroy >/dev/null 2>/dev/null 58 | 59 | # Get the default interface 60 | iface=`netstat -f inet -nrW | grep '^default' | awk '{ print $6 }'` 61 | 62 | # Load up VBOX 63 | kldload vboxdrv >/dev/null 2>/dev/null 64 | service vboxnet onestart >/dev/null 2>/dev/null 65 | 66 | echo "Copying file-system contents to memory..." 67 | MD=`mdconfig -a -t vnode -f ${DVDFILE}` 68 | rc_halt "mount_cd9660 /dev/$MD ${ISODIR}-tmp" 69 | tar cvf - -C ${ISODIR}-tmp . 2>/dev/null | tar xvf - -C ${ISODIR} 2>/dev/null 70 | if [ $? -ne 0 ] ; then 71 | exit_err "tar cvf" 72 | fi 73 | rc_halt "umount /dev/$MD" 74 | rc_halt "mdconfig -d -u $MD" 75 | rc_halt "rmdir ${ISODIR}-tmp" 76 | 77 | echo "Extracting /root and /etc" 78 | rc_halt "tar xvf ${ISODIR}/uzip/root-dist.txz -C ${ISODIR}/root" >/dev/null 2>/dev/null 79 | rc_halt "tar xvf ${ISODIR}/uzip/etc-dist.txz -C ${ISODIR}/etc" >/dev/null 2>/dev/null 80 | 81 | # Copy the bhyve ttys / gettytab 82 | rc_halt "cp ${PROGDIR}/scripts/pre-installs/ttys ${ISODIR}/etc/" 83 | rc_halt "cp ${PROGDIR}/scripts/pre-installs/gettytab ${ISODIR}/etc/" 84 | 85 | # Re-compression of /root and /etc 86 | echo "Re-compressing /root and /etc" 87 | rc_halt "tar cvJf ${ISODIR}/uzip/root-dist.txz -C ${ISODIR}/root ." >/dev/null 2>/dev/null 88 | rc_halt "tar cvJf ${ISODIR}/uzip/etc-dist.txz -C ${ISODIR}/etc ." >/dev/null 2>/dev/null 89 | rc_halt "rm -rf ${ISODIR}/root" 90 | rc_halt "mkdir ${ISODIR}/root" 91 | 92 | # Now loop through and generate VM disk images based upon supplied configs 93 | for cfg in `ls ${PROGDIR}/scripts/pre-installs/*.cfg` 94 | do 95 | pName="`basename $cfg | sed 's|.cfg||g'`" 96 | 97 | # Remove any crashed / old VM 98 | VBoxManage unregistervm $VM --delete >/dev/null 2>/dev/null 99 | rm -rf "/root/VirtualBox VMs/vminstall" >/dev/null 2>/dev/null 100 | 101 | # Create the filesystem backend file 102 | echo "Creating $MFSFILE" 103 | rm ${MFSFILE}.vdi >/dev/null 2>/dev/null 104 | 105 | rc_halt "VBoxManage createhd --filename ${MFSFILE}.vdi --size 50000" 106 | 107 | VM="vminstall" 108 | 109 | # Remove from the vbox registry 110 | VBoxManage closemedium dvd ${PROGDIR}/ISO/VMAUTO.iso >/dev/null 2>/dev/null 111 | # Copy the pc-sysinstall config 112 | rc_halt "cp $cfg ${ISODIR}/pc-sysinstall.cfg" 113 | 114 | # Setup the auto-install stuff 115 | echo "pc_config: /pc-sysinstall.cfg 116 | shutdown_cmd: shutdown -p now 117 | confirm_install: NO" > ${ISODIR}/pc-autoinstall.conf 118 | 119 | # Use makefs to create the image 120 | echo "Creating ISO..." 121 | sed -i '' 's|/kernel/kernel|/kernel/kernel -D -h|g' ${ISODIR}/boot/grub/grub.cfg 122 | echo "kern.geom.label.disk_ident.enable=0" >> ${ISODIR}/boot/loader.conf 123 | echo "kern.geom.label.gptid.enable=0" >> ${ISODIR}/boot/loader.conf 124 | echo "kern.geom.label.ufsid.enable=0" >> ${ISODIR}/boot/loader.conf 125 | grub-mkrescue -o ${PROGDIR}/iso/VMAUTO.iso ${ISODIR} -- -volid "TRUEOS_INSTALL" 126 | if [ $? -ne 0 ] ; then 127 | exit_err "Failed running grub-mkrescue" 128 | fi 129 | 130 | # Create the VM in virtualbox 131 | rc_halt "VBoxManage createvm --name $VM --ostype FreeBSD_64 --register" 132 | rc_halt "VBoxManage storagectl $VM --name SATA --add sata --controller IntelAhci" 133 | rc_halt "VBoxManage storageattach $VM --storagectl SATA --port 0 --device 0 --type hdd --medium ${MFSFILE}.vdi" 134 | rc_halt "VBoxManage storageattach $VM --storagectl SATA --port 1 --device 0 --type dvddrive --medium ${PROGDIR}/iso/VMAUTO.iso" 135 | rc_halt "VBoxManage modifyvm $VM --cpus 2 --ioapic on --boot1 disk --memory 2048 --vram 12" 136 | rc_halt "VBoxManage modifyvm $VM --nic1 bridged" 137 | rc_halt "VBoxManage modifyvm $VM --bridgeadapter1 ${iface}" 138 | rc_halt "VBoxManage modifyvm $VM --macaddress1 auto" 139 | rc_halt "VBoxManage modifyvm $VM --nictype1 82540EM" 140 | rc_halt "VBoxManage modifyvm $VM --pae off" 141 | rc_halt "VBoxManage modifyvm $VM --usb on" 142 | 143 | # Setup serial output 144 | rc_halt "VBoxManage modifyvm $VM --uart1 0x3F8 4" 145 | rc_halt "VBoxManage modifyvm $VM --uartmode1 file /tmp/vboxpipe" 146 | 147 | 148 | # Run VM now 149 | sync 150 | sleep 3 151 | 152 | # Just in case the install hung, we don't need to be waiting for over an hour 153 | echo "Running VM for installation to $MFSFILE.vdi..." 154 | count=0 155 | daemon -f -p /tmp/vminstall.pid vboxheadless -startvm "$VM" --vrde off 156 | while : 157 | do 158 | if [ ! -e "/tmp/vminstall.pid" ] ; then break; fi 159 | 160 | pgrep -qF /tmp/vminstall.pid 161 | if [ $? -ne 0 ] ; then 162 | break; 163 | fi 164 | 165 | count=`expr $count + 1` 166 | if [ $count -gt 360 ] ; then break; fi 167 | echo -e ".\c" 168 | 169 | sleep 10 170 | done 171 | 172 | echo "Output from VM install:" 173 | echo "------------------------------------" 174 | cat /tmp/vboxpipe 175 | 176 | # Make sure VM is shutdown 177 | VBoxManage controlvm ${VM} poweroff >/dev/null 2>/dev/null 178 | 179 | # Remove from the vbox registry 180 | VBoxManage closemedium dvd ${PROGDIR}/iso/VMAUTO.iso >/dev/null 2>/dev/null 181 | 182 | # Check that this device seemed to install properly 183 | dSize=`du -m ${MFSFILE}.vdi | awk '{print $1}'` 184 | if [ $dSize -lt 10 ] ; then 185 | # if the disk image is too small, something didn't work, bail out! 186 | echo "VM install failed!" 187 | 188 | # Cleanup tempfs 189 | umount ${ISODIR} 2>/dev/null 190 | rmdir ${ISODIR} 191 | exit 1 192 | fi 193 | 194 | OVAFILE="${PROGDIR}/iso/TrueOS${ISOVER}-${FARCH}-${pName}.ova" 195 | VDIFILE="${PROGDIR}/iso/TrueOS${ISOVER}-${FARCH}-${pName}.vdi" 196 | VMDKFILE="${PROGDIR}/iso/TrueOS${ISOVER}-${FARCH}-${pName}.vmdk" 197 | RAWFILE="${PROGDIR}/iso/TrueOS${ISOVER}-${FARCH}-${pName}.raw" 198 | 199 | # Create the VDI 200 | rm ${VDIFILE} 2>/dev/null 201 | rm ${VDIFILE}.xz 2>/dev/null 202 | rc_halt "VBoxManage clonehd ${MFSFILE}.vdi ${VDIFILE}" 203 | 204 | # Create the OVA file now 205 | rm ${OVAFILE} 2>/dev/null 206 | rm ${OVAFILE}.xz 2>/dev/null 207 | VM="$pName" 208 | 209 | # Remove any crashed / old VM 210 | VBoxManage unregistervm $VM --delete >/dev/null 2>/dev/null 211 | 212 | rc_halt "VBoxManage createvm --name $VM --ostype FreeBSD_64 --register" 213 | rc_halt "VBoxManage storagectl $VM --name IDE --add ide --controller PIIX4" 214 | rc_halt "VBoxManage storageattach $VM --storagectl IDE --port 0 --device 0 --type hdd --medium ${VDIFILE}" 215 | rc_halt "VBoxManage modifyvm $VM --ioapic on --boot1 disk --memory 1024 --vram 12" 216 | rc_halt "VBoxManage modifyvm $VM --nic1 nat" 217 | rc_halt "VBoxManage modifyvm $VM --macaddress1 auto" 218 | rc_halt "VBoxManage modifyvm $VM --nictype1 82540EM" 219 | rc_halt "VBoxManage modifyvm $VM --pae off" 220 | rc_halt "VBoxManage modifyvm $VM --usb on" 221 | rc_halt "VBoxManage modifyvm $VM --audio oss" 222 | rc_halt "VBoxManage modifyvm $VM --audiocontroller ac97" 223 | rc_halt "VBoxManage export $VM -o $OVAFILE" 224 | rc_halt "VBoxManage unregistervm $VM --delete" 225 | rc_halt "chmod 644 $OVAFILE" 226 | 227 | # Create the VDI 228 | rm ${VDIFILE} 2>/dev/null 229 | rm ${VDIFILE}.xz 2>/dev/null 230 | rc_halt "VBoxManage clonehd --format VDI ${MFSFILE}.vdi ${VDIFILE}" 231 | rc_halt "pixz ${VDIFILE}" 232 | rc_halt "chmod 644 ${VDIFILE}.xz" 233 | 234 | # Create the VMDK 235 | rm ${VMDKFILE} 2>/dev/null 236 | rm ${VMDKFILE}.xz 2>/dev/null 237 | rc_halt "VBoxManage clonehd --format VMDK ${MFSFILE}.vdi ${VMDKFILE}" 238 | rc_halt "pixz ${VMDKFILE}" 239 | rc_halt "chmod 644 ${VMDKFILE}.xz" 240 | 241 | # Do RAW now 242 | rm ${RAWFILE} 2>/dev/null 243 | rm ${RAWFILE}.xz 2>/dev/null 244 | rc_halt "VBoxManage clonehd --format RAW ${MFSFILE}.vdi ${RAWFILE}" 245 | rc_halt "pixz ${RAWFILE}" 246 | rc_halt "chmod 644 ${RAWFILE}.xz" 247 | 248 | # Run MD5 command 249 | cd ${PROGDIR}/iso 250 | md5 -q ${OVAFILE} >${OVAFILE}.md5 251 | sha256 -q ${OVAFILE} >${OVAFILE}.sha256 252 | md5 -q ${VDIFILE}.xz >${VDIFILE}.xz.md5 253 | sha256 -q ${VDIFILE}.xz >${VDIFILE}.xz.sha256 254 | md5 -q ${VMDKFILE}.xz >${VMDKFILE}.xz.md5 255 | sha256 -q ${VMDKFILE}.xz >${VMDKFILE}.xz.sha256 256 | md5 -q ${RAWFILE}.xz >${RAWFILE}.xz.md5 257 | sha256 -q ${RAWFILE}.xz >${RAWFILE}.xz.sha256 258 | 259 | # Cleanup 260 | rm ${PROGDIR}/iso/VMAUTO.iso 261 | done 262 | 263 | # Cleanup tempfs 264 | umount ${ISODIR} 2>/dev/null 265 | rmdir ${ISODIR} 266 | exit 0 267 | -------------------------------------------------------------------------------- /trueos/scripts/9.freesbie.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Author: Kris Moore 3 | # Description: Creates the ISO file 4 | # Copyright: 2009 PC-BSD Software / iXsystems 5 | ############################################################################ 6 | 7 | # Where is the build program installed 8 | PROGDIR="`realpath | sed 's|/scripts||g'`" ; export PROGDIR 9 | 10 | # Source the config file 11 | . ${PROGDIR}/trueos.cfg 12 | 13 | cd ${PROGDIR}/scripts 14 | 15 | # Source our functions 16 | . ${PROGDIR}/scripts/functions.sh 17 | 18 | 19 | # Make sure we have our freebsd sources 20 | if [ -d "${WORLDSRC}" ]; then 21 | rm -rf ${WORLDSRC} 22 | fi 23 | mkdir -p ${WORLDSRC} 24 | echo "git clone --depth=1 -b ${GITFBSDBRANCH} ${GITFBSDURL} ${WORLDSRC}" 25 | rc_halt "git clone --depth=1 -b ${GITFBSDBRANCH} ${GITFBSDURL} ${WORLDSRC}" 26 | 27 | # Make sure we have our sources 28 | if [ -d "${TRUEOSSRC}" ] ; then rm -rf "${TRUEOSSRC}"; fi 29 | mkdir -p ${TRUEOSSRC} 30 | echo "git clone --depth=1 -b ${GITTRUEOSBRANCH} ${GITTRUEOSURL} ${TRUEOSSRC}" 31 | rc_halt "git clone --depth=1 -b ${GITTRUEOSBRANCH} ${GITTRUEOSURL} ${TRUEOSSRC}" 32 | 33 | # create_vnode ${UFSFILE} ${PARTITION} 34 | # 35 | # Create a loop filesystem in file ${UFSFILE} containing files under 36 | # ${PARTITION} directory (relative path from /) 37 | create_vnode() { 38 | UFSFILE=$1; shift 39 | PARTITION=$1; shift 40 | 41 | SOURCEDIR=${PDESTDIR9}/${PARTITION} 42 | DESTMOUNTPOINT=${PDESTDIR9}/${PARTITION} 43 | 44 | cd $SOURCEDIR 45 | 46 | echo ${DEVICE} 47 | } 48 | 49 | # Unmount list of md devices 50 | umount_md_devices() { 51 | for i in $@; do 52 | echo "Unmounting ${i}" 53 | rc_halt "umount -f ${i}" 54 | rc_halt "mdconfig -d -u ${i}" 55 | done 56 | } 57 | 58 | # uzip ${UFSFILE} ${UZIPFILE} 59 | # 60 | # makes an uzip fs on ${UZIPFILE} starting from ${UFSFILE} and removes 61 | # ${UFSFILE} 62 | uzip() { 63 | UFSFILE=$1; shift 64 | UZIPFILE=$1; 65 | 66 | echo -n "Compressing ${UFSFILE}..." 67 | rc_halt "mkuzip -v -s 65536 -o ${UZIPFILE} ${UFSFILE}" 2>/dev/null >/dev/null 68 | 69 | UFSSIZE=$(ls -l ${UFSFILE} | awk '{print $5}') 70 | UZIPSIZE=$(ls -l ${UZIPFILE} | awk '{print $5}') 71 | 72 | PERCENT=$(awk -v ufs=${UFSSIZE} -v uzip=${UZIPSIZE} 'BEGIN{print (100 - (100 * (uzip/ufs)));}') 73 | rm -f ${UFSFILE} 74 | 75 | echo " ${PERCENT}% saved" 76 | } 77 | 78 | prune_fs() 79 | { 80 | rc_halt "cd ${PDESTDIR9}/" 81 | 82 | # If PRUNE_LIST file exists, delete files and dir listed in it 83 | PRUNE_LIST="${PCONFDIR}/installcd-prunelist" 84 | 85 | if [ -f ${PRUNE_LIST} ]; then 86 | echo "Deleting files listed in ${PRUNE_LIST}" 87 | set +e 88 | while read line 89 | do 90 | if [ "$line" = "" -o "${line}" = " " ]; then continue; fi 91 | #echo "deleting ${PDESTDIR9}/$line" 92 | chflags -R noschg ${PDESTDIR9}/$line >/dev/null 2>/dev/null 93 | rm -rf ${PDESTDIR9}/$line >/dev/null 2>/dev/null 94 | done < ${PRUNE_LIST} 95 | fi 96 | } 97 | 98 | setup_usr_uzip() { 99 | echo "#### Creating /usr uzip file ####" 100 | 101 | # Preparing loop filesystem to be compressed 102 | mkdir -p ${PDESTDIR9}/uzip 2>/dev/null 103 | rc_halt "cd ${PDESTDIR9}/usr" 104 | 105 | # Figure out disk size and set up a vnode 106 | UFSFILE=${PDESTDIR9}/uzip/usr.ufs 107 | USRMNT=${PDESTDIR9}/usrmnt 108 | sync 109 | DIRSIZE=$(($(du -kd 0 | cut -f 1))) 110 | echo "DIRSIZE: $DIRSIZE" 111 | FSSIZE=$(($DIRSIZE + $DIRSIZE + $DIRSIZE)) 112 | echo "FSSIZE: $FSSIZE" 113 | rc_halt "dd if=/dev/zero of=${UFSFILE} bs=1k count=${FSSIZE}" 114 | 115 | USRDEVICE=/dev/$(mdconfig -a -t vnode -f ${UFSFILE}) 116 | rc_halt "newfs -b 4096 -n -o space ${USRDEVICE}" 117 | mkdir -p ${USRMNT} 2>/dev/null 118 | rc_halt "mount -o noatime ${USRDEVICE} ${USRMNT}" 119 | 120 | # Now copy the usr filesystem 121 | rc_halt "cd ${PDESTDIR9}/usr" 122 | find . -print -depth 2>/dev/null | cpio -dump -v ${USRMNT} 123 | if [ $? -ne 0 ] ; then 124 | echo "WARNING: cpio error!" 125 | fi 126 | 127 | # Remove old usrmnt and remount 128 | sync 129 | sleep 10 130 | rc_halt "umount -f ${USRDEVICE}" 131 | rc_halt "cd ${PDESTDIR9}/" 132 | rm -rf ${PDESTDIR9}/usr 2>/dev/null 133 | chflags -R noschg ${PDESTDIR9}/usr >/dev/null 2>/dev/null 134 | rm -rf ${PDESTDIR9}/usr 135 | rc_halt "mkdir ${PDESTDIR9}/usr" 136 | rmdir ${USRMNT} 137 | rc_halt "mount -o noatime ${USRDEVICE} ${PDESTDIR9}/usr" 138 | 139 | DEVICES=${USRDEVICE} 140 | 141 | trap "umount_md_devices ${DEVICES}; exit 1" INT 142 | 143 | rc_halt "cd ${PDESTDIR9}/" 144 | 145 | #echo "Filling the uncompressed fs with zeros to compress better" 146 | #echo "Don't worry if you see a 'filesystem full' message here" 147 | #zerofile=$(env TMPDIR=${PDESTDIR9}/usr mktemp -t zero) 148 | #dd if=/dev/zero of=${zerofile} >/dev/null 2>/dev/null 149 | #rm ${zerofile} 150 | set -e 151 | 152 | umount_md_devices ${DEVICES} 153 | trap "" INT 154 | echo "Compressing with uzip..." 155 | rc_halt "uzip ${PDESTDIR9}/uzip/usr.ufs ${PDESTDIR9}/uzip/usr.uzip" 156 | md5 -q ${PDESTDIR9}/uzip/usr.uzip > ${PDESTDIR9}/uzip/usr.uzip.md5 157 | 158 | } 159 | 160 | create_pico_mfsroot() { 161 | 162 | tag="$1" 163 | 164 | if [ -e "${PDESTDIR9}" ]; then 165 | echo "Removing ${PDESTDIR9}" 166 | umount -f ${PDESTDIR9}/mnt >/dev/null 2>/dev/null 167 | umount -f ${PDESTDIR9}/tmp/packages >/dev/null 2>/dev/null 168 | umount -f ${PDESTDIR9} >/dev/null 2>/dev/null 169 | fi 170 | 171 | rc_halt "cd ${PROGDIR}" 172 | rc_halt "mkdir ${PDESTDIR9}" 173 | 174 | # Create our MFSROOT image 175 | truncate -s 512M mfsroot.img 176 | MD=$(mdconfig -f mfsroot.img) 177 | rc_halt "newfs -U ${MD}" 178 | 179 | # Mount it 180 | rc_halt "mount /dev/${MD} ${PDESTDIR9}" 181 | 182 | # Extract world to image 183 | tar xvpf ${ARMDIST} --exclude ./boot \ 184 | --exclude ./usr/lib/debug \ 185 | --exclude ./usr/include \ 186 | --exclude ./usr/share \ 187 | --exclude ./usr/sbin \ 188 | --exclude ./usr/bin/clang \ 189 | --exclude ./usr/bin/c++ \ 190 | --exclude ./usr/tests -C ${PDESTDIR9} 191 | 192 | # Copy upgrade overlay 193 | tar cvf - -C ${TRUEOSSRC}/overlays/pico-upgrade/ . | tar xvpf - -C ${PDESTDIR9} 194 | 195 | # Cleanup 196 | rc_halt "umount -f ${PDESTDIR9}" 197 | rc_halt "mdconfig -d -u ${MD}" 198 | rc_halt "gzip -9 mfsroot.img" 199 | 200 | rc_halt "mv mfsroot.img.gz ${PROGDIR}/iso/${tag}-upgrade.img.gz" 201 | sha256 -q ${PROGDIR}/iso/${tag}-upgrade.img.gz > ${PROGDIR}/iso/${tag}-upgrade.img.gz.sha256 202 | 203 | } 204 | 205 | do_rpi2_build() { 206 | 207 | if [ -e "${PDESTDIR9}" ]; then 208 | echo "Removing ${PDESTDIR9}" 209 | umount -f ${PDESTDIR9}/mnt >/dev/null 2>/dev/null 210 | umount -f ${PDESTDIR9}/tmp/packages >/dev/null 2>/dev/null 211 | umount -f ${PDESTDIR9} >/dev/null 2>/dev/null 212 | fi 213 | 214 | # Copy over the pkgs 215 | rc_halt "cp -r ${PPKGDIR}/All ${PROGDIR}/pkgs" 216 | 217 | rc_halt "cd ${PROGDIR}/" 218 | 219 | truncate -s 2g arm.img 220 | MD=$(mdconfig -f arm.img) 221 | 222 | # Create the disk image 223 | rc_halt "gpart create -s MBR ${MD}" 224 | gpart add -t '!12' -a 63 -s 50m ${MD} 225 | if [ $? -ne 0 ] ; then exit 1; fi 226 | 227 | rc_halt "gpart set -a active -i 1 ${MD}" 228 | rc_halt "newfs_msdos -F 16 /dev/${MD}s1" 229 | rc_halt "gpart add -t freebsd -a 4m ${MD}" 230 | rc_halt "gpart create -s BSD ${MD}s2" 231 | rc_halt "gpart add -t freebsd-ufs ${MD}s2" 232 | rc_halt "newfs -U ${MD}s2a" 233 | rc_halt "mkdir -p ${PDESTDIR9}" 234 | rc_halt "mount /dev/${MD}s2a ${PDESTDIR9}" 235 | 236 | extract_dist "${ARMDIST}" "${PDESTDIR9}" 237 | 238 | # Get rid of debug files 239 | rc_nohalt "rm -rf ${PDESTDIR9}/usr/lib/debug" 240 | rc_nohalt "rm -rf ${PDESTDIR9}/usr/tests" 241 | 242 | # Prep for pkg install 243 | rc_halt "mkdir ${PDESTDIR9}/pkgs" 244 | rc_halt "mount_nullfs ${PROGDIR}/pkgs ${PDESTDIR9}/pkgs" 245 | rc_halt "mount -t devfs devfs ${PDESTDIR9}/dev" 246 | 247 | # Copy over the qemu binary 248 | rc_halt "cp /usr/local/bin/qemu-arm-static ${PDESTDIR9}/qemu-arm-static" 249 | rc_halt "chmod 755 ${PDESTDIR9}/qemu-arm-static" 250 | 251 | # Boot-strap PKGNG 252 | pname=`ls ${PDESTDIR9}/pkgs/pkg-[0-9]*.txz` 253 | pname=$(basename ${pname}) 254 | pkg -c ${PDESTDIR9} add /pkgs/${pname} 255 | if [ $? -ne 0 ] ; then exit 1; fi 256 | 257 | # Loop through and add pkgs 258 | while read line 259 | do 260 | pname=`ls ${PDESTDIR9}/pkgs/${line}-[0-9]*.txz` 261 | pname=$(basename ${pname}) 262 | # pkg -c ${PDESTDIR9} add /pkgs/${pname} 263 | chroot ${PDESTDIR9} /qemu-arm-static pkg add /pkgs/${pname} 264 | if [ $? -ne 0 ] ; then exit 1; fi 265 | done < ${PCONFDIR}/installcd-packages 266 | 267 | # Cleanup the qemu binary 268 | rc_halt "rm ${PDESTDIR9}/qemu-arm-static" 269 | 270 | # Copy bootloader files 271 | rc_halt "cp ${PDESTDIR9}/boot/ubldr ${PROGDIR}/" 272 | rc_halt "cp ${PDESTDIR9}/boot/dtb/rpi2.dtb ${PROGDIR}/" 273 | rc_halt "mkdir ${PDESTDIR9}/boot/msdos" 274 | 275 | # Copy over the PICO overlay 276 | tar cvf - -C ${TRUEOSSRC}/overlays/pico-overlay/ . | tar xvpf - -C ${PDESTDIR9} 277 | 278 | # Grab the latest RPI2 binary 279 | rc_halt "fetch -o ${PDESTDIR9}/opt/pico-client http://web.trueos.org/picodist/pico-client-rpi2" 280 | rc_halt "fetch -o ${PDESTDIR9}/opt/pico-client.version http://web.trueos.org/picodist/pico-client-rpi2.version" 281 | PICOVER=`cat ${PDESTDIR9}/opt/pico-client.version` 282 | rc_halt "chmod 755 ${PDESTDIR9}/opt/pico-client" 283 | 284 | sync 285 | sleep 2 286 | rc_halt "umount -f ${PDESTDIR9}/pkgs" 287 | rc_halt "umount -f ${PDESTDIR9}/dev" 288 | rc_halt "umount -f ${PDESTDIR9}" 289 | 290 | # Copy the boot-loader files 291 | rc_halt "mount_msdosfs /dev/${MD}s1 ${PDESTDIR9}" 292 | rc_halt "cp /usr/local/share/u-boot/u-boot-rpi2/* ${PDESTDIR9}/" 293 | rc_halt "cp ${PROGDIR}/ubldr ${PDESTDIR9}/" 294 | rc_halt "cp ${PROGDIR}/rpi2.dtb ${PDESTDIR9}/" 295 | 296 | # Disable TV overscan by default 297 | echo "disable_overscan=1" >> ${PDESTDIR9}/config.txt 298 | # Set some options for 32bpp 299 | echo "framebuffer_depth=32" >> ${PDESTDIR9}/config.txt 300 | echo "framebuffer_ignore_alpha=1" >> ${PDESTDIR9}/config.txt 301 | 302 | # Cleanup 303 | rc_halt "umount -f ${PDESTDIR9}" 304 | rc_halt "mdconfig -d -u ${MD}" 305 | 306 | fDate="`date '+%Y-%m-%d'`" 307 | fName="TrueOS-pico-rpi2-${fDate}.img" 308 | rc_halt "mv ${PROGDIR}/arm.img ${PROGDIR}/iso/${fName}" 309 | rc_halt "xz ${PROGDIR}/iso/${fName}" 310 | md5 -q ${PROGDIR}/iso/${fName}.xz > ${PROGDIR}/iso/${fName}.xz.md5 311 | sha256 -q ${PROGDIR}/iso/${fName}.xz > ${PROGDIR}/iso/${fName}.xz.sha256 312 | SHA=`cat ${PROGDIR}/iso/${fName}.xz.sha256` 313 | SHAMFS=`cat ${PROGDIR}/iso/rpi2-upgrade.img.gz.sha256` 314 | 315 | # Create the INDEX file 316 | cat >${PROGDIR}/iso/INDEX </dev/null 2>/dev/null 330 | umount -f ${PDESTDIR9}/tmp/packages >/dev/null 2>/dev/null 331 | umount -f ${PDESTDIR9} >/dev/null 2>/dev/null 332 | fi 333 | 334 | # Copy over the pkgs 335 | rc_halt "cp -r ${PPKGDIR}/All ${PROGDIR}/pkgs" 336 | 337 | rc_halt "cd ${PROGDIR}/" 338 | 339 | truncate -s 2g arm.img 340 | MD=$(mdconfig -f arm.img) 341 | 342 | # Create the disk image 343 | rc_halt "gpart create -s MBR ${MD}" 344 | gpart add -t '!12' -a 63 -s 50m ${MD} 345 | if [ $? -ne 0 ] ; then exit 1; fi 346 | 347 | rc_halt "gpart set -a active -i 1 ${MD}" 348 | rc_halt "newfs_msdos -F 16 /dev/${MD}s1" 349 | rc_halt "gpart add -t freebsd -a 4m ${MD}" 350 | rc_halt "gpart create -s BSD ${MD}s2" 351 | rc_halt "gpart add -t freebsd-ufs ${MD}s2" 352 | rc_halt "newfs -U ${MD}s2a" 353 | rc_halt "mkdir -p ${PDESTDIR9}" 354 | rc_halt "mount /dev/${MD}s2a ${PDESTDIR9}" 355 | 356 | extract_dist "${ARMDIST}" "${PDESTDIR9}" 357 | 358 | # Get rid of debug files 359 | rc_nohalt "rm -rf ${PDESTDIR9}/usr/lib/debug" 360 | rc_nohalt "rm -rf ${PDESTDIR9}/usr/tests" 361 | 362 | # Prep for pkg install 363 | rc_halt "mkdir ${PDESTDIR9}/pkgs" 364 | rc_halt "mount_nullfs ${PROGDIR}/pkgs ${PDESTDIR9}/pkgs" 365 | rc_halt "mount -t devfs devfs ${PDESTDIR9}/dev" 366 | 367 | # Copy over the qemu binary 368 | rc_halt "cp /usr/local/bin/qemu-arm-static ${PDESTDIR9}/qemu-arm-static" 369 | rc_halt "chmod 755 ${PDESTDIR9}/qemu-arm-static" 370 | 371 | # Boot-strap PKGNG 372 | pname=`ls ${PDESTDIR9}/pkgs/pkg-[0-9]*.txz` 373 | pname=$(basename ${pname}) 374 | pkg -c ${PDESTDIR9} add /pkgs/${pname} 375 | if [ $? -ne 0 ] ; then exit 1; fi 376 | 377 | # Loop through and add pkgs 378 | while read line 379 | do 380 | pname=`ls ${PDESTDIR9}/pkgs/${line}-[0-9]*.txz` 381 | pname=$(basename ${pname}) 382 | # pkg -c ${PDESTDIR9} add /pkgs/${pname} 383 | chroot ${PDESTDIR9} /qemu-arm-static pkg add /pkgs/${pname} 384 | if [ $? -ne 0 ] ; then exit 1; fi 385 | done < ${PCONFDIR}/installcd-packages 386 | 387 | # Cleanup the qemu binary 388 | rc_halt "rm ${PDESTDIR9}/qemu-arm-static" 389 | 390 | # Copy bootloader files 391 | rc_halt "cp ${PDESTDIR9}/boot/ubldr ${PROGDIR}/" 392 | rc_halt "cp ${PDESTDIR9}/boot/dtb/rpi2.dtb ${PROGDIR}/" 393 | rc_halt "mkdir ${PDESTDIR9}/boot/msdos" 394 | 395 | # Copy over the PICO overlay 396 | tar cvf - -C ${TRUEOSSRC}/overlays/pico-overlay/ . | tar xvpf - -C ${PDESTDIR9} 397 | 398 | # Grab the latest RPI3 binary 399 | rc_halt "fetch -o ${PDESTDIR9}/opt/pico-client http://web.trueos.org/picodist/pico-client-rpi3" 400 | rc_halt "fetch -o ${PDESTDIR9}/opt/pico-client.version http://web.trueos.org/picodist/pico-client-rpi3.version" 401 | PICOVER=`cat ${PDESTDIR9}/opt/pico-client.version` 402 | rc_halt "chmod 755 ${PDESTDIR9}/opt/pico-client" 403 | 404 | sync 405 | sleep 2 406 | rc_halt "umount -f ${PDESTDIR9}/pkgs" 407 | rc_halt "umount -f ${PDESTDIR9}/dev" 408 | rc_halt "umount -f ${PDESTDIR9}" 409 | 410 | # Copy the boot-loader files 411 | rc_halt "mount_msdosfs /dev/${MD}s1 ${PDESTDIR9}" 412 | rc_halt "cp /usr/local/share/u-boot/u-boot-rpi3/* ${PDESTDIR9}/" 413 | rc_halt "cp ${PROGDIR}/ubldr ${PDESTDIR9}/" 414 | rc_halt "cp ${PROGDIR}/rpi2.dtb ${PDESTDIR9}/" 415 | 416 | # Disable TV overscan by default 417 | echo "disable_overscan=1" >> ${PDESTDIR9}/config.txt 418 | # Set some options for 32bpp 419 | echo "framebuffer_depth=32" >> ${PDESTDIR9}/config.txt 420 | echo "framebuffer_ignore_alpha=1" >> ${PDESTDIR9}/config.txt 421 | 422 | # Cleanup 423 | rc_halt "umount -f ${PDESTDIR9}" 424 | rc_halt "mdconfig -d -u ${MD}" 425 | 426 | fDate="`date '+%Y-%m-%d'`" 427 | fName="TrueOS-pico-rpi3-${fDate}.img" 428 | rc_halt "mv ${PROGDIR}/arm.img ${PROGDIR}/iso/${fName}" 429 | rc_halt "xz ${PROGDIR}/iso/${fName}" 430 | md5 -q ${PROGDIR}/iso/${fName}.xz > ${PROGDIR}/iso/${fName}.xz.md5 431 | sha256 -q ${PROGDIR}/iso/${fName}.xz > ${PROGDIR}/iso/${fName}.xz.sha256 432 | SHA=`cat ${PROGDIR}/iso/${fName}.xz.sha256` 433 | SHAMFS=`cat ${PROGDIR}/iso/rpi3-upgrade.img.gz.sha256` 434 | 435 | # Create the INDEX file 436 | cat >${PROGDIR}/iso/INDEX </dev/null 2>/dev/null 476 | umount -f ${PDESTDIR9}/tmp/packages >/dev/null 2>/dev/null 477 | umount -f ${PDESTDIR9} >/dev/null 2>/dev/null 478 | fi 479 | 480 | # Create the tmp dir we will be using 481 | mk_tmpfs_wrkdir ${PDESTDIR9} 482 | extract_dist "${BASEDIST}" "${PDESTDIR9}" 483 | extract_dist "${KERNDIST}" "${PDESTDIR9}" 484 | if [ "$ARCH" = "amd64" ] ; then 485 | extract_dist "${L32DIST}" "${PDESTDIR9}" 486 | fi 487 | 488 | # Remove freebsd's version of pc-sysinstall 489 | rc_halt "rm -rf ${PDESTDIR9}/usr/share/pc-sysinstall" 490 | 491 | # Lets install the packages we will be needing 492 | mkdir ${PDESTDIR9}/mnt >/dev/null 2>/dev/null 493 | rc_halt "mount_nullfs ${METAPKGDIR} ${PDESTDIR9}/mnt" 494 | rc_halt "cp ${PCONFDIR}/installcd-packages ${PDESTDIR9}/installcd-packages" 495 | rc_halt "mount -t devfs devfs ${PDESTDIR9}/dev" 496 | 497 | # Get the correct version of pkgng binary 498 | get_pkgstatic 499 | 500 | # Bootstrap PKGNG 501 | rc_halt "${PKGSTATIC} -c ${PDESTDIR9} add /mnt/All/pkg.txz" 502 | rc_halt "rm ${PKGSTATIC}" 503 | 504 | echo '#!/bin/sh 505 | PATH="${PATH}:/usr/local/bin:/usr/local/sbin" 506 | export PATH 507 | cd /mnt/All 508 | while read pkg 509 | do 510 | echo "Adding PACKAGE: $pkg" 511 | pkg-static add -f ${pkg} 512 | if [ $? -ne 0 ] ; then 513 | sleep 5 514 | echo "FAILED adding: $pkg" 515 | echo "Output:" 516 | cat /tmp/pkg-log 517 | exit 1 518 | fi 519 | done ${PDESTDIR9}/.insPkgs.sh 533 | chmod 755 ${PDESTDIR9}/.insPkgs.sh 534 | chroot ${PDESTDIR9} /.insPkgs.sh 535 | res=$? 536 | rm ${PDESTDIR9}/.insPkgs.sh 537 | umount -f ${PDESTDIR9}/mnt 538 | umount -f ${PDESTDIR9}/dev 539 | 540 | # If we failed installing packages, time to halt here 541 | if [ $res -ne 0 ] ; then 542 | echo "Failed installing ISO packages!" 543 | umount -f ${PDESTDIR9} 544 | rm ${PDESTDIR9} 545 | exit 1 546 | fi 547 | 548 | # Copy over the overlays/install-overlay directory to the directory 549 | ########################################################################## 550 | tar cvf - -C ${TRUEOSSRC}/overlays/install-overlay --exclude .svn . 2>/dev/null | tar xvpf - -C ${PDESTDIR9}/ 2>/dev/null 551 | 552 | # Copy over the default pkgng template 553 | cp -r ${PROGDIR}/pkg ${PDESTDIR9}/root/pkg-template 554 | 555 | # Setup grub.cfg 556 | rc_halt "mv ${PDESTDIR9}/boot/grub/grub.cfg.trueos ${PDESTDIR9}/boot/grub/grub.cfg" 557 | 558 | # Since GIT is stupid and doesn't allow tracking empty dirs, lets make them here 559 | mkdir ${PDESTDIR9}/bin 2>/dev/null 560 | mkdir ${PDESTDIR9}/dev 2>/dev/null 561 | mkdir ${PDESTDIR9}/home 2>/dev/null 562 | mkdir ${PDESTDIR9}/liveroot 2>/dev/null 563 | mkdir ${PDESTDIR9}/media 2>/dev/null 564 | mkdir ${PDESTDIR9}/memfs 2>/dev/null 565 | mkdir ${PDESTDIR9}/mnt 2>/dev/null 566 | mkdir ${PDESTDIR9}/mntuzip 2>/dev/null 567 | mkdir ${PDESTDIR9}/tmp 2>/dev/null 568 | mkdir -p ${PDESTDIR9}/var/lib/xkb 2>/dev/null 569 | mkdir ${PDESTDIR9}/uzip 2>/dev/null 570 | 571 | # Copy over the amd64 overlays if we need to 572 | ########################################################################## 573 | if [ "$ARCH" = "amd64" ] ; then 574 | tar cvf - -C ${TRUEOSSRC}/overlays/install-overlay64 --exclude .svn . 2>/dev/null | tar xvpf - -C ${PDESTDIR9} 2>/dev/null 575 | fi 576 | 577 | # Set the TRUEOSVERSION on the install disk 578 | echo "${TRUEOSVER}" > ${PDESTDIR9}/trueos-media 579 | 580 | # Now set the FreeBSD version on disk 581 | REVISION="`cat ${WORLDSRC}/sys/conf/newvers.sh | grep '^REVISION=' | cut -d '"' -f 2`" 582 | if [ -z "$REVISION" ] ; then 583 | exit_err "Could not determine REVISION..." 584 | fi 585 | BRANCH="`cat ${WORLDSRC}/sys/conf/newvers.sh | grep '^BRANCH=' | cut -d '"' -f 2`" 586 | if [ -z "$BRANCH" ] ; then 587 | exit_err "Could not determine BRANCH..." 588 | fi 589 | FBSDVER="${REVISION}-${BRANCH}" 590 | echo "$FBSDVER" > ${PDESTDIR9}/fbsd-version 591 | 592 | 593 | # Setup the root password on in PDESTDIR9 which we will copy later 594 | echo '#!/bin/sh 595 | echo "trueos" | pw usermod root -h 0'>${PDESTDIR9}/.setPass.sh 596 | chmod 755 ${PDESTDIR9}/.setPass.sh 597 | chroot ${PDESTDIR9} /.setPass.sh 598 | rm ${PDESTDIR9}/.setPass.sh 599 | 600 | # Lets prune the file-system before we start archving 601 | prune_fs 602 | 603 | # Set the default pkg branch 604 | if [ -z "$DEFAULTPKGBRANCH" ] ; then 605 | DEFAULTPKGBRANCH="PRODUCTION" 606 | fi 607 | echo "$DEFAULTPKGBRANCH" > ${PDESTDIR9}/root/defaultpkgbranch 608 | 609 | # Compress the /root directory for extraction into a memory fs 610 | cp -r ${PROGDIR}/tmp/dep-list ${PDESTDIR9}/root/pkg-dep-lists 611 | rc_halt "tar cvJf ${PDESTDIR9}/uzip/root-dist.txz -C ${PDESTDIR9}/root ." 2>/dev/null 612 | rm -rf ${PDESTDIR9}/root >/dev/null 2>/dev/null 613 | mkdir ${PDESTDIR9}/root >/dev/null 2>/dev/null 614 | 615 | # Compress the /var directory for extraction into a memory fs 616 | rm -rf ${PDESTDIR9}/var/db/pkg 617 | mkdir ${PDESTDIR9}/var/db/pkg 618 | rc_halt "tar cvJf ${PDESTDIR9}/uzip/var-dist.txz -C ${PDESTDIR9}/var ." 2>/dev/null 619 | rm -rf ${PDESTDIR9}/var >/dev/null 2>/dev/null 620 | mkdir ${PDESTDIR9}/var >/dev/null 2>/dev/null 621 | 622 | # Compress the /etc directory for extraction into a memory fs 623 | rm -rf ${PDESTDIR9}/var/db/pkg 624 | rc_halt "tar cvJf ${PDESTDIR9}/uzip/etc-dist.txz -C ${PDESTDIR9}/etc ." 2>/dev/null 625 | 626 | # Symlink the /boot/zfs directory 627 | rm -rf ${PDESTDIR9}/boot/zfs >/dev/null 2>/dev/null 628 | rc_halt "ln -s /tmp/zfs ${PDESTDIR9}/boot/zfs" 629 | 630 | # Remove the debug symbols, saves space on install media 631 | rc_halt "rm -rf ${PDESTDIR9}/usr/lib/debug" 632 | rc_nohalt "rm -rf ${PDESTDIR9}/boot/kernel/*.symbols" 633 | 634 | # Copy over some /usr/bin utilities that we need before mounting /usr 635 | cp ${PDESTDIR9}/usr/bin/cut ${PDESTDIR9}/bin/ 636 | chmod 755 ${PDESTDIR9}/bin/cut 637 | cp ${PDESTDIR9}/usr/bin/du ${PDESTDIR9}/bin/ 638 | chmod 755 ${PDESTDIR9}/bin/du 639 | cp ${PDESTDIR9}/usr/bin/cmp ${PDESTDIR9}/bin/ 640 | chmod 755 ${PDESTDIR9}/bin/cmp 641 | 642 | # Make the uzip file 643 | setup_usr_uzip 644 | 645 | cd ${PROGDIR}/scripts 646 | 647 | echo "Making DVD/USB Install Images" 648 | ${PROGDIR}/scripts/9.3.makedvd.sh 649 | if [ $? -ne 0 ] ; then 650 | exit_err "Failed running 9.3.makedvd.sh" 651 | fi 652 | 653 | # Our main images are small enough to not need this anymore 654 | #echo "Making DVD/USB Network Images" 655 | # 656 | #${PROGDIR}/scripts/9.4.makenetiso.sh 657 | #if [ $? -ne 0 ] ; then 658 | # exit_err "Failed running 9.4.makenetiso.sh" 659 | #fi 660 | 661 | umount -f ${PDESTDIR9} 2>/dev/null 662 | rmdir ${PDESTDIR9} 663 | 664 | exit 0 665 | -------------------------------------------------------------------------------- /trueos/scripts/build-iso.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # PC-BSD Build configuration settings 3 | 4 | export IGNORE_OSVERSION="yes" 5 | 6 | # Where is the build program installed 7 | PROGDIR="`realpath | sed 's|/scripts||g'`" ; export PROGDIR 8 | 9 | # Copy .dist files if necessary 10 | if [ ! -e "${PROGDIR}/trueos.cfg" ] ; then 11 | cp ${PROGDIR}/trueos.cfg.dist ${PROGDIR}/trueos.cfg 12 | fi 13 | if [ ! -e "${PROGDIR}/repo.conf" ] ; then 14 | cp ${PROGDIR}/repo.conf.dist ${PROGDIR}/repo.conf 15 | fi 16 | if [ ! -d "${PROGDIR}/pkg" ] ; then 17 | cp -r ${PROGDIR}/pkg-dist ${PROGDIR}/pkg 18 | fi 19 | if [ ! -d "${PROGDIR}/pbi" ] ; then 20 | cp -r ${PROGDIR}/pbi-dist ${PROGDIR}/pbi 21 | fi 22 | 23 | cd ${PROGDIR}/scripts 24 | 25 | # Source the config file 26 | . ${PROGDIR}/trueos.cfg 27 | 28 | # First, lets check if we have all the required programs to build an ISO 29 | . ${PROGDIR}/scripts/functions.sh 30 | 31 | # Check if we have required programs 32 | sh ${PROGDIR}/scripts/checkprogs.sh 33 | cStat=$? 34 | if [ $cStat -ne 0 ] ; then exit $cStat; fi 35 | 36 | do_world() { 37 | 38 | echo "Starting build of FreeBSD/TrueOS" 39 | ${PROGDIR}/scripts/1.createworld.sh 40 | if [ $? -ne 0 ] ; then 41 | echo "Script failed!" 42 | exit 1 43 | fi 44 | } 45 | 46 | do_iso() 47 | { 48 | if [ "$ARCH" = "i386" ] ; then return 0; fi 49 | 50 | echo "Building ISO file" 51 | 52 | rm ${PROGDIR}/iso/* >/dev/null 2>/dev/null 53 | 54 | # If on ARM, only need single image 55 | echo "$PACKAGE_ARCH" | grep -q "arm" 56 | if [ $? -eq 0 ] ; then 57 | unset SYSBUILD 58 | fi 59 | 60 | # If on AMD64, only need single image 61 | if [ -z "$PACKAGE_ARCH" -o "$PACKAGE_ARCH" = "amd64" ] ; then 62 | SYSBUILD="BOTH" 63 | fi 64 | 65 | # Are we building both TrueOS / PC-BSD images? 66 | if [ -z "$SYSBUILD" -o "$SYSBUILD" = "BOTH" ] ; then 67 | 68 | local oSys="$SYSBUILD" 69 | DOINGSYSBOTH="YES" ; export DOINGSYSBOTH 70 | SYSBUILD="desktop" ; export SYSBUILD 71 | ${PROGDIR}/scripts/9.freesbie.sh 72 | if [ $? -ne 0 ] ; then 73 | echo "Script failed!" 74 | exit 1 75 | fi 76 | SYSBUILD="server" ; export SYSBUILD 77 | ${PROGDIR}/scripts/9.freesbie.sh 78 | if [ $? -ne 0 ] ; then 79 | echo "Script failed!" 80 | exit 1 81 | fi 82 | SYSBUILD="$oSys" ; export SYSBUILD 83 | unset DOINGSYSBOTH 84 | else 85 | ${PROGDIR}/scripts/9.freesbie.sh 86 | if [ $? -ne 0 ] ; then 87 | echo "Script failed!" 88 | exit 1 89 | fi 90 | fi 91 | 92 | # Make the net install file directory now 93 | echo "Making Net Files" 94 | ${PROGDIR}/scripts/9.6.makenetfiles.sh 95 | if [ $? -ne 0 ] ; then 96 | exit_err "Failed running 9.6.makenetfiles.sh" 97 | fi 98 | 99 | } 100 | 101 | do_vms() { 102 | echo "Creating VM images" 103 | ${PROGDIR}/scripts/9.7.makevbox.sh 104 | if [ $? -ne 0 ] ; then 105 | exit_err "Failed running 9.7.makevbox.sh" 106 | fi 107 | } 108 | 109 | do_clean() 110 | { 111 | rm ${PROGDIR}/tmp/* 2>/dev/null 112 | rm ${PROGDIR}/tmp/All/* 2>/dev/null 113 | } 114 | 115 | do_iso_ports() 116 | { 117 | echo "Building ISO ports" 118 | 119 | if [ ! -e "${DISTDIR}/base.txz" -a ! -e "${DISTDIR}/fbsd-dist.txz" ] ; then 120 | echo "Missing WORLD files, please create first!" 121 | exit 1 122 | fi 123 | 124 | sh ${PROGDIR}/scripts/portbuild.sh iso 125 | if [ $? -ne 0 ] ; then 126 | echo "Script failed!" 127 | exit 1 128 | fi 129 | } 130 | 131 | do_ports() 132 | { 133 | echo "Building RELEASE ports" 134 | 135 | if [ ! -e "${DISTDIR}/base.txz" ] ; then 136 | echo "Missing WORLD files, please create first!" 137 | exit 1 138 | fi 139 | 140 | sh ${PROGDIR}/scripts/portbuild.sh all 141 | if [ $? -ne 0 ] ; then 142 | echo "Script failed!" 143 | exit 1 144 | fi 145 | } 146 | 147 | do_ports_all() 148 | { 149 | sh ${PROGDIR}/scripts/portbuild.sh portsnap 150 | exit $? 151 | } 152 | 153 | do_pbi-index() 154 | { 155 | if [ "$ARCH" = "i386" ] ; then return 0; fi 156 | sh ${PROGDIR}/scripts/portbuild.sh pbi-index 157 | exit $? 158 | } 159 | 160 | do_ports_trueos() 161 | { 162 | if [ ! -d "${PJPORTSDIR}" ] ; then 163 | sh ${PROGDIR}/scripts/portbuild.sh portsnap 164 | if [ $? -ne 0 ] ; then 165 | exit 1 166 | fi 167 | fi 168 | sh ${PROGDIR}/scripts/portbuild.sh portmerge 169 | exit $? 170 | } 171 | 172 | do_check_ports() 173 | { 174 | if [ "$ARCH" = "i386" ] ; then return 0; fi 175 | check_essential_pkgs "NO" 176 | exit $? 177 | } 178 | 179 | echo "Operation started: `date`" 180 | 181 | TARGET="$1" 182 | if [ -z "$TARGET" ] ; then TARGET="all"; fi 183 | 184 | case $TARGET in 185 | all|ALL) do_world 186 | do_ports 187 | if [ $? -ne 0 ] ; then exit 1 ; fi 188 | do_iso ;; 189 | world) do_world ;; 190 | iso) do_iso ;; 191 | vm) do_vms ;; 192 | ports) do_ports; exit $? ;; 193 | iso-ports) do_iso_ports; exit $? ;; 194 | check-ports) do_check_ports ;; 195 | ports-update-all) do_ports_all ;; 196 | ports-update-trueos) do_ports_trueos ;; 197 | pbi-index) do_pbi-index ;; 198 | clean) do_clean ;; 199 | menu) sh ${PROGDIR}/scripts/menu.sh ;; 200 | *) ;; 201 | esac 202 | 203 | 204 | echo "Operation finished: `date`" 205 | exit 0 206 | -------------------------------------------------------------------------------- /trueos/scripts/checkprogs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check if we have sourced the variables yet 4 | if [ -z $PDESTDIR ] 5 | then 6 | . ../trueos.cfg 7 | fi 8 | 9 | # Source our functions 10 | . ${PROGDIR}/scripts/functions.sh 11 | 12 | # Make sure we have some directories we need 13 | mkdir -p ${PROGDIR}/iso >/dev/null 2>/dev/null 14 | mkdir -p ${PROGDIR}/log >/dev/null 2>/dev/null 15 | 16 | which git >/dev/null 2>/dev/null 17 | if [ "$?" != "0" ]; then 18 | echo "Installing git.." 19 | rc_halt "pkg install devel/git" 20 | fi 21 | 22 | which zip >/dev/null 2>/dev/null 23 | if [ "$?" != "0" ]; then 24 | echo "Installing zip.." 25 | rc_halt "pkg install -y archivers/zip" 26 | fi 27 | 28 | which grub-mkrescue >/dev/null 2>/dev/null 29 | if [ "$?" != "0" ]; then 30 | echo "Installing grub-mkrescue.." 31 | rc_halt "pkg install -y sysutils/grub2-pcbsd" 32 | fi 33 | 34 | which xorriso >/dev/null 2>/dev/null 35 | if [ "$?" != "0" ]; then 36 | echo "Installing xorriso.." 37 | rc_halt "pkg install -y sysutils/xorriso" 38 | fi 39 | 40 | which pixz >/dev/null 2>/dev/null 41 | if [ "$?" != "0" ]; then 42 | echo "Installing pixz.." 43 | rc_halt "pkg install -y archivers/pixz" 44 | fi 45 | 46 | pkg info textproc/py-sphinx >/dev/null 2>/dev/null 47 | if [ "$?" != "0" ]; then 48 | echo "Installing py-sphinx.." 49 | rc_halt "pkg install -y textproc/py-sphinx" 50 | fi 51 | 52 | pkg info textproc/py-sphinxcontrib-httpdomain >/dev/null 2>/dev/null 53 | if [ "$?" != "0" ]; then 54 | echo "Installing py-sphinxcontrib-httpdomain.." 55 | rc_halt "pkg install -y textproc/py-sphinxcontrib-httpdomain" 56 | fi 57 | 58 | pkg info textproc/py-sphinx-intl >/dev/null 2>/dev/null 59 | if [ "$?" != "0" ]; then 60 | echo "Installing py-sphinx-intl.." 61 | rc_halt "pkg install -y textproc/py-sphinx-intl" 62 | fi 63 | 64 | pkg info -q textproc/py-sphinx_numfig >/dev/null 2>/dev/null 65 | if [ "$?" != "0" ]; then 66 | echo "Installing sphinx_numfig.." 67 | rc_halt "pkg install -y textproc/py-sphinx_numfig" 68 | fi 69 | 70 | pkg info -q textproc/py-sphinx_rtd_theme >/dev/null 2>/dev/null 71 | if [ "$?" != "0" ]; then 72 | echo "Installing sphinx_rtd_theme.." 73 | rc_halt "pkg install -y textproc/py-sphinx_rtd_theme" 74 | fi 75 | 76 | pkg info -q textproc/py-sphinx_wikipedia >/dev/null 2>/dev/null 77 | if [ "$?" != "0" ]; then 78 | echo "Installing sphinx_wikipedia.." 79 | rc_halt "pkg install -y textproc/py-sphinx_wikipedia" 80 | fi 81 | 82 | pkg info -q textproc/py-sphinxcontrib-httpdomain >/dev/null 2>/dev/null 83 | if [ "$?" != "0" ]; then 84 | echo "Installing sphinxcontrib-httpdomain.." 85 | rc_halt "pkg install -y textproc/py-sphinxcontrib-httpdomain" 86 | fi 87 | 88 | pkg info "print/tex-formats" >/dev/null 2>/dev/null 89 | if [ "$?" != "0" ]; then 90 | echo "Installing print/tex-formats.." 91 | rc_halt "pkg install -y print/tex-formats" 92 | fi 93 | 94 | pkg info "print/tex-dvipsk" >/dev/null 2>/dev/null 95 | if [ "$?" != "0" ]; then 96 | echo "Installing print/tex-dvipsk.." 97 | rc_halt "pkg install -y print/tex-dvipsk" 98 | fi 99 | 100 | pkg info "devel/gmake" >/dev/null 2>/dev/null 101 | if [ "$?" != "0" ]; then 102 | echo "Installing devel/gmake.." 103 | rc_halt "pkg install -y devel/gmake" 104 | fi 105 | 106 | pkg info "archivers/pxz" >/dev/null 2>/dev/null 107 | if [ "$?" != "0" ]; then 108 | echo "Installing archivers/pxz.." 109 | rc_halt "pkg install -y archivers/pxz" 110 | fi 111 | 112 | pkg info "textproc/libucl" >/dev/null 2>/dev/null 113 | if [ "$?" != "0" ]; then 114 | echo "Installing textproc/libucl.." 115 | rc_halt "pkg install -y textproc/libucl" 116 | fi 117 | 118 | pkg info "textproc/jq" >/dev/null 2>/dev/null 119 | if [ "$?" != "0" ]; then 120 | echo "Installing textproc/jq.." 121 | rc_halt "pkg install -y textproc/jq" 122 | fi 123 | 124 | pkg info "devel/llvm40" >/dev/null 2>/dev/null 125 | if [ "$?" != "0" ]; then 126 | echo "Installing devel/llvm40" 127 | rc_halt "pkg install -y devel/llvm40" 128 | fi 129 | 130 | pkg info "sysutils/u-boot-rpi2" >/dev/null 2>/dev/null 131 | if [ "$?" != "0" ]; then 132 | echo "Installing sysutils/u-boot-rpi2" 133 | rc_halt "pkg install -y sysutils/u-boot-rpi2" 134 | fi 135 | 136 | which poudriere >/dev/null 2>/dev/null 137 | if [ "$?" != "0" ]; then 138 | echo "Installing poudriere.." 139 | rc_halt "pkg install -y ports-mgmt/poudriere" 140 | fi 141 | 142 | which mktorrent >/dev/null 2>/dev/null 143 | if [ "$?" != "0" ]; then 144 | echo "Installing mktorrent.." 145 | rc_halt "pkg install -y net-p2p/mktorrent" 146 | fi 147 | -------------------------------------------------------------------------------- /trueos/scripts/functions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Most of these dont need to be modified 4 | ######################################################### 5 | 6 | # Where is the build program installed 7 | PROGDIR="`realpath | sed 's|/scripts||g'`" ; export PROGDIR 8 | 9 | # Source vars 10 | . ${PROGDIR}/trueos.cfg 11 | 12 | # Where on disk is the TRUEOS GIT branch 13 | TRUEOSSRC="${PROGDIR}/git/trueos" 14 | export TRUEOSSRC 15 | 16 | # Where are the dist files 17 | DISTDIR="${PROGDIR}/fbsd-dist" ; export DISTDIR 18 | 19 | # Set the dist files 20 | ARMDIST="$DISTDIR/fbsd-dist.txz" 21 | BASEDIST="$DISTDIR/base.txz" 22 | KERNDIST="$DISTDIR/kernel.txz" 23 | L32DIST="$DISTDIR/lib32.txz" 24 | export BASEDIST KERNDIST L32DIST 25 | 26 | # Location of FreeBSD sources 27 | WORLDSRC="${PROGDIR}/git/freebsd" 28 | export WORLDSRC 29 | 30 | # Where to build the world directory 31 | PDESTDIR="${PROGDIR}/buildworld" ; export PDESTDIR 32 | PDESTDIR9="${PROGDIR}/buildworld9" ; export PDESTDIR9 33 | PDESTDIRFBSD="${PROGDIR}/buildworld-fbsd" ; export PDESTDIRFBSD 34 | PDESTDIRSERVER="${PROGDIR}/buildworld-server" ; export PDESTDIRSERVER 35 | 36 | # Set the TrueOS Version 37 | export TRUEOSVER="${TARGETREL}" 38 | 39 | # Set the ISO Version 40 | REVISION="`cat ${WORLDSRC}/sys/conf/newvers.sh 2>/dev/null | grep '^REVISION=' | cut -d '"' -f 2`" 41 | if [ -z "$REVISION" ] ; then 42 | REVISION="UNKNOWN" 43 | fi 44 | BRANCH="`cat ${WORLDSRC}/sys/conf/newvers.sh 2>/dev/null | grep '^BRANCH=' | cut -d '"' -f 2`" 45 | if [ -z "$BRANCH" ] ; then 46 | BRANCH="UNKNOWN" 47 | fi 48 | if [ -z "$ISOVER" ] ; then 49 | # This can be overridden via trueos.cfg 50 | export ISOVER="${REVISION}-${BRANCH}" 51 | fi 52 | 53 | # Where are the config files 54 | PCONFDIR="${TRUEOSSRC}/build-files/conf/desktop" ; export PCONFDIR 55 | if [ "$SYSBUILD" = "server" ] ; then 56 | PCONFDIR="${TRUEOSSRC}/build-files/conf/server" ; export PCONFDIR 57 | fi 58 | 59 | # Use the PICO config files 60 | case ${BUILDTYPE} in 61 | PICO) PCONFDIR="${TRUEOSSRC}/build-files/conf/pico" 62 | export PCONFDIR ;; 63 | *) ;; 64 | esac 65 | 66 | # Where do we place the log files 67 | PLOGFILES="${PROGDIR}/log" ; export PLOGFILES 68 | 69 | REALARCH="`uname -m`" 70 | export REALARCH 71 | case $ARCH in 72 | i386) FARCH="x86" ; export FARCH ;; 73 | amd64) FARCH="x64" ; export FARCH ;; 74 | *) FARCH="x86" ; export FARCH ;; 75 | esac 76 | 77 | # Set the location of packages needed for our Meta-Packages 78 | export METAPKGDIR="${PROGDIR}/tmp" 79 | 80 | if [ -z "$JAILVER" ] ; then 81 | JAILVER="$TARGETREL" 82 | fi 83 | if [ -z "$PKGVERUPLOAD" ] ; then 84 | PKGVERUPLOAD="$JAILVER" 85 | fi 86 | 87 | # Poud variables 88 | if [ "$SYSBUILD" = "server" -a -z "$DOINGSYSBOTH" ] ; then 89 | PBUILD="trueos-`echo $JAILVER | sed 's|\.||g'`" 90 | if [ "$ARCH" = "i386" ] ; then PBUILD="${PBUILD}-i386"; fi 91 | else 92 | PBUILD="trueos-`echo $JAILVER | sed 's|\.||g'`" 93 | if [ "$ARCH" = "i386" ] ; then PBUILD="${PBUILD}-i386"; fi 94 | fi 95 | PPORTS="trueosports" 96 | if [ -z "$PPKGDIR" ] ; then 97 | PPKGDIR="$POUD/data/packages/${JAILVER}-${PPORTS}" 98 | fi 99 | PJAILNAME="`echo $JAILVER | sed 's|\.||g'`" 100 | PJPORTSDIR="/poud/ports/${PPORTS}" 101 | export PBUILD JPORTSDIR PPKGDIR PPORTS PJAILNAME 102 | if [ ! -e "$PPKGDIR" ] ; then 103 | mkdir -p ${PPKGDIR} 104 | fi 105 | 106 | # Check for required dirs 107 | rDirs="/log /git /iso /fbsd-dist /tmp" 108 | for i in $rDirs 109 | do 110 | if [ ! -d "${PROGDIR}/${i}" ] ; then 111 | mkdir -p ${PROGDIR}/${i} 112 | fi 113 | done 114 | 115 | ################ 116 | # Functions 117 | ################ 118 | 119 | exit_err() { 120 | echo "ERROR: $@" 121 | exit 1 122 | } 123 | 124 | clean_wrkdir() 125 | { 126 | if [ -z "$1" ] ; then exit_err "Missing wrkdir..."; fi 127 | if [ -e "${1}" ]; then 128 | echo "Cleaning up ${1}" 129 | umount -f ${1}/dev >/dev/null 2>/dev/null 130 | umount -f ${1}/mnt >/dev/null 2>/dev/null 131 | umount -f ${1}/usr/src >/dev/null 2>/dev/null 132 | umount -f ${1} >/dev/null 2>/dev/null 133 | rmdir ${1} 134 | fi 135 | } 136 | 137 | mk_tmpfs_wrkdir() 138 | { 139 | if [ -z "$1" ] ; then exit_err "Missing wrkdir..."; fi 140 | 141 | clean_wrkdir "$1" 142 | 143 | mkdir -p "${1}" 144 | mount -t tmpfs tmpfs "${1}" 145 | } 146 | 147 | extract_dist() 148 | { 149 | if [ -z "$1" -o -z "$2" ] ; then exit_err "Missing variables..." ; fi 150 | if [ ! -e "$1" ] ; then exit_err "Invalid DISTFILE $1" ; fi 151 | if [ ! -d "$2" ] ; then exit_err "Invalid DESTDIR $2" ; fi 152 | 153 | echo "Extracting $1 to $2" 154 | tar xvf $1 -C $2 2>/dev/null 155 | } 156 | 157 | cp_overlay() 158 | { 159 | echo "Copying overlay $1 -> $2" 160 | tar cvf - --exclude .svn -C ${1} . 2>/dev/null | tar xvmf - -C ${2} 2>/dev/null 161 | } 162 | 163 | # Run-command, don't halt if command exits with non-0 164 | rc_nohalt() 165 | { 166 | local CMD="$1" 167 | 168 | if [ -z "${CMD}" ] 169 | then 170 | exit_err "Error: missing argument in rc_nohalt()" 171 | fi 172 | 173 | ${CMD} 2>/dev/null >/dev/null 174 | 175 | }; 176 | 177 | # Run-command, halt if command exits with non-0 178 | rc_halt() 179 | { 180 | local CMD="$1" 181 | if [ -z "${CMD}" ]; then 182 | exit_err "Error: missing argument in rc_halt()" 183 | fi 184 | 185 | echo "Running command: $CMD" 186 | ${CMD} 187 | if [ $? -ne 0 ]; then 188 | exit_err "Error ${STATUS}: ${CMD}" 189 | fi 190 | }; 191 | 192 | rtn() 193 | { 194 | echo "Press ENTER to continue" 195 | read tmp 196 | }; 197 | 198 | create_pkg_conf() 199 | { 200 | if [ -d "${PROGDIR}/tmp/repo" ] ; then 201 | rm -rf ${PROGDIR}/tmp/repo 202 | fi 203 | mkdir ${PROGDIR}/tmp/repo 204 | if [ -d "${PROGDIR}/tmp/sysrel" ] ; then 205 | rm -rf ${PROGDIR}/tmp/sysrel 206 | fi 207 | mkdir ${PROGDIR}/tmp/sysrel 208 | 209 | ABIVER=`echo $FREEBSDVER | cut -d '-' -f 1 | cut -d '.' -f 1` 210 | echo "PKG_CACHEDIR: ${PROGDIR}/tmp" > ${PROGDIR}/tmp/pkg.conf 211 | echo "ALTABI: freebsd:${ABIVER}:x86:64" >> ${PROGDIR}/tmp/pkg.conf 212 | echo "ABI: FreeBSD:${ABIVER}:amd64" >> ${PROGDIR}/tmp/pkg.conf 213 | 214 | 215 | # Doing a local package build 216 | echo "localrepo: { 217 | url: \"file://${PPKGDIR}\", 218 | enabled: true 219 | }" > ${PROGDIR}/tmp/repo/local.conf 220 | } 221 | 222 | create_installer_pkg_conf() 223 | { 224 | if [ -d "${PROGDIR}/tmp/repo-installer" ] ; then 225 | rm -rf ${PROGDIR}/tmp/repo-installer 226 | fi 227 | mkdir ${PROGDIR}/tmp/repo-installer 228 | 229 | echo "trueos-build: { 230 | url: \"file:///mnt\", 231 | enabled: true 232 | }" > ${PROGDIR}/tmp/repo-installer/repo.conf 233 | } 234 | 235 | # Copy the ISO package files to a new location 236 | cp_iso_pkg_files() 237 | { 238 | if [ -d "$METAPKGDIR" ] ; then 239 | rm -rf ${METAPKGDIR} 240 | fi 241 | mkdir ${METAPKGDIR} 242 | 243 | create_pkg_conf 244 | 245 | echo "Fetching TrueOS ISO packages... Please wait, this may take several minutes..." 246 | 247 | haveWarn=0 248 | 249 | # Packages to fetch / include on install media 250 | local eP="${PCONFDIR}/iso-packages" 251 | 252 | # Use the version of pkgng for the target 253 | get_pkgstatic 254 | 255 | # Now fetch these packages 256 | while read pkgLine 257 | do 258 | pkgName=`echo $pkgLine | cut -d ' ' -f 1` 259 | pkgLocal=`echo $pkgLine | cut -d ' ' -f 2` 260 | localFlg="" 261 | pConf="-C ${PROGDIR}/tmp/pkg.conf" 262 | 263 | # See if this is something we can skip for now 264 | skip=0 265 | for j in $skipPkgs 266 | do 267 | if [ "$pkgName" = "${j}" ] ; then skip=1; break; fi 268 | done 269 | if [ $skip -eq 1 ] ; then echo "Skipping $pkgBase.."; continue ; fi 270 | 271 | # Fetch the packages 272 | rc_halt "${PKGSTATIC} ${pConf} -R ${PROGDIR}/tmp/repo/ fetch -y -o ${PROGDIR}/tmp $localFlg -d ${pkgName}" 273 | sync 274 | sleep 0.5 275 | done < $eP 276 | 277 | # Grab all the FreeBSD base packages 278 | rc_halt "cp ${PROGDIR}/fbsd-pkg/* ${PROGDIR}/tmp/All/" 279 | 280 | # Remove the FreeBSD Debug Packages 281 | rc_halt "rm ${PROGDIR}/tmp/All/FreeBSD*-debug-*.txz" 282 | 283 | # Copy pkgng 284 | rc_halt "cp ${PROGDIR}/tmp/All/pkg-*.txz ${PROGDIR}/tmp/All/pkg.txz" 285 | 286 | # Now we need to create the new repo files for DVD / USB 287 | rc_halt "cd ${PROGDIR}/tmp" 288 | rc_halt "${PKGSTATIC} repo ." 289 | rc_halt "cd ${PROGDIR}" 290 | 291 | # Cleanup PKGSTATIC 292 | rc_halt "rm ${PKGSTATIC}" 293 | 294 | create_installer_pkg_conf 295 | } 296 | 297 | update_poud_world() 298 | { 299 | echo "Removing old jail - $PJAILNAME" 300 | poudriere jail -d -j $PJAILNAME 301 | rm -rf /poud/jails/$PJAILNAME 302 | 303 | # Nuke the built-in manifests from poudriere, since they don't match ours 304 | rm /usr/local/share/poudriere/MANIFESTS/* 2>/dev/null 305 | 306 | case ${PICOFLAVOR} in 307 | minnowboard) 308 | echo "Creating new MinnowBoard jail: $PJAILNAME - $JAILVER" 309 | poudriere jail -c -j $PJAILNAME -v $JAILVER -m tar=${DISTDIR}/fbsd-dist.txz 310 | if [ $? -ne 0 ] ; then 311 | exit_err "Failed creating poudriere MinnowBoard jail" 312 | fi 313 | return 0 314 | ;; 315 | rpi2) echo "Creating new RPI2 jail: $PJAILNAME - $JAILVER" 316 | poudriere jail -c -j $PJAILNAME -v $JAILVER -a arm.armv6 -m tar=${DISTDIR}/fbsd-dist.txz 317 | if [ $? -ne 0 ] ; then 318 | exit_err "Failed creating poudriere RPI2 jail" 319 | fi 320 | return 0 321 | ;; 322 | rpi3) echo "Creating new RPI3 jail: $PJAILNAME - $JAILVER" 323 | poudriere jail -c -j $PJAILNAME -v $JAILVER -a arm.arm64 -m tar=${DISTDIR}/fbsd-dist.txz 324 | if [ $? -ne 0 ] ; then 325 | exit_err "Failed creating poudriere RPI3 jail" 326 | fi 327 | return 0 328 | ;; 329 | *) ;; 330 | esac 331 | 332 | echo "Creating new jail: $PJAILNAME - $JAILVER" 333 | poudriere jail -c -j $PJAILNAME -v $JAILVER -m url=file://${DISTDIR} 334 | if [ $? -ne 0 ] ; then 335 | exit_err "Failed creating poudriere jail" 336 | fi 337 | } 338 | 339 | get_last_rev() 340 | { 341 | oPWD=`pwd` 342 | rev=0 343 | cd "$1" 344 | rev=`git log -n 1 --date=raw ${1} | grep 'Date:' | awk '{print $2}'` 345 | cd $oPWD 346 | if [ $rev -ne 0 ] ; then 347 | echo "$rev" 348 | return 0 349 | fi 350 | return 1 351 | } 352 | 353 | check_essential_pkgs() 354 | { 355 | echo "Checking essential pkgs..." 356 | haveWarn=0 357 | 358 | # Build the list of packages to check 359 | cat ${1} ${2} ${3} > /tmp/.pkgList.$$ 360 | chkList="" 361 | while read line 362 | do 363 | # See if these dirs exist 364 | ls -d ${PJPORTSDIR}/${line} >/dev/null 2>/dev/null 365 | if [ $? -ne 0 ] ; then 366 | echo "Warning: No such port ($line) to check..." 367 | continue 368 | fi 369 | for i in `ls -d ${PJPORTSDIR}/${line}` 370 | do 371 | chkList="$chkList $i" 372 | done 373 | done < /tmp/.pkgList.$$ 374 | rm /tmp/.pkgList.$$ 375 | 376 | # Check all our TrueOS meta-pkgs, warn if some of them don't exist 377 | # or cannot be determined 378 | for i in $chkList 379 | do 380 | 381 | # Get the pkgname 382 | pkgName="" 383 | pkgName=`make -C ${i} -V PKGNAME PORTSDIR=${PJPORTSDIR} __MAKE_CONF=/usr/local/etc/poudriere.d/${PJAILNAME}-make.conf` 384 | if [ -z "${pkgName}" ] ; then 385 | echo "Could not get PKGNAME for ${i}" 386 | haveWarn=1 387 | fi 388 | 389 | # Check the arch type 390 | pArch=`make -C ${i} -V ONLY_FOR_ARCHS PORTSDIR=${PJPORTSDIR}` 391 | if [ -n "$pArch" -a "$pArch" != "$ARCH" ] ; then continue; fi 392 | 393 | if [ ! -e "${PPKGDIR}/All/${pkgName}.txz" ] ; then 394 | echo "Checked: ${PPKGDIR}/All/${pkgName}.txz" 395 | echo "WARNING: Missing package ${pkgName} for port ${i}" 396 | haveWarn=1 397 | else 398 | fi 399 | done 400 | 401 | return $haveWarn 402 | } 403 | 404 | get_pkgstatic() 405 | { 406 | if [ "$1" = "EXTRACTONLY" ] ; then 407 | echo "Extracting pkg-static..." 408 | else 409 | echo "Setting up pkg-static.." 410 | create_pkg_conf 411 | fi 412 | 413 | rm /tmp/pkg-static >/dev/null 2>/dev/null 414 | rc_halt "tar xv --strip-components 4 -f ${PPKGDIR}/Latest/pkg.txz -C /tmp /usr/local/sbin/pkg-static" >/dev/null 2>/dev/null 415 | rc_halt "mv /tmp/pkg-static /tmp/pkg-static.$$" >/dev/null 2>/dev/null 416 | 417 | PKGSTATIC="/tmp/pkg-static.$$" ; export PKGSTATIC 418 | if [ "$1" = "EXTRACTONLY" ] ; then return; fi 419 | 420 | # Update the repo schema files before using 421 | rc_halt "${PKGSTATIC} -C ${PROGDIR}/tmp/pkg.conf -R ${PROGDIR}/tmp/repo/ update -f" 422 | } 423 | -------------------------------------------------------------------------------- /trueos/scripts/menu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Where is the build program installed 4 | PROGDIR="`realpath | sed 's|/scripts||g'`" ; export PROGDIR 5 | 6 | # Source the config file 7 | . ${PROGDIR}/trueos.cfg 8 | 9 | cd ${PROGDIR}/scripts 10 | 11 | # Source our functions 12 | . ${PROGDIR}/scripts/functions.sh 13 | 14 | # Check requirements 15 | ${PROGDIR}/scripts/checkprogs.sh 16 | 17 | if [ `id -u` != "0" ] ; then 18 | exit_err "Whoops! Need to run me as root!" 19 | fi 20 | 21 | # Set answer file 22 | ans="/tmp/.ans.$$" 23 | 24 | upload_menu() 25 | { 26 | sh ${PROGDIR}/scripts/upload.sh 27 | } 28 | 29 | ports_menu() 30 | { 31 | cd ${PROGDIR}/scripts 32 | TITLE="Ports Menu" 33 | while : 34 | do 35 | cd ${PROGDIR}/scripts 36 | dialog --backtitle "$TITLE" --menu "Select a build option:" 14 40 40 merge "Update just PC-BSD ports" pup "Update entire ports tree" back "Back" 2>${ans} 37 | if [ $? -ne 0 ] ; then 38 | echo "Canceled!" 39 | exit 1 40 | fi 41 | case `cat $ans` in 42 | pup) ./portbuild.sh portsnap ; rtn ;; 43 | merge) ./portbuild.sh portmerge ; rtn ;; 44 | back) break ;; 45 | *) ;; 46 | esac 47 | done 48 | 49 | }; 50 | 51 | 52 | cd ${PROGDIR}/scripts 53 | 54 | 55 | while : 56 | do 57 | 58 | TITLE="Main Menu" 59 | 60 | cd ${PROGDIR}/scripts 61 | 62 | if [ -e "upload.sh" ]; then 63 | # Start the main dialog 64 | dialog --backtitle "$TITLE" --menu "Select a build option:" 16 50 40 world "Rebuild World/Kernel" packages "Build packages (Poudriere)" iso "Create ISO Files" ports "Ports menu" upload "Upload menu" exit "Exit" 2>${ans} 65 | else 66 | dialog --backtitle "$TITLE" --menu "Select a build option:" 16 50 40 world "Rebuild World/Kernel" packages "Build packages (Poudriere)" iso "Create ISO Files" ports "Ports menu" exit "Exit" 2>${ans} 67 | fi 68 | 69 | if [ $? -ne 0 ] ; then 70 | echo "Canceled!" 71 | exit 1 72 | fi 73 | case `cat $ans` in 74 | world) echo "Rebuild the FreeBSD world?" 75 | echo -e "(Y/N)\c" 76 | read tmp 77 | if [ "$tmp" = "Y" -o "$tmp" = "y" ] ; then 78 | ./build-iso.sh world 79 | fi 80 | rtn 81 | ;; 82 | iso) rm ${PROGDIR}/log/.done_9 2>/dev/null 83 | ./build-iso.sh iso 84 | echo "ISO files created in ${PROGDIR}/iso" 85 | rtn ;; 86 | packages) ./build-iso.sh packages ; rtn ;; 87 | ports) ports_menu ;; 88 | upload) upload_menu ;; 89 | exit) exit 0 ;; 90 | *) ;; 91 | esac 92 | 93 | done 94 | -------------------------------------------------------------------------------- /trueos/scripts/mergesvnports: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #- 3 | # Copyright (c) 2002-2006 FreeBSD GNOME Team 4 | # Copyright (c) 2009 KDE FreeBSD Team 5 | # Copyright (c) 2011 PC-BSD 6 | # All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions 10 | # are met: 11 | # 1. Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # 2. Redistributions in binary form must reproduce the above copyright 14 | # notice, this list of conditions and the following disclaimer in the 15 | # documentation and/or other materials provided with the distribution. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | # SUCH DAMAGE. 28 | # 29 | # Based on marcusmerge, adapted for area51 30 | # by Martin Wilke 31 | # 32 | # 33 | 34 | # Path to the xorg ports without the trailing /. 35 | SDIR="$1" 36 | 37 | # Path to the ports collection to update 38 | PORTSDIR="$2" 39 | 40 | if [ -z "$SDIR" -o -z "$PORTSDIR" ] ; then 41 | echo "Missing SOURCE or TARGET" 42 | exit 1 43 | fi 44 | 45 | # Merge MK files 46 | echo "===> Merging files from $SDIR to $PORTSDIR directory" 47 | echo "${SDIR} --> ${PORTSDIR}" 48 | 49 | # Merge the Mk/ files 50 | if [ -d ${SDIR}/Mk ]; then 51 | for mk in `ls -1 ${SDIR}/Mk/*.mk`; do 52 | cp ${mk} ${PORTSDIR}/Mk 53 | done 54 | fi 55 | 56 | #Merge Category and Ports 57 | cd ${SDIR} 58 | for categorypath in `find . -type d -depth 1`; do 59 | category=$(basename "$categorypath") 60 | 61 | if [ ${category} = ".svn" ]; then 62 | continue 63 | fi 64 | for port in `ls -1 ${SDIR}/${category}`; do 65 | if [ ${port} = ".svn" ]; then 66 | continue 67 | fi 68 | if [ ! -f ${SDIR}/${category}/${port}/Makefile ]; then 69 | fi 70 | if [ ! -d ${PORTSDIR}/${category} ]; then 71 | 72 | mkdir -p ${PORTSDIR}/${category} 73 | fi 74 | if [ -d ${PORTSDIR}/${category}/${port} ]; then 75 | 76 | rm -rf ${PORTSDIR}/${category}/${port}/work 77 | find ${PORTSDIR}/${category}/${port} \! -path "*/.svn/*" -type f | \ 78 | xargs rm -f 79 | fi 80 | 81 | cd ${SDIR}/${category} 82 | tar --exclude "*/.svn*" -cf - ${port} | \ 83 | tar -xf - -C ${PORTSDIR}/${category} 84 | done 85 | done 86 | -------------------------------------------------------------------------------- /trueos/scripts/portbuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Meta pkg building startup script 3 | ############################################# 4 | 5 | # Where is the build program installed 6 | PROGDIR="`realpath | sed 's|/scripts||g'`" ; export PROGDIR 7 | echo "Using PROGDIR: $PROGDIR" 8 | 9 | # Source the config file 10 | . ${PROGDIR}/trueos.cfg 11 | 12 | cd ${PROGDIR}/scripts 13 | 14 | # Source our functions 15 | . ${PROGDIR}/scripts/functions.sh 16 | 17 | # Check if we have required programs 18 | sh ${PROGDIR}/scripts/checkprogs.sh 19 | cStat=$? 20 | if [ $cStat -ne 0 ] ; then exit $cStat; fi 21 | 22 | merge_trueos_src_ports() 23 | { 24 | local mcwd=`pwd` 25 | local gitdir="$1" 26 | local portsdir="$2" 27 | distCache="/usr/ports/distfiles" 28 | 29 | # Jump back to where we belong 30 | rc_halt "cd $mcwd" 31 | 32 | # If on 10.x we can stop now 33 | if [ -n "$TRUEOSLEGACY" ] ; then return 0 ; fi 34 | 35 | while read line 36 | do 37 | unset repo 38 | unset _branch 39 | repo=`echo $line | awk '{print $1}'` 40 | _branch=`echo $line | awk '{print $2}'` 41 | dname=$(basename $repo) 42 | 43 | if [ -n "$_branch" ] ; then 44 | rc_halt "git clone -b ${_branch} --depth=1 https://github.com/${repo}.git" 45 | else 46 | rc_halt "git clone --depth=1 https://github.com/${repo}.git" 47 | fi 48 | rc_halt "cd $dname" 49 | rc_halt "./mkport.sh ${portsdir} ${distCache}" 50 | rc_halt "cd $mcwd" >/dev/null 2>/dev/null 51 | done < ${gitdir}/build-files/conf/desktop/external-port-repos 52 | } 53 | 54 | massage_subdir() { 55 | cd "$1" 56 | if [ $? -ne 0 ] ; then 57 | echo "SKIPPING $i" 58 | return 0 59 | fi 60 | 61 | comment="`cat Makefile | grep 'COMMENT ='`" 62 | 63 | echo "# \$FreeBSD\$ 64 | # 65 | 66 | $comment 67 | " > Makefile.tmp 68 | 69 | for d in `ls` 70 | do 71 | if [ "$d" = ".." ]; then continue ; fi 72 | if [ "$d" = "." ]; then continue ; fi 73 | if [ "$d" = "Makefile" ]; then continue ; fi 74 | if [ ! -f "$d/Makefile" ]; then continue ; fi 75 | echo " SUBDIR += $d" >> Makefile.tmp 76 | done 77 | echo "" >> Makefile.tmp 78 | echo ".include " >> Makefile.tmp 79 | mv Makefile.tmp Makefile 80 | 81 | } 82 | 83 | mk_metapkg_bulkfile() 84 | { 85 | local bulkList=$1 86 | rm $bulkList >/dev/null 2>/dev/null 87 | 88 | rc_halt "cp ${PCONFDIR}/essential-packages-iso $bulkList" 89 | } 90 | 91 | mk_poud_config() 92 | { 93 | 94 | # Get the memory in MB on system 95 | MEM=$(sysctl -n hw.physmem) 96 | MEM=$(expr $MEM / 1024) 97 | MEM=$(expr $MEM / 1024) 98 | 99 | CPUS=$(sysctl -n kern.smp.cpus) 100 | if [ $CPUS -gt 16 ] ; then 101 | BUILDERS="16" 102 | JOBS="YES" 103 | else 104 | BUILDERS="$CPUS" 105 | JOBS="NO" 106 | fi 107 | 108 | # Determine TMPFS usage based upon Memory to CPUs ratio 109 | MEMPERBUILDER=$(expr $MEM / $CPUS) 110 | if [ $MEMPERBUILDER -gt 1500 ]; then 111 | TMPWRK="all" 112 | elif [ $MEMPERBUILDER -gt 750 ] ; then 113 | TMPWRK="wrkdirs" 114 | else 115 | TMPWRK="no" 116 | fi 117 | 118 | # Allow these defaults to be overridden 119 | BCONF="/usr/local/etc/poudriere-builders.conf" 120 | if [ -e "$BCONF" ] ; then 121 | grep -q "^BUILDERS=" ${BCONF} 122 | if [ $? -eq 0 ] ; then 123 | BUILDERS=$(grep "^BUILDERS=" ${BCONF} | cut -d '=' -f 2) 124 | fi 125 | grep -q "^JOBS=" ${BCONF} 126 | if [ $? -eq 0 ] ; then 127 | JOBS=$(grep "^JOBS=" ${BCONF} | cut -d '=' -f 2) 128 | fi 129 | grep -q "^TMPFSWORK=" ${BCONF} 130 | if [ $? -eq 0 ] ; then 131 | TMPWRK=$(grep "^TMPFSWORK=" ${BCONF} | cut -d '=' -f 2) 132 | fi 133 | fi 134 | 135 | # Figure out ZFS settings 136 | ZPOOL=$(mount | grep 'on / ' | cut -d '/' -f 1) 137 | ZROOT="/poud" 138 | 139 | cat >/usr/local/etc/poudriere.conf << EOF 140 | ZPOOL=$ZPOOL 141 | ZROOTFS=$ZROOT 142 | FREEBSD_HOST=file://${DISTDIR} 143 | BUILD_AS_NON_ROOT=no 144 | RESOLV_CONF=/etc/resolv.conf 145 | BASEFS=/poud 146 | USE_PORTLINT=no 147 | USE_TMPFS=${TMPWRK} 148 | DISTFILES_CACHE=/usr/ports/distfiles 149 | CHECK_CHANGED_OPTIONS=verbose 150 | CHECK_CHANGED_DEPS=yes 151 | PARALLEL_JOBS=${BUILDERS} 152 | WRKDIR_ARCHIVE_FORMAT=txz 153 | ALLOW_MAKE_JOBS_PACKAGES="pkg ccache py* llvm* libreoffice* apache-openoffice* webkit* firefox* chrom* iridium* gcc* qt5-*" 154 | MAX_EXECUTION_TIME=86400 155 | NOHANG_TIME=12600 156 | ATOMIC_PACKAGE_REPOSITORY=no 157 | PKG_REPO_FROM_HOST=yes 158 | BUILDER_HOSTNAME=builds.trueos.org 159 | PRIORITY_BOOST="pypy openoffice* paraview webkit* llvm* iridiu* chrom* firefox*" 160 | GIT_URL=${PORTS_GIT_URL} 161 | USE_COLORS=yes 162 | NOLINUX=yes 163 | RESTRICT_NETWORKING=no 164 | EOF 165 | 166 | if [ "$JOBS" = "yes" ] ; then 167 | echo "ALLOW_MAKE_JOBS=yes" >> /usr/local/etc/poudriere.conf 168 | fi 169 | # Check if we have a ccache dir to be used 170 | if [ -e "/ccache" ] ; then 171 | echo "CCACHE_DIR=/ccache" >> /usr/local/etc/poudriere.conf 172 | fi 173 | 174 | # Signing script 175 | if [ -n "$PKGSIGNCMD" ] ; then 176 | echo "SIGNING_COMMAND=${PKGSIGNCMD}" >> /usr/local/etc/poudriere.conf 177 | fi 178 | 179 | # Workaround an issue using ldconfig inside a jail with OpenRC 180 | sed -i '' 's|injail service ldconfig start|injail /etc/rc.d/ldconfig start|g' /usr/local/share/poudriere/common.sh 181 | 182 | } 183 | 184 | do_portsnap() 185 | { 186 | mk_poud_config 187 | 188 | # Kill any previous running jail 189 | poudriere jail -k -j ${PJAILNAME} -p ${PPORTS} 2>/dev/null 190 | 191 | echo "Removing old ports dir..." 192 | poudriere ports -p ${PPORTS} -d 193 | rm -rf /poud/ports/${PPORTS} 194 | 195 | echo "Pulling ports from ${PORTS_GIT_URL} - ${PORTS_GIT_BRANCH}" 196 | poudriere ports -c -p ${PPORTS} -B ${PORTS_GIT_BRANCH} -m git 197 | if [ $? -ne 0 ] ; then 198 | exit_err "Failed pulling ports tree" 199 | fi 200 | } 201 | 202 | do_trueos_portmerge() 203 | { 204 | # Copy our TRUEOS port files 205 | merge_trueos_src_ports "${TRUEOSSRC}" "/poud/ports/${PPORTS}" 206 | } 207 | 208 | if [ -z "$1" ] ; then 209 | target="all" 210 | else 211 | target="$1" 212 | fi 213 | 214 | cd ${PROGDIR} 215 | 216 | if [ -d "${TRUEOSSRC}" ]; then 217 | rm -rf ${TRUEOSSRC} 218 | fi 219 | mkdir -p ${TRUEOSSRC} 220 | echo "git clone --depth=1 -b ${GITTRUEOSBRANCH} ${GITTRUEOSURL} ${TRUEOSSRC}" 221 | rc_halt "git clone --depth=1 -b ${GITTRUEOSBRANCH} ${GITTRUEOSURL} ${TRUEOSSRC}" 222 | 223 | rc_halt "cd ${PCONFDIR}/" >/dev/null 2>/dev/null 224 | cp ${PCONFDIR}/port-make.conf /usr/local/etc/poudriere.d/${PJAILNAME}-make.conf 225 | 226 | if [ "$target" = "all" ] ; then 227 | 228 | # Kill any previous running jail 229 | poudriere jail -k -j ${PJAILNAME} -p ${PPORTS} 2>/dev/null 230 | 231 | # Cleanup old packages? 232 | POUDFLAGS="" 233 | if [ "$WIPEPOUDRIERE" = "true" ] ; then 234 | echo "Cleaning old packages" 235 | POUDFLAGS="-c" 236 | fi 237 | 238 | # Selectively nuke any packages? 239 | if [ -n "$DELPOUDRIEREPKGS" ] ; then 240 | echo "Removing packages: ${DELPOUDRIEREPKGS}" 241 | echo "Changing to ${PPKGDIR}/All" 242 | cd ${PPKGDIR}/All 243 | if [ $? -eq 0 ] ; then 244 | rm ${DELPOUDRIEREPKGS} 245 | fi 246 | cd ${PROGDIR}/scripts 247 | fi 248 | 249 | # Create the poud config 250 | mk_poud_config 251 | 252 | # Extract the world for this poud build 253 | update_poud_world 254 | 255 | # Build entire ports tree 256 | poudriere bulk -a ${POUDFLAGS} -j ${PJAILNAME} -p ${PPORTS} 257 | if [ $? -ne 0 ] ; then 258 | echo "Failed poudriere build..." 259 | fi 260 | 261 | # Make sure the essentials built, exit now if not 262 | echo "Checking essential packages for release..." 263 | check_essential_pkgs "${PCONFDIR}/essential-packages-iso ${PCONFDIR}/essential-packages-release" 264 | if [ $? -ne 0 ] ; then 265 | exit 1 266 | fi 267 | 268 | exit 0 269 | elif [ "$target" = "iso" ] ; then 270 | 271 | # Kill any previous running jail 272 | poudriere jail -k -j ${PJAILNAME} -p ${PPORTS} 2>/dev/null 273 | 274 | # Cleanup old packages? 275 | POUDFLAGS="" 276 | if [ "$WIPEPOUDRIERE" = "true" ] ; then 277 | POUDFLAGS="-c" 278 | fi 279 | 280 | # Selectively nuke any packages? 281 | if [ -n "$DELPOUDRIEREPKGS" ] ; then 282 | echo "Removing packages: ${DELPOUDRIEREPKGS}" 283 | echo "Changing to ${PPKGDIR}/All" 284 | cd ${PPKGDIR}/All 285 | if [ $? -eq 0 ] ; then 286 | rm ${DELPOUDRIEREPKGS} 287 | fi 288 | cd ${PROGDIR}/scripts 289 | fi 290 | 291 | # Create the poud config 292 | mk_poud_config 293 | 294 | # Extract the world for this poud build 295 | update_poud_world 296 | 297 | # Start the build 298 | poudriere bulk ${POUDFLAGS} -j ${PJAILNAME} -p ${PPORTS} -f ${PCONFDIR}/essential-packages-iso 299 | if [ $? -ne 0 ] ; then 300 | echo "Failed poudriere build..." 301 | fi 302 | 303 | # Make sure the essentials built, exit now if not 304 | echo "Checking essential packages for ISO creation..." 305 | check_essential_pkgs "${PCONFDIR}/essential-packages-iso" 306 | if [ $? -ne 0 ] ; then 307 | exit 1 308 | fi 309 | 310 | exit 0 311 | elif [ "$1" = "portsnap" ] ; then 312 | do_portsnap 313 | do_trueos_portmerge 314 | exit 0 315 | elif [ "$1" = "portmerge" ] ; then 316 | do_trueos_portmerge 317 | exit 0 318 | else 319 | echo "Invalid option!" 320 | exit 1 321 | fi 322 | -------------------------------------------------------------------------------- /trueos/scripts/pre-installs/gettytab: -------------------------------------------------------------------------------- 1 | # $FreeBSD$ 2 | # from: @(#)gettytab 5.14 (Berkeley) 3/27/91 3 | # 4 | # Most of the table entries here are just copies of the old getty table, 5 | # it is by no means certain, or even likely, that any of them are optimal 6 | # for any purpose whatever. Nor is it likely that more than a couple are 7 | # even correct. 8 | # 9 | # The default gettytab entry, used to set defaults for all other 10 | # entries, and in cases where getty is called with no table name. 11 | # 12 | # cb, ce and ck are desirable on most crt's. The non-crt entries need to 13 | # be changed to turn them off (:cb@:ce@:ck@:). 14 | # 15 | # lc should always be on; it's a remainder of some stone age when there 16 | # have been terminals around not being able of handling lower-case 17 | # characters. Those terminals aren't supported any longer, but getty is 18 | # `smart' about them by default. 19 | # 20 | # Parity defaults to even, but the Pc entry and all the `std' entries 21 | # specify no parity. The different parities are: 22 | # (none): same as ep for getty. login will use terminal as is. 23 | # ep: getty will use raw mode (cs8 -parenb) (unless rw is set) and 24 | # fake parity. login will use even parity (cs7 parenb -parodd). 25 | # op: same as ep except odd parity (cs7 parenb parodd) for login. 26 | # getty will fake odd parity as well. 27 | # ap: same as ep except -inpck instead of inpck for login. 28 | # ap overrides op and ep. 29 | # np: 1. don't fake parity in getty. The fake parity garbles 30 | # characters on non-terminals (like pccons) that don't 31 | # support parity. It would probably better for getty not to 32 | # try to fake parity. It could just use cbreak mode so as 33 | # not to force cs8 and let the hardware handle the parity. 34 | # login has to be rely on the hardware anyway. 35 | # 2. set cs8 -parenb -istrip -inpck. 36 | # ep:op: same as ap. 37 | # 38 | default:\ 39 | :cb:ce:ck:lc:fd#1000:im=\r\n%s/%m (%h) (%t)\r\n\r\n:sp#1200:\ 40 | :if=/etc/issue: 41 | 42 | # 43 | # Fixed speed entries 44 | # 45 | # The "std.NNN" names are known to the special case 46 | # portselector code in getty, however they can 47 | # be assigned to any table desired. 48 | # The "NNN-baud" names are known to the special case 49 | # autobaud code in getty, and likewise can 50 | # be assigned to any table desired (hopefully the same speed). 51 | # 52 | a|std.110|110-baud:\ 53 | :np:nd#1:cd#1:uc:sp#110: 54 | b|std.134|134.5-baud:\ 55 | :np:nd#1:cd#2:ff#1:td#1:sp#134:ht:nl: 56 | 1|std.150|150-baud:\ 57 | :np:nd#1:cd#2:td#1:fd#1:sp#150:ht:nl:lm=\E\72\6\6\17login\72 : 58 | c|std.300|300-baud:\ 59 | :np:nd#1:cd#1:sp#300: 60 | d|std.600|600-baud:\ 61 | :np:nd#1:cd#1:sp#600: 62 | f|std.1200|1200-baud:\ 63 | :np:fd#1:sp#1200: 64 | 6|std.2400|2400-baud:\ 65 | :np:sp#2400: 66 | 7|std.4800|4800-baud:\ 67 | :np:sp#4800: 68 | 2|std.9600|9600-baud:\ 69 | :np:sp#9600: 70 | g|std.19200|19200-baud:\ 71 | :np:sp#19200: 72 | std.38400|38400-baud:\ 73 | :np:sp#38400: 74 | std.57600|57600-baud:\ 75 | :np:sp#57600: 76 | std.115200|115200-baud:\ 77 | :np:sp#115200: 78 | std.230400|230400-baud:\ 79 | :np:sp#230400: 80 | 81 | # 82 | # Entry specifying explicit device settings. See termios(4) and 83 | # /usr/include/termios.h, too. The entry forces the tty into 84 | # CLOCAL mode (so no DCD is required), and uses Xon/Xoff flow control. 85 | # 86 | # cflags: CLOCAL | HUPCL | CREAD | CS8 87 | # oflags: OPOST | ONLCR | OXTABS 88 | # iflags: IXOFF | IXON | ICRNL | IGNPAR 89 | # lflags: IEXTEN | ICANON | ISIG | ECHOCTL | ECHO | ECHOK | ECHOE | ECHOKE 90 | # 91 | # The `0' flags don't have input enabled. The `1' flags don't echo. 92 | # (Echoing is done inside getty itself.) 93 | # 94 | local.9600|CLOCAL tty @ 9600 Bd:\ 95 | :c0#0x0000c300:c1#0x0000cb00:c2#0x0000cb00:\ 96 | :o0#0x00000007:o1#0x00000002:o2#0x00000007:\ 97 | :i0#0x00000704:i1#0x00000000:i2#0x00000704:\ 98 | :l0#0x000005cf:l1#0x00000000:l2#0x000005cf:\ 99 | :sp#9600:np: 100 | 101 | # 102 | # Dial in rotary tables, speed selection via 'break' 103 | # 104 | 0|d300|Dial-300:\ 105 | :nx=d1200:cd#2:sp#300: 106 | d1200|Dial-1200:\ 107 | :nx=d150:fd#1:sp#1200: 108 | d150|Dial-150:\ 109 | :nx=d110:lm@:tc=150-baud: 110 | d110|Dial-110:\ 111 | :nx=d300:tc=300-baud: 112 | 113 | # 114 | # Fast dialup terminals, 2400/1200/300 rotary (can start either way) 115 | # 116 | D2400|d2400|Fast-Dial-2400:\ 117 | :nx=D1200:tc=2400-baud: 118 | 3|D1200|Fast-Dial-1200:\ 119 | :nx=D300:tc=1200-baud: 120 | 5|D300|Fast-Dial-300:\ 121 | :nx=D2400:tc=300-baud: 122 | 123 | # 124 | #telebit (19200) 125 | # 126 | t19200:\ 127 | :nx=t2400:tc=19200-baud: 128 | t2400:\ 129 | :nx=t1200:tc=2400-baud: 130 | t1200:\ 131 | :nx=t19200:tc=1200-baud: 132 | 133 | # 134 | #telebit (9600) 135 | # 136 | t9600:\ 137 | :nx=t2400a:tc=9600-baud: 138 | t2400a:\ 139 | :nx=t1200a:tc=2400-baud: 140 | t1200a:\ 141 | :nx=t9600:tc=1200-baud: 142 | 143 | # 144 | # Odd special case terminals 145 | # 146 | -|tty33|asr33|Pity the poor user of this beast:\ 147 | :tc=110-baud: 148 | 149 | 4|Console|Console Decwriter II:\ 150 | :nd@:cd@:rw:tc=300-baud: 151 | 152 | e|Console-1200|Console Decwriter III:\ 153 | :fd@:nd@:cd@:rw:tc=1200-baud: 154 | 155 | i|Interdata console:\ 156 | :uc:sp#0: 157 | 158 | l|lsi chess terminal:\ 159 | :sp#300: 160 | 161 | X|Xwindow|X window system:\ 162 | :fd@:nd@:cd@:rw:sp#9600: 163 | 164 | P|Pc|Pc console:\ 165 | :ht:np:sp#9600: 166 | 167 | # 168 | # Weirdo special case for fast crt's with hardcopy devices 169 | # 170 | 8|T9600|CRT with hardcopy:\ 171 | :nx=T300:tc=9600-baud: 172 | 9|T300|CRT with hardcopy (300):\ 173 | :nx=T9600:tc=300-baud: 174 | 175 | # 176 | # Plugboard, and misc other terminals 177 | # 178 | plug-9600|Plugboard-9600:\ 179 | :pf#1:tc=9600-baud: 180 | p|P9600|Plugboard-9600-rotary:\ 181 | :pf#1:nx=P300:tc=9600-baud: 182 | q|P300|Plugboard-300:\ 183 | :pf#1:nx=P1200:tc=300-baud: 184 | r|P1200|Plugboard-1200:\ 185 | :pf#1:nx=P9600:tc=1200-baud: 186 | 187 | # 188 | # XXXX Port selector 189 | # 190 | s|DSW|Port Selector:\ 191 | :ps:sp#2400: 192 | 193 | # 194 | # Auto-baud speed detect entry for Micom 600. 195 | # Special code in getty will switch this out 196 | # to one of the NNN-baud entries. 197 | # 198 | A|Auto-baud:\ 199 | :ab:sp#2400:f0#040: 200 | 201 | # 202 | # autologin - automatically log in as root 203 | # 204 | 205 | autologin|al.9600:\ 206 | :al=root:tc=std.9600: 207 | al.19200:\ 208 | :al=root:tc=std.19200: 209 | al.38400:\ 210 | :al=root:tc=std.38400: 211 | al.57600:\ 212 | :al=root:tc=std.57600: 213 | al.115200:\ 214 | :al=root:tc=std.115200: 215 | al.230400:\ 216 | :al=root:tc=std.230400: 217 | 218 | # 219 | # Entries for 3-wire serial terminals. These don't supply carrier, so 220 | # clocal needs to be set, and crtscts needs to be unset. 221 | # 222 | 3wire.9600|9600-3wire:\ 223 | :np:nc:sp#9600: 224 | 3wire.19200|19200-3wire:\ 225 | :np:nc:sp#19200: 226 | 3wire.38400|38400-3wire:\ 227 | :np:nc:sp#38400: 228 | 3wire.57600|57600-3wire:\ 229 | :np:nc:sp#57600: 230 | 3wire.115200|115200-3wire:\ 231 | :np:nc:sp#115200: 232 | 3wire.230400|230400-3wire:\ 233 | :np:nc:sp#230400: 234 | -------------------------------------------------------------------------------- /trueos/scripts/pre-installs/trueos-desktop.cfg: -------------------------------------------------------------------------------- 1 | # Auto-Generated pc-sysinstall configuration 2 | installQuiet=yes 3 | installInteractive=no 4 | installMode=fresh 5 | installType=PCBSD 6 | packageType=dist 7 | distFiles=base doc games kernel lib32 8 | 9 | installMedium=local 10 | localPath=/dist 11 | netSaveDev=AUTO-DHCP-SLAAC 12 | 13 | # Disk Setup for ada0 14 | disk0=ada0 15 | partition=ALL 16 | bootManager=GRUB 17 | partscheme=GPT 18 | commitDiskPart 19 | 20 | # Partition Setup for ada0(ALL) 21 | # All sizes are expressed in MB 22 | # Avail FS Types, UFS, UFS+S, UFS+SUJ, UFS+J, ZFS, SWAP 23 | # UFS.eli, UFS+S.eli, UFS+SUJ, UFS+J.eli, ZFS.eli, SWAP.eli 24 | # UFS.eli, UFS+S.eli, UFS+SUJ, UFS+J.eli, ZFS.eli, SWAP.eli 25 | disk0-part=ZFS 0 /(compress=lz4|atime=off),/tmp(compress=lz4|setuid=off|exec=off),/usr(canmount=off),/usr/home(compress=lz4),/usr/jails(compress=lz4),/usr/obj(compress=lz4),/usr/pbi(compress=lz4),/usr/ports(compress=lz4),/usr/src(compress=lz4),/var(canmount=off|atime=on),/var/audit(compress=lz4),/var/log(compress=lz4|exec=off|setuid=off),/var/tmp(compress=lz4|exec=off|setuid=off) 26 | disk0-part=SWAP.eli 2000 none 27 | commitDiskLabel 28 | 29 | installPackages=pcbsd-base misc/pcbsd-meta-kde archivers/unzip archivers/unrar pcbsd-meta-virtualboxguest pcbsd-meta-vwmareguest 30 | 31 | runCommand=mkdir -p /usr/local/tmp/warden-dist/ 32 | runExtCommand=cp /dist/*.txz ${FSMNT}/usr/local/tmp/warden-dist/ 33 | 34 | runExtCommand=mount -t devfs devfs ${FSMNT}/dev 35 | runCommand=sh /usr/local/share/pcbsd/scripts/sys-init.sh desktop en_US vm 36 | runCommand=touch /var/.runxsetup 37 | runCommand=touch /var/.pcbsd-firstboot 38 | runCommand=touch /var/.pcbsd-firstgui 39 | runExtCommand=umount ${FSMNT}/dev 40 | -------------------------------------------------------------------------------- /trueos/scripts/pre-installs/trueos-server.cfg: -------------------------------------------------------------------------------- 1 | # Auto-Generated pc-sysinstall configuration 2 | installQuiet=yes 3 | installInteractive=no 4 | installMode=fresh 5 | installType=FreeBSD 6 | packageType=dist 7 | distFiles=base doc games kernel lib32 8 | 9 | installMedium=local 10 | localPath=/dist 11 | netSaveDev=AUTO-DHCP-SLAAC 12 | 13 | # Disk Setup for ada0 14 | disk0=ada0 15 | partition=ALL 16 | bootManager=GRUB 17 | partscheme=GPT 18 | commitDiskPart 19 | 20 | # Partition Setup for ada0(ALL) 21 | # All sizes are expressed in MB 22 | # Avail FS Types, UFS, UFS+S, UFS+SUJ, UFS+J, ZFS, SWAP 23 | # UFS.eli, UFS+S.eli, UFS+SUJ, UFS+J.eli, ZFS.eli, SWAP.eli 24 | # UFS.eli, UFS+S.eli, UFS+SUJ, UFS+J.eli, ZFS.eli, SWAP.eli 25 | disk0-part=ZFS 0 /(compress=lz4|atime=off),/tmp(compress=lz4|setuid=off|exec=off),/usr(canmount=off),/usr/home(compress=lz4),/usr/jails(compress=lz4),/usr/obj(compress=lz4),/usr/pbi(compress=lz4),/usr/ports(compress=lz4),/usr/src(compress=lz4),/var(canmount=off|atime=on),/var/audit(compress=lz4),/var/log(compress=lz4|exec=off|setuid=off),/var/tmp(compress=lz4|exec=off|setuid=off) 26 | disk0-part=SWAP.eli 2000 none 27 | commitDiskLabel 28 | 29 | installPackages=trueos-base misc/pcbsd-meta-virtualboxguest misc/pcbsd-meta-vwmareguest editors/vim 30 | 31 | rootPass=pcbsd 32 | 33 | runCommand=mkdir -p /usr/local/tmp/warden-dist/ 34 | runExtCommand=cp /dist/*.txz ${FSMNT}/usr/local/tmp/warden-dist/ 35 | 36 | runExtCommand=mount -t devfs devfs ${FSMNT}/dev 37 | runCommand=sh /usr/local/share/pcbsd/scripts/sys-init.sh server en_US vm 38 | runExtCommand=umount ${FSMNT}/dev 39 | -------------------------------------------------------------------------------- /trueos/scripts/pre-installs/ttys: -------------------------------------------------------------------------------- 1 | # 2 | # $FreeBSD$ 3 | # @(#)ttys 5.1 (Berkeley) 4/17/89 4 | # 5 | # This file specifies various information about terminals on the system. 6 | # It is used by several different programs. Common entries for the 7 | # various columns include: 8 | # 9 | # name The name of the terminal device. 10 | # 11 | # getty The program to start running on the terminal. Typically a 12 | # getty program, as the name implies. Other common entries 13 | # include none, when no getty is needed, and xdm, to start the 14 | # X Window System. 15 | # 16 | # type The initial terminal type for this port. For hardwired 17 | # terminal lines, this will contain the type of terminal used. 18 | # For virtual consoles, the correct type is typically xterm. 19 | # Other common values include dialup for incoming modem ports, and 20 | # unknown when the terminal type cannot be predetermined. 21 | # 22 | # status Must be on or off. If on, init will run the getty program on 23 | # the specified port. If the word "secure" appears, this tty 24 | # allows root login. 25 | # 26 | # name getty type status comments 27 | # 28 | # If console is marked "insecure", then init will ask for the root password 29 | # when going to single-user mode. 30 | console none unknown off secure 31 | # 32 | ttyv0 "/usr/libexec/getty Pc" xterm on secure 33 | # Virtual terminals 34 | ttyv1 "/usr/libexec/getty Pc" xterm on secure 35 | ttyv2 "/usr/libexec/getty Pc" xterm on secure 36 | ttyv3 "/usr/libexec/getty Pc" xterm on secure 37 | ttyv4 "/usr/libexec/getty Pc" xterm on secure 38 | ttyv5 "/usr/libexec/getty Pc" xterm on secure 39 | ttyv6 "/usr/libexec/getty Pc" xterm on secure 40 | ttyv7 "/usr/libexec/getty Pc" xterm on secure 41 | ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure 42 | # Serial terminals 43 | # The 'dialup' keyword identifies dialin lines to login, fingerd etc. 44 | ttyu0 "/usr/libexec/getty autologin" xterm on secure 45 | ttyu1 "/usr/libexec/getty std.9600" dialup off secure 46 | ttyu2 "/usr/libexec/getty std.9600" dialup off secure 47 | ttyu3 "/usr/libexec/getty std.9600" dialup off secure 48 | # Dumb console 49 | dcons "/usr/libexec/getty std.9600" vt100 off secure 50 | -------------------------------------------------------------------------------- /trueos/trueos.cfg.dist: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # PC-BSD Build configuration settings 3 | 4 | # Which PC-BSD git URL to clone 5 | GITTRUEOSURL="https://github.com/trueos/pcbsd.git" 6 | export GITTRUEOSURL 7 | 8 | # Branch of the PC-BSD repo to build with 9 | # Available (master|releng/10.1.2|releng/10.1.1) 10 | # 11 | # Note, this is only used for the overlays/install-overlay directory 12 | # All other PC-BSD code is pulled from the PKGNG repo. If you want to 13 | # customize these bits, you will want to build a new local repo below. 14 | GITTRUEOSBRANCH="master" 15 | export GITTRUEOSBRANCH 16 | 17 | # Which PC-BSD/FreeBSD git URL to clone for FreeBSD world/kernel 18 | GITFBSDURL="https://github.com/trueos/freebsd.git" 19 | export GITFBSDURL 20 | 21 | # The branch of FreeBSD to build 22 | # Available (releng/9.2, stable/10) 23 | GITFBSDBRANCH="master" 24 | export GITFBSDBRANCH 25 | 26 | # Set the target version of this build 27 | # This is where pkgs will be uploaded to 28 | TARGETREL="11.0-CURRENTJULY2015" 29 | export TARGETREL 30 | 31 | # Set the poudreire jail target 32 | # This is what will be used for poudriere jail 33 | #POUDRIEREJAILVER="10.0-RELEASE" 34 | export POUDREIREJAILVER 35 | 36 | # Set the target ARCH type for world / pkgng building 37 | ARCH="amd64" 38 | export ARCH 39 | 40 | # Set if we are using a locally built PKGNG repo, or a remote one 41 | # Available (local, remote, localpkg) 42 | # 43 | # NOTE: If using local, you will need to install poudriere and be required 44 | # to do a complete PKGNG build of the FreeBSD ports tree. 45 | # 46 | # If using "localpkg" packages will be built locally, and ISOs from remote 47 | # Be sure to configure repo.conf first! 48 | PKGREPO="local" 49 | export PKGREPO 50 | 51 | # Git URL to pull the ports tree from, used if PKGREPO is set to "local" 52 | PORTS_GIT_URL="--depth 1 https://github.com/trueos/freebsd-ports.git" 53 | export PORTS_GIT_URL 54 | 55 | # Poudriere data location, used if PKGREPO is set to "local" 56 | POUD="/usr/local/poudriere" 57 | export POUD 58 | 59 | # Run Poudriere in verbose mode? 60 | # YES / NO - Default NO 61 | #POUD_VERBOSE="YES" 62 | export POUD_VERBOSE 63 | 64 | # Set PBI signing key, used for pbi_makeindex 65 | # EXAMPLE: openssl genrsa -des3 -out private.pem 2048 66 | # openssl rsa -in private.pem -outform PEM -pubout -out public.pem 67 | #PBI_REPO_KEY="" 68 | export PBI_REPO_KEY 69 | 70 | # Set the ISO version manually 71 | #ISOVER="10.2-RELEASE" 72 | export ISOVER 73 | 74 | # Where to save TRUEOS git sources 75 | #TRUEOSGITDIR="" 76 | export TRUEOSGITDIR 77 | 78 | # Where to save FreeBSD git sources 79 | #FREEBSDGITDIR="" 80 | export FREEBSDGITDIR 81 | --------------------------------------------------------------------------------