├── tests ├── freenas │ ├── install.conf │ ├── config.pyd │ ├── run.py │ ├── vm.py │ └── main.py └── trueos │ ├── overlay │ ├── etc │ │ ├── fstab │ │ ├── sysctl.conf │ │ ├── bootstrap │ │ ├── rc.conf │ │ ├── launchd.d │ │ │ └── getty.ttyu0.json │ │ └── ssh │ │ │ └── sshd_config │ ├── boot │ │ └── loader.conf │ └── root │ │ └── .ssh │ │ ├── id_rsa.pub │ │ ├── authorized_keys │ │ └── id_rsa │ ├── t05_kqueue_tests.py │ ├── t00_running.py │ ├── t01_launchctl.py │ ├── t04_notifyutil.py │ ├── t02_getty.py │ └── t03_notifyd_loaded.py ├── .gitignore ├── Jenkinsfile ├── Jenkins ├── freenas-nightlies └── truenas-nightlies ├── README.md ├── Makefile ├── Makefile.inc1 └── LICENSE /tests/freenas/install.conf: -------------------------------------------------------------------------------- 1 | password=abcd1234 2 | whenDone=reboot 3 | disk=ada0 4 | -------------------------------------------------------------------------------- /tests/trueos/overlay/etc/fstab: -------------------------------------------------------------------------------- 1 | /dev/ada0 / ufs rw 0 0 2 | /dev/ada1 none swap sw 0 0 -------------------------------------------------------------------------------- /tests/trueos/overlay/etc/sysctl.conf: -------------------------------------------------------------------------------- 1 | debug.debugger_on_panic=0 2 | debug.kdb.break_to_debugger=1 3 | -------------------------------------------------------------------------------- /tests/trueos/overlay/etc/bootstrap: -------------------------------------------------------------------------------- 1 | mount -uw / 2 | ifconfig lo0 inet 127.0.0.1 netmask 255.0.0.0 up 3 | 4 | -------------------------------------------------------------------------------- /tests/trueos/overlay/boot/loader.conf: -------------------------------------------------------------------------------- 1 | autoboot_delay="1" 2 | mach_load="YES" 3 | init_path="/sbin/launchd" 4 | 5 | -------------------------------------------------------------------------------- /tests/trueos/overlay/etc/rc.conf: -------------------------------------------------------------------------------- 1 | hostname="mach-bhyve" 2 | ifconfig_vtnet0="inet 192.168.240.2 netmask 255.255.255.0 up" 3 | sshd_enable="YES" 4 | 5 | -------------------------------------------------------------------------------- /tests/trueos/overlay/etc/launchd.d/getty.ttyu0.json: -------------------------------------------------------------------------------- 1 | { 2 | "Label": "org.freebsd.getty.ttyu0", 3 | "ProgramArguments": [ 4 | "/usr/libexec/getty", 5 | "std.9600", 6 | "ttyu0" 7 | ], 8 | "RunAtLoad": true, 9 | "KeepAlive": true 10 | } 11 | -------------------------------------------------------------------------------- /tests/trueos/overlay/root/.ssh/id_rsa.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDZkI+ulUsOdjOnYuB5IMXhSBvLn0NXOvL+IFfzLNVd1to0TV6/HO93ucoWIL4f4ijTXTJOeOq5a1SvAW3WkrBNaS155m4bSoMBeGgeoa+Gy9GHL9SETlHlxYTYduGkkdzOztuB+tWixYnHHeT1ihjdNLBAcuIXHPWDAMirTE94V9EqaX6Pp+qDj9X2CYOkknHYJLAz7Uzk4CsS3gSZI63o6pi2jlnJaSgqjJByS3cfKjSoc+hi5Vf5e4XIHC6+Kvt33+WmAYJGA9Lpl4ryZN7NjhYSQbK4YI4V6htNVNhW6TcXvrSWPBlpWqyZeS/cRQW/VFSCqUuxPy8bnGfGbgPZ test 2 | -------------------------------------------------------------------------------- /tests/trueos/overlay/root/.ssh/authorized_keys: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDZkI+ulUsOdjOnYuB5IMXhSBvLn0NXOvL+IFfzLNVd1to0TV6/HO93ucoWIL4f4ijTXTJOeOq5a1SvAW3WkrBNaS155m4bSoMBeGgeoa+Gy9GHL9SETlHlxYTYduGkkdzOztuB+tWixYnHHeT1ihjdNLBAcuIXHPWDAMirTE94V9EqaX6Pp+qDj9X2CYOkknHYJLAz7Uzk4CsS3gSZI63o6pi2jlnJaSgqjJByS3cfKjSoc+hi5Vf5e4XIHC6+Kvt33+WmAYJGA9Lpl4ryZN7NjhYSQbK4YI4V6htNVNhW6TcXvrSWPBlpWqyZeS/cRQW/VFSCqUuxPy8bnGfGbgPZ test 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### SublimeText ### 2 | *.sublime-workspace 3 | 4 | ### PyCharm ### 5 | .idea 6 | 7 | ### OSX ### 8 | .DS_Store 9 | .AppleDouble 10 | .LSOverride 11 | 12 | # Files that might appear on external disk 13 | .Spotlight-V100 14 | .Trashes 15 | 16 | # Directories potentially created on remote AFP share 17 | .AppleDB 18 | .AppleDesktop 19 | Network Trash Folder 20 | Temporary Items 21 | .apdisk 22 | 23 | ### Windows ### 24 | # Windows image file caches 25 | Thumbs.db 26 | ehthumbs.db 27 | 28 | # Folder config file 29 | Desktop.ini 30 | 31 | # Recycle Bin used on file shares 32 | $RECYCLE.BIN/ 33 | 34 | # Python files 35 | *.pyc 36 | 37 | ### PROJECT SETTINGS ### 38 | _BE/ 39 | .profile-setting 40 | .git-ref-path 41 | 42 | # Exlude compiled Sphinx docs 43 | /docs/*/_build/ 44 | 45 | 46 | # Any and all logs 47 | *.log 48 | 49 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent none 3 | 4 | environment { 5 | GH_ORG = 'freenas' 6 | GH_REPO = 'build' 7 | } 8 | stages { 9 | 10 | stage('Queued') { 11 | agent { 12 | label 'JenkinsMaster' 13 | } 14 | steps { 15 | echo "Build queued" 16 | } 17 | } 18 | 19 | stage('ixbuild') { 20 | agent { 21 | label 'FreeNAS-ISO' 22 | } 23 | post { 24 | success { 25 | archiveArtifacts artifacts: 'artifacts/**', fingerprint: true 26 | junit 'results/**' 27 | } 28 | failure { 29 | echo 'Saving failed artifacts...' 30 | archiveArtifacts artifacts: 'artifacts/**', fingerprint: true 31 | } 32 | } 33 | steps { 34 | checkout scm 35 | echo 'Starting iXBuild Framework pipeline' 36 | sh '/ixbuild/jenkins.sh freenas freenas-pipeline' 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Jenkins/freenas-nightlies: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Our default Jenkins pipeline we use to create our FreeNAS 4 | nightlies 5 | 6 | */ 7 | 8 | pipeline { 9 | agent { label 'FreeNAS-AWS-Nightlies' } 10 | 11 | environment { 12 | CHECKOUT_SHALLOW = 'YES' 13 | DELTAS = '0' 14 | FNBUILD="${env.WORKSPACE}" 15 | } 16 | 17 | stages { 18 | stage('Checkout') { 19 | steps { 20 | checkout scm 21 | sh 'mkdir -p /freenas || true' 22 | sh 'umount -f /freenas || true' 23 | sh 'mount_nullfs ${FNBUILD} /freenas' 24 | sh 'cd /freenas && make checkout PROFILE=freenas TRAIN=FreeNAS-11-Nightlies' 25 | } 26 | } 27 | stage('Build') { 28 | post { 29 | always { 30 | archiveArtifacts artifacts: 'freenas/_BE/objs/logs/**', fingerprint: false 31 | archiveArtifacts artifacts: 'freenas/_BE/objs/ports/data/logs/bulk/**', fingerprint: false 32 | } 33 | } 34 | steps { 35 | sh 'cd /freenas && make release PROFILE=freenas TRAIN=FreeNAS-11-Nightlies' 36 | } 37 | } 38 | stage('Publish') { 39 | steps { 40 | sshagent (credentials: ['db98c9b2-efa2-406b-828a-f338d31ac0d5','75bd2da4-66b6-4144-ac29-62ff49771e53']) { 41 | sh 'cd /freenas && make release-push PROFILE=freenas TRAIN=FreeNAS-11-Nightlies' 42 | } 43 | } 44 | } 45 | } 46 | post { 47 | success { 48 | script { 49 | cleanWs notFailBuild: true 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /tests/freenas/config.pyd: -------------------------------------------------------------------------------- 1 | #+ 2 | # Copyright 2016 iXsystems, Inc. 3 | # All rights reserved 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted providing that the following conditions 7 | # are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 18 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 23 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | # 26 | 27 | CORES = "1" 28 | MEMSIZE = "4096" 29 | HOST_IP = "192.168.100.1" 30 | FREENAS_IP = "192.168.100.2" 31 | NETMASK = "255.255.255.0" 32 | VM_NAME = "freenas" 33 | -------------------------------------------------------------------------------- /Jenkins/truenas-nightlies: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Our default Jenkins pipeline we use to create our TrueNAS 4 | nightlies 5 | 6 | */ 7 | 8 | pipeline { 9 | agent { label 'TrueNAS-AWS-Nightlies' } 10 | 11 | environment { 12 | CHECKOUT_SHALLOW = 'YES' 13 | DELTAS = '0' 14 | TNBUILD="${env.WORKSPACE}" 15 | } 16 | 17 | stages { 18 | stage('Checkout') { 19 | steps { 20 | checkout scm 21 | sh 'mkdir -p /truenas || true' 22 | sh 'umount -f /truenas || true' 23 | sh 'mount_nullfs ${TNBUILD} /truenas' 24 | sshagent (credentials: ['7656e8cd-e103-4936-aab4-b946ed310332']) { 25 | sh 'cd /truenas && make checkout PROFILE=freenas PRODUCT=TrueNAS TRAIN=TrueNAS-11-Nightlies' 26 | } 27 | } 28 | } 29 | stage('Build') { 30 | post { 31 | always { 32 | archiveArtifacts artifacts: 'freenas/_BE/objs/logs/**', fingerprint: false 33 | archiveArtifacts artifacts: 'freenas/_BE/objs/ports/data/logs/bulk/**', fingerprint: false 34 | } 35 | } 36 | steps { 37 | sh 'cd /truenas && make release PROFILE=freenas PRODUCT=TrueNAS TRAIN=TrueNAS-11-Nightlies' 38 | } 39 | } 40 | stage('Publish') { 41 | steps { 42 | sshagent (credentials: ['db98c9b2-efa2-406b-828a-f338d31ac0d5','75bd2da4-66b6-4144-ac29-62ff49771e53']) { 43 | sh 'cd /truenas && make release-push PROFILE=freenas PRODUCT=TrueNAS TRAIN=TrueNAS-11-Nightlies' 44 | } 45 | } 46 | } 47 | } 48 | post { 49 | success { 50 | script { 51 | cleanWs notFailBuild: true 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tests/trueos/t05_kqueue_tests.py: -------------------------------------------------------------------------------- 1 | #+ 2 | # Copyright 2015 iXsystems, Inc. 3 | # All rights reserved 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted providing that the following conditions 7 | # are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 18 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 23 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | # 26 | 27 | import json 28 | from tests import success, failure 29 | 30 | 31 | def run(ssh): 32 | ret, out, err = ssh('kqueue-tests') 33 | 34 | if ret != 0: 35 | return failure('kqueue-tests failed') 36 | 37 | return success() 38 | -------------------------------------------------------------------------------- /tests/trueos/t00_running.py: -------------------------------------------------------------------------------- 1 | #+ 2 | # Copyright 2015 iXsystems, Inc. 3 | # All rights reserved 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted providing that the following conditions 7 | # are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 18 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 23 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | # 26 | 27 | import time 28 | from tests import success, fatal 29 | 30 | 31 | def run(ssh): 32 | for i in range(0, 30): 33 | ret, out, err = ssh('uname -a') 34 | if ret == 0: 35 | return success() 36 | 37 | time.sleep(1) 38 | 39 | return fatal('Cannot reach VM via ssh') 40 | -------------------------------------------------------------------------------- /tests/trueos/overlay/root/.ssh/id_rsa: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEA2ZCPrpVLDnYzp2LgeSDF4Ugby59DVzry/iBX8yzVXdbaNE1e 3 | vxzvd7nKFiC+H+Io010yTnjquWtUrwFt1pKwTWkteeZuG0qDAXhoHqGvhsvRhy/U 4 | hE5R5cWE2HbhpJHczs7bgfrVosWJxx3k9YoY3TSwQHLiFxz1gwDIq0xPeFfRKml+ 5 | j6fqg4/V9gmDpJJx2CSwM+1M5OArEt4EmSOt6OqYto5ZyWkoKoyQckt3Hyo0qHPo 6 | YuVX+XuFyBwuvir7d9/lpgGCRgPS6ZeK8mTezY4WEkGyuGCOFeobTVTYVuk3F760 7 | ljwZaVqsmXkv3EUFv1RUgqlLsT8vG5xnxm4D2QIDAQABAoIBAA45mntivYaTiesO 8 | 1vh0gRuquE6G+kMw0oR1HusCamz5SEkVKfW68ZlVZ3Ys6+FvyxWOyWRCGa7H6sCK 9 | imD2NFrLXrLSsy5Ln+cvtTcTgUOB/hAlu3JvIIGyeW4hz70P4G0RL17/RIqg+dIw 10 | DTFUty13bXK5UDkMpqzLF1PD6IpIrL8WAGFjc/wpWAJtSARGrHlbkp48FnAl/ixg 11 | fFwMCkom4cTqwA+4jc3A4xdgNoZdIJfVAW+827WzZINZ7lKSnSU3K/BED1V5ZtJV 12 | 9xSQFUGc6dlWUAHxdkzHlXwtg+Q6OR+dN8J7NVK09XsQxlIF6EvzLWWL4ozxY9A6 13 | bgDzumUCgYEA83CXdpR6pib0UXsYHrdTSzX4ofCH5ExAiL+C8YFbTpTuea7OD0ca 14 | iCxdvBVA3k8J284MKna+90HxCRkXaYJ/tWOApS7Gs0zN3wUVHCGCXnB5ewtazFub 15 | 4eSNPaVol+VdcMIrbp0cHcQLILmZDAKwQYZvHUvTMDQKJN9tv0/oi08CgYEA5Mo0 16 | hR676WVPdD5n1rRUbzg+k9xbRZKQUhF6scyKwcYGSEPhsFfaRgBK28GC7QQ+R/K+ 17 | pv8SKGfHDdC/P60+rWLLy9IZb5dd9ol5NSHTwXE0LqM9kRfqecFKkY6mxCIUoCsE 18 | hjcUpLltaCWFXe63dU9UncAMxEYv6qdY4fkTlFcCgYEAhpmeZYY7OlsXg2XYNEOQ 19 | 3mj9DCz+NhCjLfkV4YpwfcaDBOzOKkxaMyi0uyXVNBXnkY0f1OrLM9NV/n3NIB1z 20 | l0to+ewfGUxCGCmrPl6YwrbVtF7W2V9dlUzVe1xVtIaxX4M8mHBt91dJ/9Ie+TET 21 | W2eFUGF4Z5KeeTzAZaM9JKkCgYBY58aO8El/QdIlTtbVFRA2g/m1RYzmNTUF3yr5 22 | io1lDUmFrXM3LnxwdU6hpMn2xo5ZMRgrFrV8pA8y7CpVWUIg6GJfWs5tkbl+wx8p 23 | qXJ7Gj133hFfn5aLJ7SNaYyebMvtDapdaWwJMtE0BliUDt6VpHUyM94CK3AVVGBy 24 | t3KHUwKBgBmPoZOhwTs1rM9athYSuxRqiFKEazZHIrKKEcwV+G4v0QsSo5MubWRS 25 | FRCDD1CKaTWLRuLoGc5viCShXKIiabkrZeABHeCwLco8qTT41lL4Z7+fZt+vE22a 26 | Zp5KRElkO/1WTr0N7LDH0Aw1+Ng+QOsnSaa86Al+S2ZmYEJ7rPgS 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /tests/trueos/t01_launchctl.py: -------------------------------------------------------------------------------- 1 | #+ 2 | # Copyright 2015 iXsystems, Inc. 3 | # All rights reserved 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted providing that the following conditions 7 | # are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 18 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 23 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | # 26 | 27 | from tests import success, failure 28 | 29 | 30 | def run(ssh): 31 | ret, out, err = ssh('launchctl list') 32 | 33 | if ret != 0: 34 | return failure('launchctl returned non-zero exit code') 35 | 36 | if 'com.apple.launchctl.System' not in out: 37 | return failure('com.apple.launchctl.System not found in "launchctl list" output') 38 | 39 | return success() 40 | -------------------------------------------------------------------------------- /tests/trueos/t04_notifyutil.py: -------------------------------------------------------------------------------- 1 | #+ 2 | # Copyright 2015 iXsystems, Inc. 3 | # All rights reserved 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted providing that the following conditions 7 | # are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 18 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 23 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | # 26 | 27 | import time 28 | import threading 29 | from tests import success, failure 30 | 31 | 32 | def run(ssh): 33 | p_ret = None 34 | 35 | def waiter(): 36 | ret, out, err = ssh('notifyutil -1 foo') 37 | p_ret = ret 38 | 39 | t = threading.Thread(target=waiter) 40 | t.start() 41 | 42 | time.sleep(3) 43 | ret, out, err = ssh('notifyutil -p foo') 44 | if ret != 0: 45 | return failure('notifyutil -p returned non-zero exit code') 46 | 47 | t.join() 48 | if p_ret != 0: 49 | return failure('notifyutil -1 returned non-zero exit code') 50 | 51 | return success() 52 | -------------------------------------------------------------------------------- /tests/trueos/t02_getty.py: -------------------------------------------------------------------------------- 1 | #+ 2 | # Copyright 2015 iXsystems, Inc. 3 | # All rights reserved 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted providing that the following conditions 7 | # are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 18 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 23 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | # 26 | 27 | import json 28 | from tests import success, failure 29 | 30 | 31 | def run(ssh): 32 | ret, out, err = ssh('launchctl dump org.freebsd.getty.ttyu0') 33 | 34 | if ret != 0: 35 | return failure('getty job isn\t even loaded') 36 | 37 | # Filter our 'launch_msg() debug lines' 38 | lines = out.split('\n') 39 | lines = filter(lambda l: 'launchd_msg_recv' not in l, lines) 40 | data = '\n'.join(lines) 41 | 42 | try: 43 | job = json.loads(data) 44 | except ValueError, e: 45 | return failure('"launchctl dump" returned unreadable json: {0}'.format(data)) 46 | 47 | if job["Label"] != "org.freebsd.getty.ttyu0": 48 | return failure('getty job has wrong label') 49 | 50 | if "PID" not in job: 51 | return failure('launchd reported that getty job is not running') 52 | 53 | return success() 54 | -------------------------------------------------------------------------------- /tests/trueos/t03_notifyd_loaded.py: -------------------------------------------------------------------------------- 1 | #+ 2 | # Copyright 2015 iXsystems, Inc. 3 | # All rights reserved 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted providing that the following conditions 7 | # are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 18 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 23 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | # 26 | 27 | import time 28 | import json 29 | from tests import success, failure 30 | 31 | 32 | def run(ssh): 33 | time.sleep(10) 34 | ret, out, err = ssh('launchctl dump com.apple.notifyd') 35 | 36 | if ret != 0: 37 | return failure('notifyd job isn\t even loaded') 38 | 39 | # Filter our 'launch_msg() debug lines' 40 | lines = out.split('\n') 41 | lines = filter(lambda l: 'launchd_msg_recv' not in l, lines) 42 | data = '\n'.join(lines) 43 | 44 | try: 45 | job = json.loads(data) 46 | except ValueError, e: 47 | return failure('"launchctl dump" returned unreadable json: {0}'.format(data)) 48 | 49 | if job["Label"] != "com.apple.notifyd": 50 | return failure('notifyd job has wrong label') 51 | 52 | if "PID" not in job: 53 | return failure('notifyd is not running') 54 | 55 | return success() 56 | -------------------------------------------------------------------------------- /tests/freenas/run.py: -------------------------------------------------------------------------------- 1 | #+ 2 | # Copyright 2016 iXsystems, Inc. 3 | # All rights reserved 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted providing that the following conditions 7 | # are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 18 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 23 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | # 26 | 27 | import os 28 | from dsl import load_file, load_profile_config 29 | from utils import sh, sh_str, sh_spawn, info, objdir, e 30 | 31 | 32 | load_profile_config() 33 | load_file(e('${BUILD_ROOT}/tests/freenas/config.pyd'), os.environ) 34 | testdir = objdir('tests') 35 | venvdir = objdir('tests/venv') 36 | 37 | 38 | def cleanup(): 39 | sh('bhyvectl --destroy --vm=${VM_NAME}', nofail=True) 40 | 41 | 42 | def setup_venv(): 43 | sh('virtualenv ${venvdir}') 44 | sh('${venvdir}/bin/pip install -U cython six paramiko nose2') 45 | sh('${venvdir}/bin/pip install -U ${BE_ROOT}/py-bsd') 46 | sh('${venvdir}/bin/pip install -U ${BE_ROOT}/py-netif') 47 | sh('${venvdir}/bin/pip install -U ${BE_ROOT}/py-dhcp') 48 | sh('${venvdir}/bin/pip install -U ${BE_ROOT}/py-freenas.utils') 49 | sh('${venvdir}/bin/pip install -U ${BE_ROOT}/dispatcher-client/python') 50 | sh('${venvdir}/bin/python ${BUILD_ROOT}/tests/freenas/vm.py') 51 | 52 | 53 | if __name__ == '__main__': 54 | info('Setting up test environment') 55 | setup_venv() 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | Join Discord 3 | Join Forums 4 | File Issue 5 |

6 | 7 | # Building TrueNAS 13 CORE/Enterprise from Scratch 8 | 9 | Note: All these commands must be run as `root`. 10 | 11 | 12 | ## Requirements: 13 | 14 | * Hardware 15 | 16 | * CPU: amd64-compatible 64-bit Intel or AMD CPU. 17 | * 16GB memory, or the equivalent in memory plus swap space 18 | * at least 80GB of free disk space 19 | 20 | * Operating System 21 | 22 | * The build environment must be FreeBSD 13.x (or 13-STABLE) 23 | 24 | 25 | ## Make Targets 26 | 27 | * ```checkout``` creates a local working copy of the git repositories with 28 | ```git clone``` 29 | 30 | * ```update``` does a ```git pull``` to update the local working copy with 31 | any changes made to the git repositories since the last update 32 | 33 | * ```release``` actually builds the FreeNAS release 34 | 35 | * ```clean``` removes previously built files 36 | 37 | 38 | ## Procedure 39 | 40 | * Install git 41 | ``` 42 | pkg install -y git 43 | rehash 44 | ``` 45 | 46 | * Clone the build repository (```/usr/build``` is used for this example): 47 | 48 | ``` 49 | git clone https://github.com/truenas/build /usr/build 50 | ``` 51 | 52 | * Install Dependencies 53 | 54 | ``` 55 | cd /usr/build 56 | make bootstrap-pkgs 57 | python3 -m ensurepip 58 | pip3 install six 59 | ``` 60 | 61 | 62 | * First-time checkout of source: 63 | 64 | ``` 65 | make checkout 66 | ``` 67 | 68 | 69 | A FreeNAS release is built by first updating the source, then building: 70 | 71 | ``` 72 | make update 73 | make release 74 | ``` 75 | 76 | To build the SDK version: 77 | 78 | ``` 79 | make update 80 | make release BUILD_SDK=yes 81 | ``` 82 | 83 | 84 | Clean builds take a while, not just due to operating system builds, but 85 | because poudriere has to build all of the ports. Later builds are faster, 86 | only rebuilding files that need it. 87 | 88 | Use ```make clean``` to remove all built files. 89 | 90 | 91 | ## Results 92 | 93 | Built files are in the ```freenas/_BE``` subdirectory, 94 | ```/usr/build/freenas/_BE``` in this example. 95 | 96 | ISO files: ```freenas/_BE/release/TrueNAS-13-MASTER-{date}/x64/```. 97 | 98 | Update files: ```freenas/_BE/release/```. 99 | 100 | Log files: ```freenas/_BE/objs/logs/```. 101 | -------------------------------------------------------------------------------- /tests/trueos/overlay/etc/ssh/sshd_config: -------------------------------------------------------------------------------- 1 | # $OpenBSD: sshd_config,v 1.93 2014/01/10 05:59:19 djm Exp $ 2 | # $FreeBSD$ 3 | 4 | # This is the sshd server system-wide configuration file. See 5 | # sshd_config(5) for more information. 6 | 7 | # This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin 8 | 9 | # The strategy used for options in the default sshd_config shipped with 10 | # OpenSSH is to specify options with their default value where 11 | # possible, but leave them commented. Uncommented options override the 12 | # default value. 13 | 14 | # Note that some of FreeBSD's defaults differ from OpenBSD's, and 15 | # FreeBSD has a few additional options. 16 | 17 | #Port 22 18 | #AddressFamily any 19 | #ListenAddress 0.0.0.0 20 | #ListenAddress :: 21 | 22 | # The default requires explicit activation of protocol 1 23 | #Protocol 2 24 | 25 | # HostKey for protocol version 1 26 | #HostKey /etc/ssh/ssh_host_key 27 | # HostKeys for protocol version 2 28 | #HostKey /etc/ssh/ssh_host_rsa_key 29 | #HostKey /etc/ssh/ssh_host_dsa_key 30 | #HostKey /etc/ssh/ssh_host_ecdsa_key 31 | #HostKey /etc/ssh/ssh_host_ed25519_key 32 | 33 | # Lifetime and size of ephemeral version 1 server key 34 | #KeyRegenerationInterval 1h 35 | #ServerKeyBits 1024 36 | 37 | # Ciphers and keying 38 | #RekeyLimit default none 39 | 40 | # Logging 41 | # obsoletes QuietMode and FascistLogging 42 | #SyslogFacility AUTH 43 | #LogLevel INFO 44 | 45 | # Authentication: 46 | 47 | #LoginGraceTime 2m 48 | PermitRootLogin yes 49 | StrictModes no 50 | #MaxAuthTries 6 51 | #MaxSessions 10 52 | 53 | #RSAAuthentication yes 54 | #PubkeyAuthentication yes 55 | 56 | # The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 57 | #AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2 58 | 59 | #AuthorizedPrincipalsFile none 60 | 61 | #AuthorizedKeysCommand none 62 | #AuthorizedKeysCommandUser nobody 63 | 64 | # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts 65 | #RhostsRSAAuthentication no 66 | # similar for protocol version 2 67 | #HostbasedAuthentication no 68 | # Change to yes if you don't trust ~/.ssh/known_hosts for 69 | # RhostsRSAAuthentication and HostbasedAuthentication 70 | #IgnoreUserKnownHosts no 71 | # Don't read the user's ~/.rhosts and ~/.shosts files 72 | #IgnoreRhosts yes 73 | 74 | # Change to yes to enable built-in password authentication. 75 | PasswordAuthentication yes 76 | PermitEmptyPasswords yes 77 | 78 | # Change to no to disable PAM authentication 79 | #ChallengeResponseAuthentication yes 80 | 81 | # Kerberos options 82 | #KerberosAuthentication no 83 | #KerberosOrLocalPasswd yes 84 | #KerberosTicketCleanup yes 85 | #KerberosGetAFSToken no 86 | 87 | # GSSAPI options 88 | #GSSAPIAuthentication no 89 | #GSSAPICleanupCredentials yes 90 | 91 | # Set this to 'no' to disable PAM authentication, account processing, 92 | # and session processing. If this is enabled, PAM authentication will 93 | # be allowed through the ChallengeResponseAuthentication and 94 | # PasswordAuthentication. Depending on your PAM configuration, 95 | # PAM authentication via ChallengeResponseAuthentication may bypass 96 | # the setting of "PermitRootLogin without-password". 97 | # If you just want the PAM account and session checks to run without 98 | # PAM authentication, then enable this but set PasswordAuthentication 99 | # and ChallengeResponseAuthentication to 'no'. 100 | UsePAM yes 101 | 102 | #AllowAgentForwarding yes 103 | #AllowTcpForwarding yes 104 | #GatewayPorts no 105 | #X11Forwarding yes 106 | #X11DisplayOffset 10 107 | #X11UseLocalhost yes 108 | #PermitTTY yes 109 | #PrintMotd yes 110 | #PrintLastLog yes 111 | #TCPKeepAlive yes 112 | #UseLogin no 113 | #UsePrivilegeSeparation sandbox 114 | #PermitUserEnvironment no 115 | #Compression delayed 116 | #ClientAliveInterval 0 117 | #ClientAliveCountMax 3 118 | #UseDNS yes 119 | #PidFile /var/run/sshd.pid 120 | #MaxStartups 10:30:100 121 | #PermitTunnel no 122 | #ChrootDirectory none 123 | #VersionAddendum FreeBSD-20140420 124 | 125 | # no default banner path 126 | #Banner none 127 | 128 | # override default of no subsystems 129 | Subsystem sftp /usr/libexec/sftp-server 130 | 131 | # Disable HPN tuning improvements. 132 | #HPNDisabled no 133 | 134 | # Buffer size for HPN to non-HPN connections. 135 | #HPNBufferSize 2048 136 | 137 | # TCP receive socket buffer polling for HPN. Disable on non autotuning kernels. 138 | #TcpRcvBufPoll yes 139 | 140 | # Allow the use of the NONE cipher. 141 | #NoneEnabled no 142 | 143 | # Example of overriding settings on a per-user basis 144 | #Match User anoncvs 145 | # X11Forwarding no 146 | # AllowTcpForwarding no 147 | # PermitTTY no 148 | # ForceCommand cvs server 149 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2010-2016 The FreeNAS Project 3 | # All rights reserved 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted providing that the following conditions 7 | # are met: 8 | # 9 | # 1. Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # 2. Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # This Software is Provided by the Author ''As Is'' and Any Express or 18 | # Implied Warranties, Including, But Not Limited To, the Implied 19 | # Warranties of Merchantability and Fitness For a Particular Purpose 20 | # Are Disclaimed. In No Event Shall the Author be Liable For Any 21 | # Direct, Indirect, Incidental, Special, Exemplary, or Consequential 22 | # Damages (Including, But Not Limited To, Procurement of Substitute 23 | # Goods or Services; Loss of Use, Data, or Profits; or Business 24 | # Interruption) However Caused And on Any Theory of Liability, Whether 25 | # in Contract, Strict Liability, or Tort (Including Negligence or 26 | # Otherwise) Arising in Any Way Out of the Use of This Software, Even 27 | # if Advised of the Possibility of Such Damage. 28 | # 29 | ###################################################################### 30 | 31 | .ifndef BUILD_TIMESTAMP 32 | BUILD_TIMESTAMP != date -u '+%Y%m%d%H%M' 33 | .endif 34 | BUILD_STARTED != date '+%s' 35 | 36 | BUILD_ROOT ?= ${.CURDIR} 37 | BUILD_CONFIG := ${BUILD_ROOT}/build/config 38 | BUILD_TOOLS := ${BUILD_ROOT}/build/tools 39 | PYTHONPATH := ${BUILD_ROOT}/build/lib 40 | MK := ${MAKE} -f ${BUILD_ROOT}/Makefile.inc1 41 | 42 | PROFILE_SETTING = ${BUILD_ROOT}/build/profiles/profile-setting 43 | .ifndef PROFILE 44 | . if exists(${PROFILE_SETTING}) 45 | PROFILE != cat ${PROFILE_SETTING} 46 | . else 47 | PROFILE := freenas 48 | . endif 49 | .endif 50 | 51 | GIT_REPO_SETTING = ${BUILD_ROOT}/.git-repo-setting 52 | .if exists(${GIT_REPO_SETTING}) 53 | GIT_LOCATION != cat ${GIT_REPO_SETTING} 54 | .endif 55 | 56 | BE_ROOT := ${BUILD_ROOT}/${PROFILE}/_BE 57 | 58 | OBJDIR := ${BE_ROOT}/objs 59 | API_PATH := ${BE_ROOT}/freenas/docs 60 | 61 | .if exists(${BUILD_ROOT}/.git-ref-path) 62 | GIT_REF_PATH != cat ${BUILD_ROOT}/.git-ref-path 63 | .elif exists(/build/gitrefs) 64 | GIT_REF_PATH ?= /build/gitrefs 65 | .endif 66 | 67 | .export BUILD_TIMESTAMP 68 | .export BUILD_STARTED 69 | 70 | .export BUILD_ROOT 71 | .export BUILD_CONFIG 72 | .export BUILD_TOOLS 73 | .export PYTHONPATH 74 | .export MK 75 | 76 | .export PROFILE 77 | .export SDK 78 | .export BUILD_SDK 79 | 80 | .export GIT_REPO_SETTING 81 | .export GIT_LOCATION 82 | 83 | .export BE_ROOT 84 | .export OBJDIR 85 | .export API_PATH 86 | 87 | .export GIT_REF_PATH 88 | 89 | .export BUILD_LOGLEVEL 90 | 91 | .BEGIN: 92 | # make(.Target) is a conditional that evalutes to true if the .TARGET 93 | # was specified on the command line or has been declared the default 94 | # .Target (either explicitly or implicity) somewhere before this line 95 | .if !make(remote) && !make(sync) && !make(bootstrap-pkgs) 96 | @echo "[0:00:00] ==> NOTICE: Selected profile: ${PROFILE}" 97 | @echo "[0:00:00] ==> NOTICE: Build timestamp: ${BUILD_TIMESTAMP}" 98 | 99 | @${BUILD_TOOLS}/buildenv.py ${BUILD_TOOLS}/check-host.py 100 | .if !make(checkout) && !make(update) && !make(clean) && !make(cleandist) && !make(profiles) && !make(select-profile) && !make(docs) && !make(api-docs) 101 | @${BUILD_TOOLS}/buildenv.py ${BUILD_TOOLS}/check-sandbox.py 102 | .endif 103 | .endif 104 | 105 | # The following section is where the Recipes and other items that are 106 | # to be built are denoted regardless of dependency states. This is to 107 | # say that if the .Target is "release" the release files will be built 108 | # (re-built) regardless of whether they have have been changed or not. 109 | .PHONY: release ports tests 110 | 111 | buildenv: 112 | @${BUILD_TOOLS}/buildenv.py sh 113 | 114 | bootstrap-pkgs: 115 | pkg install -y archivers/pxz 116 | pkg install -y lang/python3 117 | pkg install -y lang/python 118 | pkg install -y ports-mgmt/poudriere-devel 119 | pkg install -y devel/git 120 | pkg install -y devel/gmake 121 | pkg install -y archivers/pigz 122 | python -m ensurepip 123 | python -m pip install six 124 | 125 | changelog-nightly: 126 | @${BUILD_TOOLS}/changelog-nightly.sh 127 | 128 | 129 | # The .DEFAULT gets run if there is no Recipe denoted above for the 130 | # .Target (this includes release, ports, and tests) the only 131 | # difference between these and others is that the others are only 132 | # built if they or one of their dependencies has been changed 133 | .DEFAULT: 134 | @mkdir -p ${OBJDIR} 135 | @${BUILD_TOOLS}/buildenv.py ${MK} ${.TARGET} 136 | -------------------------------------------------------------------------------- /tests/freenas/vm.py: -------------------------------------------------------------------------------- 1 | #+ 2 | # Copyright 2016 iXsystems, Inc. 3 | # All rights reserved 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted providing that the following conditions 7 | # are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 18 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 23 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | # 26 | 27 | import os 28 | import ipaddress 29 | import subprocess 30 | import threading 31 | import time 32 | from dhcp.server import Server 33 | from dhcp.lease import Lease 34 | from dsl import load_file, load_profile_config 35 | from utils import sh, sh_str, sh_spawn, info, objdir, e 36 | 37 | 38 | load_profile_config() 39 | load_file(e('${BUILD_ROOT}/tests/freenas/config.pyd'), os.environ) 40 | destdir = objdir('tests') 41 | venvdir = objdir('tests/venv') 42 | isopath = objdir('${NAME}.iso') 43 | tapdev = None 44 | dhcp_server = None 45 | ready = threading.Event() 46 | 47 | 48 | def cleanup(): 49 | sh('bhyvectl --destroy --vm=${VM_NAME}', nofail=True) 50 | 51 | 52 | def setup_files(): 53 | sh('mkdir -p ${destdir}') 54 | sh('truncate -s 8G ${destdir}/boot.img') 55 | sh('truncate -s 20G ${destdir}/hd1.img') 56 | sh('truncate -s 20G ${destdir}/hd2.img') 57 | 58 | 59 | def alloc_network(): 60 | global tapdev 61 | 62 | tapdev = sh_str('ifconfig tap create') 63 | info('Using tap device {0}', tapdev) 64 | 65 | 66 | def setup_network(): 67 | info('Configuring VM networking') 68 | sh('ifconfig ${tapdev} inet ${HOST_IP} ${NETMASK} up') 69 | 70 | 71 | def cleanup_network(): 72 | sh('ifconfig ${tapdev} destroy') 73 | 74 | 75 | def setup_dhcp_server(): 76 | global dhcp_server 77 | 78 | def dhcp_request(mac, hostname): 79 | info('DHCP request from {0} ({1})'.format(hostname, mac)) 80 | lease = Lease() 81 | lease.client_mac = mac 82 | lease.client_ip = ipaddress.ip_address(e('${FREENAS_IP}')) 83 | lease.client_mask = ipaddress.ip_address(e('${NETMASK}')) 84 | ready.set() 85 | return lease 86 | 87 | dhcp_server = Server() 88 | dhcp_server.server_name = 'FreeNAS_test_env' 89 | dhcp_server.on_request = dhcp_request 90 | dhcp_server.start(tapdev, ipaddress.ip_address(e('${HOST_IP}'))) 91 | threading.Thread(target=dhcp_server.serve, daemon=True).start() 92 | info('Started DHCP server on {0}', tapdev) 93 | 94 | def do_install(): 95 | info('Starting up VM for unattended install') 96 | vm_proc = sh_spawn( 97 | 'bhyve -m ${MEMSIZE} -c ${CORES} -A -H -P', 98 | '-s 3:0,ahci-hd,${destdir}/boot.img', 99 | '-s 4:0,ahci-hd,${destdir}/hd1.img', 100 | '-s 5:0,ahci-hd,${destdir}/hd2.img', 101 | '-s 6:0,ahci-cd,${isopath}', 102 | '-s 7:0,virtio-net,${tapdev}', 103 | '-s 8:0,fbuf,tcp=5900,w=1024,h=768', 104 | '-s 31,lpc', 105 | '-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd', 106 | '${VM_NAME}' 107 | ) 108 | 109 | try: 110 | vm_proc.wait(timeout=3600) 111 | except subprocess.TimeoutExpired: 112 | fail('Install timed out after 1 hour') 113 | 114 | 115 | def do_run(): 116 | info('Starting up VM for testing') 117 | vm_proc = sh_spawn( 118 | 'bhyve -m ${MEMSIZE} -c ${CORES} -A -H -P', 119 | '-s 3:0,ahci-hd,${destdir}/boot.img', 120 | '-s 4:0,ahci-hd,${destdir}/hd1.img', 121 | '-s 5:0,ahci-hd,${destdir}/hd2.img', 122 | '-s 6:0,virtio-net,${tapdev}', 123 | '-s 7:0,fbuf,tcp=5900,w=1024,h=768', 124 | '-s 31,lpc', 125 | '-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd', 126 | '${VM_NAME}' 127 | ) 128 | 129 | ready.wait() 130 | time.sleep(60) 131 | info('VM middleware is ready') 132 | 133 | proc = subprocess.Popen( 134 | [ 135 | e('${venvdir}/bin/python'), 136 | e('${BUILD_ROOT}/tests/freenas/main.py'), 137 | '-a', e('${FREENAS_IP}'), 138 | '-u', 'root', 139 | '-p', 'abcd1234' 140 | ] 141 | ) 142 | 143 | proc.wait() 144 | 145 | vm_proc.terminate() 146 | vm_proc.wait() 147 | 148 | 149 | if __name__ == '__main__': 150 | info('Starting up test schedule') 151 | cleanup() 152 | alloc_network() 153 | setup_files() 154 | setup_network() 155 | setup_dhcp_server() 156 | do_install() 157 | setup_network() 158 | do_run() 159 | cleanup_network() 160 | -------------------------------------------------------------------------------- /tests/freenas/main.py: -------------------------------------------------------------------------------- 1 | #+ 2 | # Copyright 2016 iXsystems, Inc. 3 | # All rights reserved 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted providing that the following conditions 7 | # are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 18 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 23 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | # 26 | 27 | import os 28 | import json 29 | import time 30 | import argparse 31 | import shutil 32 | import subprocess 33 | from utils import e, sh, objdir, info 34 | from xml.etree.ElementTree import Element, SubElement, tostring, parse 35 | from distutils.core import run_setup 36 | from xml.dom import minidom 37 | 38 | 39 | EXCLUDES = ['os', 'objs', 'ports', 'release', 'release.build.log', 'repo-manifest'] 40 | 41 | 42 | venvdir = objdir('tests/venv') 43 | output_root = objdir('test-output') 44 | 45 | 46 | class Main(object): 47 | def __init__(self): 48 | self.test_suites = [] 49 | self.output_path = None 50 | self.excluded = ['os', 'objs', 'ports', 'release'] 51 | 52 | def find_tests(self): 53 | info('Looking for test manifests in ${{BE_ROOT}}') 54 | for dir in os.listdir(e('${BE_ROOT}')): 55 | if dir not in self.excluded: 56 | for root, _, files in os.walk(os.path.join(e('${BE_ROOT}'), dir)): 57 | if os.path.split(root)[1] == 'tests' and 'MANIFEST.json' in files: 58 | info('Found test manifest at {0}', root) 59 | self.test_suites.append(root) 60 | 61 | def load_manifest(self, path): 62 | with open(os.path.join(path, 'MANIFEST.json'), 'r') as manifest_file: 63 | return json.load(manifest_file) 64 | 65 | def run(self): 66 | for s in self.test_suites: 67 | script = os.path.join(s, 'run.py') 68 | start_time = time.time() 69 | manifest = self.load_manifest(s) 70 | os.chdir(s) 71 | 72 | info("Running tests from {0}".format(s)) 73 | 74 | args = [e('${venvdir}/bin/python'), script] 75 | test = None 76 | try: 77 | test = subprocess.Popen( 78 | args, 79 | stdout=subprocess.PIPE, 80 | stderr=subprocess.STDOUT, 81 | close_fds=True 82 | ) 83 | test.wait(timeout=manifest['timeout']) 84 | except subprocess.TimeoutExpired as err: 85 | self.generate_suite_error( 86 | os.path.join(s, 'results.xml'), 87 | manifest['name'], 88 | time.time() - start_time, 89 | 'Test timeout reached', 90 | err 91 | ) 92 | except subprocess.SubprocessError as err: 93 | self.generate_suite_error( 94 | os.path.join(s, 'results.xml'), 95 | manifest['name'], 96 | time.time() - start_time, 97 | 'Test could not be started', 98 | err 99 | ) 100 | 101 | out, err = test.communicate() 102 | 103 | if test and test.returncode: 104 | self.generate_suite_error( 105 | os.path.join(s, 'results.xml'), 106 | manifest['name'], 107 | time.time() - start_time, 108 | 'Test process has returned an error', 109 | out 110 | ) 111 | 112 | info("{0} error:".format(script)) 113 | print(out.decode('utf-8')) 114 | 115 | def aggregate_results(self): 116 | sh('mkdir -p ${output_root}') 117 | for s in self.test_suites: 118 | manifest = self.load_manifest(s) 119 | try: 120 | shutil.move( 121 | os.path.join(s, 'results.xml'), 122 | os.path.join(output_root, '{}-results.xml'.format(manifest['name'])) 123 | ) 124 | except FileNotFoundError as e: 125 | self.generate_suite_error( 126 | os.path.join(output_root, '{}-results.xml'.format(manifest['name'])), 127 | manifest['name'], 128 | 0, 129 | 'Results file not found', 130 | e 131 | ) 132 | 133 | results = Element('testsuites') 134 | for r in os.listdir(output_root): 135 | if r.endswith('results.xml'): 136 | single_result = parse(os.path.join(output_root, r)) 137 | results.append(single_result.getroot()) 138 | 139 | with open(os.path.join(output_root, 'aggregated_results.xml'), 'w') as output_file: 140 | output_file.write(self.print_xml(results)) 141 | 142 | def generate_suite_error(self, out_path, name, test_time, text, err): 143 | top = Element('testsuite', errors="1", failures="0", name=name, skipped="0", tests='0', time=str(test_time)) 144 | case = SubElement(top, 'testcase', classname="UNDEFINED", name="UNDEFINED", time=str(test_time)) 145 | error = SubElement(case, 'error', message=text) 146 | error.text = str(err) 147 | SubElement(case, 'system-err') 148 | with open(out_path, 'w') as output_file: 149 | output_file.write(self.print_xml(top)) 150 | 151 | def print_xml(self, elem): 152 | rough_string = tostring(elem, 'utf-8') 153 | reparsed = minidom.parseString(rough_string) 154 | return reparsed.toprettyxml(indent=" ") 155 | 156 | def main(self): 157 | parser = argparse.ArgumentParser() 158 | parser.add_argument('-a', metavar='ADDRESS', required=True, help='FreeNAS box address') 159 | parser.add_argument('-u', metavar='USERNAME', required=True, help='Username') 160 | parser.add_argument('-p', metavar='PASSWORD', required=True, help='Password') 161 | args = parser.parse_args() 162 | 163 | os.environ['TEST_HOST'] = args.a 164 | os.environ['TEST_USERNAME'] = args.u 165 | os.environ['TEST_PASSWORD'] = args.p 166 | os.environ['TEST_XML'] = 'yes' 167 | 168 | print('Test VM address: {0}'.format(args.a)) 169 | print('Test VM username: {0}'.format(args.u)) 170 | print('Test VM password: {0}'.format(args.p)) 171 | 172 | self.find_tests() 173 | self.run() 174 | self.aggregate_results() 175 | 176 | 177 | if __name__ == '__main__': 178 | m = Main() 179 | m.main() 180 | -------------------------------------------------------------------------------- /Makefile.inc1: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2010-2015 iXsystems, Inc. 3 | # All rights reserved 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted providing that the following conditions 7 | # are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 18 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 23 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | # POSSIBILITY OF SUCH DAMAGE. 25 | # 26 | ##################################################################### 27 | 28 | .if exists(build/hooks/Makefile) 29 | .include "build/hooks/Makefile" 30 | .endif 31 | 32 | .ifdef SCRIPT 33 | RELEASE_LOGFILE?=${SCRIPT} 34 | .else 35 | RELEASE_LOGFILE?=${BE_ROOT}/release.build.log 36 | .endif 37 | 38 | .if defined(CHANGELOG) 39 | .export CHANGELOG 40 | .endif 41 | 42 | all: check-root build 43 | 44 | .PHONY: world build packages checkout update dumpenv clean release ports tests 45 | 46 | check-root: 47 | @[ `id -u` -eq 0 ] || ( echo "Sorry, you must be running as root to build this."; exit 1 ) 48 | 49 | build: portsjail ports world debug packages images 50 | 51 | world: 52 | @${BUILD_TOOLS}/install-world.py 53 | @${BUILD_TOOLS}/early-customize.py 54 | @${BUILD_TOOLS}/install-ports.py 55 | @${BUILD_TOOLS}/customize.py 56 | 57 | packages: 58 | @${BUILD_TOOLS}/build-packages.py 59 | 60 | checkout: 61 | @${BUILD_TOOLS}/checkout.py 62 | @${BUILD_TOOLS}/update-release-info.py 63 | 64 | update: 65 | @git pull 66 | @${BUILD_TOOLS}/checkout.py 67 | @${BUILD_TOOLS}/update-release-info.py 68 | 69 | buildenv: 70 | @sh 71 | 72 | dumpenv: 73 | @${BUILD_TOOLS}/dumpenv.py 74 | 75 | clean: 76 | .if defined(ZPOOL) 77 | zfs destroy -r ${ZPOOL}${ZROOTFS}/data || true 78 | zfs destroy -r ${ZPOOL}${ZROOTFS}/jail || true 79 | .endif 80 | chflags -R 0 ${BE_ROOT}/objs 81 | rm -rf ${BE_ROOT}/objs 82 | rm -rf ${BE_ROOT}/release 83 | rm -rf ${BE_ROOT}/release.build.log 84 | 85 | clean-packages: 86 | find ${OBJDIR}/ports -type f -delete 87 | 88 | clean-package: 89 | .if defined(p) 90 | find ${OBJDIR}/ports -name "${p}*" | xargs rm -fr 91 | .else 92 | @echo "Clean a single package from object tree" 93 | @echo "" 94 | @echo "Usage: ${MAKE} ${.TARGET} p=[package name]" 95 | @echo "" 96 | @echo "Examples:" 97 | @echo " ${MAKE} ${.TARGET} p=freenas-ui" 98 | @echo " ${MAKE} ${.TARGET} p=netatalk" 99 | .endif 100 | 101 | clean-ui-package: 102 | ${MK} clean-package p=freenas-10gui 103 | rm -rf objs/os-base/*/gui-dest 104 | 105 | clean-freenas-packages: clean-ui-package 106 | @${MK} clean-package p=freenas 107 | @${MK} clean-package p=py34-freenas 108 | @${MK} clean-package p=py34-fnutils 109 | @${MK} clean-package p=py34-libzfs 110 | @${MK} clean-package p=py34-bsd 111 | @${MK} clean-package p=py34-netif 112 | @${MK} clean-package p=py34-cam 113 | @${MK} clean-package p=py34-ws4py 114 | @${MK} clean-package p=py34-SMART 115 | @${MK} clean-package p=py34-ipfs-api 116 | @${MK} clean-package p=nss-freenas 117 | @${MK} clean-package p=pam-freenas 118 | @${MK} clean-package p=iocage-devel 119 | 120 | cleandist: 121 | chflags -R 0 ${BE_ROOT} 122 | rm -rf ${BE_ROOT} 123 | 124 | save-build-env: 125 | @${BUILD_TOOLS}/save-build-env.py 126 | 127 | sync: 128 | .if defined (dir) 129 | rsync -avl \ 130 | --rsync-path="sudo rsync" \ 131 | --delete \ 132 | --exclude '.git-repo-setting' \ 133 | --include '_BE/freenas' \ 134 | --exclude '_BE/*' \ 135 | --exclude '.git' \ 136 | --exclude '.idea' . ${host}:${dir}/ 137 | .else 138 | @echo "Error: Target directory is not defined!" 139 | .endif 140 | 141 | remote: sync 142 | ssh -o StrictHostKeyChecking=no -t ${host} sudo make -C ${dir} ${target} 143 | 144 | reinstall-latest: 145 | @${BUILD_TOOLS}/reinstall-package.py install_latest ${host} 146 | 147 | reinstall-package: 148 | @${BUILD_TOOLS}/reinstall-package.py ${host} ${p} 149 | 150 | freenas: release 151 | release: 152 | @echo "Doing executing target $@ on host: `hostname`" 153 | @echo "Build directory: `pwd`" 154 | @${MK} build 155 | @if [ "${PRODUCTION}" == "yes" -o "${SAVE_DEBUG}" == "yes" ]; then \ 156 | ${BUILD_TOOLS}/save-build-env.py; \ 157 | fi 158 | @${BUILD_TOOLS}/create-release-distribution.py 159 | @${BUILD_TOOLS}/create-upgrade-distribution.py 160 | 161 | release-push: update-push 162 | @${BUILD_TOOLS}/post-to-storage.py 163 | @if [ "${INTERNAL_UPDATE}" != "YES" -a "${INTERNAL_UPDATE}" != "yes" ]; then \ 164 | ${BUILD_TOOLS}/post-to-download.py; \ 165 | fi 166 | 167 | update-push: 168 | @${BUILD_TOOLS}/post-to-upgrade.py 169 | 170 | update-rollback: 171 | ssh sef@update-master.tn.ixsystems.net freenas-release rollback ${TRAIN} 172 | 173 | changelog: 174 | build/tools/create_redmine_changelog.py -k ~/redmine-key -p "freenas 10" -t RELEASE -s "Build Testing" > ChangeLog 175 | @[ -s ChangeLog ] || rm ChangeLog 176 | 177 | archive: release 178 | .if !defined(ARCHIVE) 179 | @echo "ARCHIVE location must be defined" 1>&2 180 | false 181 | .endif 182 | .if !defined(RELEASEDB) 183 | @echo "RELEASEDB must be defined" 1>&2 184 | false 185 | .endif 186 | /usr/local/bin/freenas-release -P ${PRODUCT} \ 187 | -D ${RELEASEDB} --archive ${ARCHIVE} \ 188 | -K ${FREENAS_KEYFILE} \ 189 | add ${BE_ROOT}/release/LATEST 190 | 191 | rebuild: checkout all 192 | @${BUILD_TOOLS}/create-release-distribution.py 193 | 194 | cdrom: 195 | @${BUILD_TOOLS}/create-iso.py 196 | 197 | images: cdrom 198 | 199 | # intentionally split up to prevent abuse/spam 200 | BUILD_BUG_DOMAIN?=ixsystems.com 201 | BUILD_BUG_USER?=build-bugs 202 | BUILD_BUG_EMAIL?=${BUILD_BUG_USER}@${BUILD_BUG_DOMAIN} 203 | 204 | build-bug-report: 205 | mail -s "build fail for $${SUDO_USER:-$$USER}" ${BUILD_BUG_EMAIL} < \ 206 | ${RELEASE_LOGFILE} 207 | 208 | tag: 209 | @${BUILD_TOOLS}/apply-tag.py ${tag} 210 | 211 | tests: 212 | @${MK} cdrom UNATTENDED_CONFIG=tests/freenas/install.conf 213 | @env PYTHONPATH=${BUILD_ROOT}/build/lib python3.4 ${BUILD_ROOT}/tests/freenas/run.py 214 | 215 | ports: check-root 216 | @${BUILD_TOOLS}/build-ports.py 217 | 218 | os: 219 | @${BUILD_TOOLS}/build-os.py 220 | 221 | os-tests: 222 | @${BUILD_TOOLS}/run-os-tests.py 223 | 224 | os-playground: 225 | @PLAYGROUND=yes ${BUILD_TOOLS}/run-os-tests.py 226 | 227 | os-ssh: 228 | @START_SSH=yes ${BUILD_TOOLS}/run-os-tests.py 229 | 230 | os-telnet: 231 | @START_TELNET=yes ${BUILD_TOOLS}/run-os-tests.py 232 | 233 | portsjail: os 234 | @${BUILD_TOOLS}/install-jail.py 235 | 236 | profiles: 237 | @${BUILD_TOOLS}/profiles.py 238 | 239 | select-profile: 240 | @${BUILD_TOOLS}/select-profile.py ${name} 241 | 242 | debug: 243 | @${BUILD_TOOLS}/build-debug.py 244 | 245 | api-docs: 246 | @env CHECKOUT_ONLY="freenas" ${BUILD_TOOLS}/checkout.py 247 | (make -C ${API_PATH}/api html) 248 | 249 | clean-docs: 250 | make -C ${API_PATH}/api clean 251 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------