├── .dappnode_profile ├── .dockerignore ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── linter.yml │ ├── pre-release.yml │ └── test.yml ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── docker-compose.yml ├── iso ├── boot │ ├── grub.cfg │ ├── isolinux.cfg │ ├── menu.cfg │ ├── splash.pcx │ ├── splash.png │ ├── theme_1 │ └── txt.cfg ├── extra_dpkg │ ├── liblockfile1_1.14-1.1_amd64.deb │ ├── lockfile-progs_0.1.18_amd64.deb │ └── usbmount_0.0.24_all.deb ├── preseeds │ ├── preseed.cfg │ └── preseed_unattended.cfg ├── scripts │ ├── download_core.sh │ ├── generate_ISO.sh │ ├── generate_dappnode_iso_debian.sh │ ├── generate_docker_images.sh │ └── prepare_snapshot.sh └── sgx │ ├── enable_sgx │ └── sgx_linux_x64_driver.bin ├── scripts ├── check-disks.sh ├── dappnode_access_credentials.sh ├── dappnode_install.sh ├── dappnode_install_pre.sh ├── dappnode_test_install.sh ├── dappnode_uninstall.sh ├── rc.local └── static_ip.sh └── test └── environment_setup.sh /.dappnode_profile: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export BIND_VERSION="${BIND_VERSION:-0.2.6}" 4 | export IPFS_VERSION="${IPFS_VERSION:-0.2.14}" 5 | export VPN_VERSION="${VPN_VERSION:-0.2.8}" 6 | export DAPPMANAGER_VERSION="${DAPPMANAGER_VERSION:-0.2.42}" 7 | export WIFI_VERSION="${WIFI_VERSION:-0.2.7}" 8 | export WIREGUARD_VERSION="${WIREGUARD_VERSION:-0.1.0}" 9 | export HTTPS_VERSION="${HTTPS:-0.1.1}" 10 | 11 | export DAPPNODE_DIR="/usr/src/dappnode" 12 | export DAPPNODE_CORE_DIR="${DAPPNODE_DIR}/DNCORE" 13 | 14 | #!ISOBUILD Do not modify, variables above imported for ISO build 15 | DNCORE_YMLS=$(find $DAPPNODE_CORE_DIR -name "docker-compose-*.yml" -printf "-f %p ") 16 | # shellcheck disable=SC2207 17 | # shellcheck disable=SC2034 18 | DNCORE_YMLS_ARRAY=($(find /usr/src/dappnode/DNCORE -name "docker-compose-*.yml" | sort)) 19 | 20 | # Returns docker core containers status 21 | alias dappnode_status='docker-compose $DNCORE_YMLS ps' 22 | # Stop docker core containers 23 | alias dappnode_stop='docker-compose $DNCORE_YMLS stop && docker stop $(docker container ls -a -q -f name=DAppNode*)' 24 | # Start docker core containers 25 | alias dappnode_start='docker-compose $DNCORE_YMLS up -d && docker start $(docker container ls -a -q -f name=DAppNode*)' 26 | # Return open-vpn credentials from a specific user. e.g: dappnode_get dappnode_admin 27 | alias dappnode_get='docker exec -i DAppNodeCore-vpn.dnp.dappnode.eth vpncli get' 28 | # Return open-vpn admin credentials 29 | alias dappnode_connect='docker exec -i DAppNodeCore-vpn.dnp.dappnode.eth getAdminCredentials' 30 | # Return wifi credentials (ssid and password) 31 | alias dappnode_wifi='cat /usr/src/dappnode/DNCORE/docker-compose-wifi.yml | grep "SSID\|WPA_PASSPHRASE"' 32 | # Return remote credentials in plain text. OPTIONS: 33 | # --qr (QR format). --local (local creds for NAT loopback issues) 34 | alias dappnode_wireguard='docker exec -i DAppNodeCore-api.wireguard.dnp.dappnode.eth getWireguardCredentials' 35 | 36 | return 37 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | LICENSE 2 | README.md 3 | .gitignore 4 | images 5 | test -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners will be the default owners for everything in the repo. Unless a later match takes precedence, 2 | # They will be requested for review when someone opens a pull request. 3 | * @dapplion @eduadiez @pablomendezroyo @3alpha @Tropicar 4 | 5 | # Order is important; the last matching pattern takes the most precedence. When someone opens a pull request that only 6 | # modifies md files, only md owners and not the global owner(s) will be requested for a review. 7 | *.md @Pol-Lanski @dapplion @eduadiez @pablomendezroyo @3alpha @Tropicar -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: 5 | labels: 6 | assignees: 7 | --- 8 | 9 | 10 | 11 | 12 | **Describe the bug** 13 | 14 | 15 | 16 | **To Reproduce** 17 | 18 | 23 | 24 | **Expected behavior** 25 | 26 | 27 | 28 | **Screenshots** 29 | 30 | 31 | 32 | **DAppNode version:** 33 | 34 | 35 | 36 | - Package version: 37 | - OS: 38 | - Browser 39 | 40 | **Additional context** 41 | 42 | 43 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "" 5 | labels: "" 6 | assignees: "" 7 | --- 8 | 9 | 10 | 11 | 12 | **Is your feature request related to a problem? Please describe.** 13 | 14 | 15 | 16 | **Describe the solution you'd like** 17 | 18 | 19 | 20 | **Describe alternatives you've considered** 21 | 22 | 23 | 24 | **Additional context** 25 | 26 | 27 | -------------------------------------------------------------------------------- /.github/workflows/linter.yml: -------------------------------------------------------------------------------- 1 | name: Lint Code Base 2 | 3 | # 4 | # Documentation: 5 | # https://help.github.com/en/articles/workflow-syntax-for-github-actions 6 | # 7 | on: 8 | workflow_dispatch: 9 | push: 10 | branches-ignore: 11 | - "master" 12 | pull_request: 13 | branches: 14 | - "master" 15 | 16 | jobs: 17 | build: 18 | name: Lint Code Base 19 | runs-on: ubuntu-latest 20 | continue-on-error: true 21 | 22 | steps: 23 | - name: Checkout Code 24 | uses: actions/checkout@v2 25 | with: 26 | # Full git history is needed to get a proper list of changed files within `super-linter` 27 | fetch-depth: 0 28 | 29 | - name: Lint Code Base 30 | uses: github/super-linter@v3 31 | env: 32 | VALIDATE_ALL_CODEBASE: false 33 | DEFAULT_BRANCH: master 34 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 35 | -------------------------------------------------------------------------------- /.github/workflows/pre-release.yml: -------------------------------------------------------------------------------- 1 | name: Pre-release 2 | on: 3 | workflow_dispatch: 4 | inputs: 5 | core: 6 | description: "Version of the core. Must go with v (e.g v0.2.47)" 7 | required: true 8 | dappmanager: 9 | description: "Version of the dappmanager. Only numbers" 10 | required: true 11 | wifi: 12 | description: "Version of the wifi. Only numbers" 13 | required: true 14 | bind: 15 | description: "Version of the bind. Only numbers" 16 | required: true 17 | ipfs: 18 | description: "Version of the ipfs. Only numbers" 19 | required: true 20 | https: 21 | description: "Version of the https. Only numbers" 22 | required: true 23 | wireguard: 24 | description: "Version of the wireguard. Only numbers" 25 | required: true 26 | vpn: 27 | description: "Version of the vpn. Only numbers" 28 | required: true 29 | 30 | env: 31 | BIND_VERSION: ${{ github.event.inputs.bind }} 32 | IPFS_VERSION: ${{ github.event.inputs.ipfs }} 33 | DAPPMANAGER_VERSION: ${{ github.event.inputs.dappmanager }} 34 | WIFI_VERSION: ${{ github.event.inputs.wifi }} 35 | WIREGUARD_VERSION: ${{ github.event.inputs.wireguard }} 36 | HTTPS_VERSION: ${{ github.event.inputs.https }} 37 | VPN_VERSION: ${{ github.event.inputs.vpn }} 38 | CORE_VERSION: ${{ github.event.inputs.core }} 39 | 40 | jobs: 41 | pre-release: 42 | name: create pre release 43 | runs-on: ubuntu-latest 44 | defaults: 45 | run: 46 | shell: bash 47 | 48 | steps: 49 | # Regex for versions introduced 50 | - name: Check versions regex 51 | run: | 52 | [[ $BIND_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $IPFS_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $DAPPMANAGER_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && \ 53 | [[ $WIFI_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $WIREGUARD_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $HTTPS_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && \ 54 | [[ $VPN_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $CORE_VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "versions introduced in wrong format"; exit 1; } 55 | - name: Check out installer 56 | uses: actions/checkout@v2 57 | 58 | # Edit the profile with the new versions introduced 59 | - name: Set new versions 60 | run: | 61 | sed -i -e "/BIND_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${BIND_VERSION}"/" .dappnode_profile 62 | sed -i -e "/IPFS_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${IPFS_VERSION}"/" .dappnode_profile 63 | sed -i -e "/VPN_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${VPN_VERSION}"/" .dappnode_profile 64 | sed -i -e "/DAPPMANAGER_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${DAPPMANAGER_VERSION}"/" .dappnode_profile 65 | sed -i -e "/WIFI_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${WIFI_VERSION}"/" .dappnode_profile 66 | sed -i -e "/WIREGUARD_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${WIREGUARD_VERSION}"/" .dappnode_profile 67 | sed -i -e "/HTTPS_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${HTTPS_VERSION}"/" .dappnode_profile 68 | cat .dappnode_profile 69 | # ISO ATTENDED 70 | - name: Build attended 71 | run: | 72 | sed -i -e "/UNATTENDED/s/true/false/" docker-compose.yml 73 | docker-compose build 74 | docker-compose up 75 | # Verify ISO attended created 76 | - name: Check iso attended 77 | run: | 78 | ls -lrt images/DAppNode-debian-bullseye-amd64.iso 79 | # Set new name for the release asset 80 | - name: Set DAppNode attended ISO name 81 | run: | 82 | cp ./images/DAppNode-debian-bullseye-amd64.iso DAppNode-${CORE_VERSION}-debian-bullseye-amd64.iso 83 | # ISO UNATTENDED 84 | - name: Build unattended 85 | run: | 86 | sed -i -e "/UNATTENDED/s/false/true/" docker-compose.yml 87 | docker-compose build 88 | docker-compose up 89 | # Verify ISO unattended was created 90 | - name: Check iso unattended 91 | run: | 92 | ls -lrt images/DAppNode-debian-bullseye-amd64.iso 93 | # Set new name for the release asset 94 | - name: Set DAppNode unttended ISO name 95 | run: | 96 | cp ./images/DAppNode-debian-bullseye-amd64.iso DAppNode-${CORE_VERSION}-debian-bullseye-amd64-unattended.iso 97 | # Create profile.sh script (not able to set dot (.) before the name in the gh release asset) 98 | - name: Create dappnode_profile.sh 99 | run: | 100 | cp .dappnode_profile dappnode_profile.sh 101 | # SHASUMs 102 | - name: Get SHA-256 attended 103 | id: shasum-attended 104 | run: | 105 | SHASUM_ATTENDED=$(shasum -a 256 DAppNode-${CORE_VERSION}-debian-bullseye-amd64.iso) 106 | echo "::set-output name=SHASUM_ATTENDED::$SHASUM_ATTENDED" 107 | - name: Get SHA-256 unattended 108 | id: shasum-unattended 109 | run: | 110 | SHASUM_UNATTENDED=$(shasum -a 256 DAppNode-${CORE_VERSION}-debian-bullseye-amd64-unattended.iso) 111 | echo "::set-output name=SHASUM_UNATTENDED::$SHASUM_UNATTENDED" 112 | # Release body 113 | - name: Write release content 114 | run: | 115 | echo -en "This is a release for testing purposes\n# Versions\n| Package | Version |\n|---|---|\nbind.dnp.dappnode.eth|${BIND_VERSION}|\n|ipfs.dnp.dappnode.eth|${IPFS_VERSION}|\n|vpn.dnp.dappnode.eth |${VPN_VERSION}|\n|dappmanager.dnp.dappnode.eth|${DAPPMANAGER_VERSION}|\n|wifi.dnp.dappnode.eth|${WIFI_VERSION}|\n|https.dnp.dappnode.eth|${HTTPS_VERSION}|\n|wireguard.dnp.dappnode.eth|${WIREGUARD_VERSION}|\n# Changes\nChanges implemented in release ${CORE_VERSION}\n# Attended version\nInstall and customize DAppNode using the attended ISO: **DAppNode-${CORE_VERSION}-debian-bullseye-amd64.iso**\n\n## ISO SHA-256 Checksum\n\`\`\`\nshasum -a 256 DAppNode-${CORE_VERSION}-debian-bullseye-amd64.iso\n${SHASUM_ATTENDED}\n\`\`\`\n# Unattended version\nInstall DAppNode easily using the unattended ISO: **DAppNode-${CORE_VERSION}-debian-bullseye-amd64-unattended.iso**\nDo a reboot right after the installation\n:warning: **Warning**: This ISO will install dappnode automatically, deleting all existing partitions in the disk\n\ndefault login data:\n - **__user__**: dappnode\n - **__password__**: dappnode.s0\n## ISO SHA-256 Checksum\n\`\`\`\nshasum -a 256 DAppNode-${CORE_VERSION}-debian-bullseye-amd64-unattended.iso\n${SHASUM_UNATTENDED}\n\`\`\`\n# DAppNode for Raspberry Pi 4 64bit\n[Instructions](https://github.com/dappnode/DAppNode/wiki/DAppNodeARM-Installation-Guide)\n\ndefault login data:\n - **__user__**: dappnode\n - **__password__**: dappnodepi" > CHANGELOG.md 116 | cat CHANGELOG.md 117 | env: 118 | SHASUM_ATTENDED: ${{ steps.shasum-attended.outputs.SHASUM_ATTENDED }} 119 | SHASUM_UNATTENDED: ${{ steps.shasum-unattended.outputs.SHASUM_UNATTENDED }} 120 | 121 | # Delete dev release and update it 122 | - uses: dev-drprasad/delete-tag-and-release@v0.2.0 123 | with: 124 | delete_release: true 125 | tag_name: dev 126 | repo: dappnode/DAppNode_Installer 127 | env: 128 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 129 | 130 | # PRE-RELEASE ASSETS 131 | - name: Pre release 132 | uses: softprops/action-gh-release@v1 133 | with: 134 | tag_name: dev 135 | prerelease: true 136 | files: | 137 | ./DAppNode-*-amd64.iso 138 | ./DAppNode-*-amd64-unattended.iso 139 | ./scripts/dappnode_install.sh 140 | ./scripts/dappnode_install_pre.sh 141 | ./scripts/dappnode_uninstall.sh 142 | ./scripts/dappnode_access_credentials.sh 143 | dappnode_profile.sh 144 | body_path: CHANGELOG.md 145 | env: 146 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 147 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Scripts 2 | on: 3 | workflow_dispatch: 4 | push: 5 | branches-ignore: [master] 6 | pull_request: 7 | branches: [master] 8 | 9 | jobs: 10 | scripts: 11 | name: test scripts 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v2.3.1 17 | - name: setup test environment 18 | run: | 19 | sudo /bin/bash ./test/environment_setup.sh 20 | - name: install prerrequisites 21 | run: | 22 | sudo /bin/bash ./scripts/dappnode_install_pre.sh UPDATE 23 | - name: Install DAppNode 24 | run: | 25 | sudo /bin/bash ./scripts/dappnode_install.sh 26 | - name: Show installation logs 27 | run: | 28 | cat /usr/src/dappnode/logs/install.log 29 | cat /usr/src/dappnode/logs/dappnode_install.log 30 | - name: Uninstall DAppNode 31 | run: | 32 | sudo /bin/bash ./scripts/dappnode_uninstall.sh y 33 | 34 | iso: 35 | name: test ISO 36 | runs-on: ubuntu-latest 37 | 38 | steps: 39 | - name: Checkout 40 | uses: actions/checkout@v2.3.1 41 | - name: create iso 42 | run: | 43 | docker-compose build 44 | docker-compose up 45 | ls images/ 46 | - name: verify image 47 | run: | 48 | ls -lrt images/DAppNode-debian-bullseye-amd64.iso 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | images -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker:dind 2 | # hadolint ignore=DL3018 3 | RUN apk update && \ 4 | apk add --no-cache xorriso git xz curl ca-certificates iptables cpio bash \ 5 | docker-compose && \ 6 | rm -rf /var/cache/apk/* 7 | 8 | #RUN apk add -U --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing aufs-util 9 | 10 | RUN addgroup -g 2999 docker 11 | 12 | # Create app directory 13 | WORKDIR /usr/src/app 14 | COPY . . 15 | 16 | CMD ["/usr/src/app/iso/scripts/generate_ISO.sh"] -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DAppNode_Installer 2 | 3 | [![Website dappnode.io](https://img.shields.io/badge/Website-dappnode.io-brightgreen.svg)](https://dappnode.io/) 4 | [![Documentation Wiki](https://img.shields.io/badge/Documentation-Wiki-brightgreen.svg)](https://github.com/dappnode/DAppNode/wiki) 5 | [![GIVETH Campaign](https://img.shields.io/badge/GIVETH-Campaign-1e083c.svg)](https://beta.giveth.io/campaigns/5b44b198647f33526e67c262) 6 | [![ELEMENT DAppNode](https://img.shields.io/badge/ELEMENT-DAppNode-blue.svg)](https://app.element.io/#/room/#DAppNode:matrix.org) 7 | [![Twitter Follow](https://img.shields.io/twitter/follow/espadrine.svg?style=social&label=Follow)](https://twitter.com/DAppNODE?lang=es) 8 | 9 | This repository generates the .iso file for installing DappNode to a server. Below are the instructions that you will need to make your own DappNode ISO. 10 | 11 | # Get DAppNode 12 | 13 | Get your DAppNode and start contributing to decentralization by running your own nodes. 14 | 15 | ## Buy DAppNode 16 | 17 | Buy your DAppNode with all the stuff configured and prepared to be used in [DAppNode shop](https://shop.dappnode.io/) 18 | 19 | ## Install DAppNode 20 | 21 | [Install DAppNode on your host machine](https://docs.dappnode.io/install/) 22 | 23 | ### Install DAppNode from ISO 24 | 25 | DAppNode ISO available in: [latest DAppNode release](https://github.com/dappnode/DAppNode/releases) 26 | 27 | Install DAppNode on your host machine by burning DAppNode ISO to a DVD or creating a bootable USB. Follow the tutorial of your operating system below and come back when you are finished: 28 | 29 | - [MacOS](https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-macos) 30 | - [Windows](https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-windows) 31 | - [Ubuntu](https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-ubuntu) 32 | 33 | **Developers**: DAppNode ISO could be generated following these steps: 34 | 35 | ``` 36 | $ git clone https://github.com/dappnode/DAppNode_Installer.git 37 | $ cd DAppNode_Installer 38 | $ docker-compose build 39 | $ docker-compose up 40 | ``` 41 | 42 | DAppNode iso will be generated inside images folder, to verify it: 43 | 44 | ``` 45 | $ ls -lrt images/DappNode-ubuntu-* 46 | ``` 47 | 48 | _Note_: ISO could be generated as unhattended/attended by editing the env var available in the docker-compose.yml file 49 | 50 | ### Install DAppNode from scripts 51 | 52 | Scripts available in: [latest DAppNode release](https://github.com/dappnode/DAppNode/releases) 53 | 54 | DAppNode could be also installed on a host machine with an OS already running on it. DAppNode has been developed and configured to be run on debian host machines so is preferably to install DAppNode on Debian or debian based (like Ubuntu) host machines. 55 | 56 | #### Prerrequisites 57 | 58 | Before install DAppNode with the script option, make sure you fullfill the requirements by running the following script: 59 | 60 | ``` 61 | sudo wget -O - https://prerequisites.dappnode.io | sudo bash 62 | ``` 63 | 64 | #### Script installation 65 | 66 | Once you make sure you have the requirements, install DAPpNode with the installation script: 67 | 68 | ``` 69 | sudo wget -O - https://installer.dappnode.io | sudo bash 70 | ``` 71 | 72 | ### Uninstall DAppNode 73 | 74 | Uinstall DAppNode on your host machine by running the following command: 75 | 76 | ``` 77 | wget -qO - https://uninstaller.dappnode.io | sudo bash 78 | ``` 79 | 80 | ## Contributing 81 | 82 | Please read [CONTRIBUTING.md](https://github.com/dappnode) for details on our code of conduct, and the process for submitting pull requests to us. 83 | 84 | ## Versioning 85 | 86 | We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/dappnode/DAppNode_Installer/tags). 87 | 88 | ## Authors 89 | 90 | - **Eduardo Antuña Díez** - _Initial work_ - [eduadiez](https://github.com/eduadiez) 91 | 92 | See also the list of [contributors](https://github.com/dappnode/DAppNode_Installer/contributors) who participated in this project. 93 | 94 | ## License 95 | 96 | This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details 97 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.4" 2 | 3 | services: 4 | dappnode_installer: 5 | build: . 6 | privileged: true 7 | environment: 8 | - BUILD=false # In case you want to re-generate a all the images, not recommended 9 | - CLEAN=true # it remove the images directory 10 | - UNATTENDED=false # UNATTENDED version 11 | volumes: 12 | - ./images:/images 13 | -------------------------------------------------------------------------------- /iso/boot/grub.cfg: -------------------------------------------------------------------------------- 1 | if loadfont $prefix/font.pf2 ; then 2 | set gfxmode=800x600 3 | insmod efi_gop 4 | insmod efi_uga 5 | insmod video_bochs 6 | insmod video_cirrus 7 | insmod gfxterm 8 | insmod png 9 | terminal_output gfxterm 10 | fi 11 | 12 | set timeout=6 13 | 14 | if background_image /isolinux/splash.png; then 15 | set color_normal=light-gray/black 16 | set color_highlight=white/black 17 | else 18 | set menu_color_normal=cyan/blue 19 | set menu_color_highlight=white/blue 20 | fi 21 | 22 | insmod play 23 | play 960 440 1 0 4 440 1 24 | set theme=/boot/grub/theme/1 25 | # menuentry --hotkey=g 'Graphical install' { 26 | # set background_color=black 27 | # linux /install.amd/vmlinuz vga=788 --- quiet 28 | # initrd /install.amd/gtk/initrd.gz 29 | # } 30 | menuentry --hotkey=i 'Press [Enter] to Install DAppNode' { 31 | set background_color=black 32 | linux /install.amd/vmlinuz vga=788 FRONTEND_BACKGROUND=dark --- quiet 33 | initrd /install.amd/initrd.gz 34 | } 35 | # submenu --hotkey=a 'Advanced options ...' { 36 | # set menu_color_normal=cyan/blue 37 | # set menu_color_highlight=white/blue 38 | # set theme=/boot/grub/theme/1-1 39 | # menuentry '... Graphical expert install' { 40 | # set background_color=black 41 | # linux /install.amd/vmlinuz priority=low vga=788 --- 42 | # initrd /install.amd/gtk/initrd.gz 43 | # } 44 | # menuentry '... Graphical rescue mode' { 45 | # set background_color=black 46 | # linux /install.amd/vmlinuz vga=788 rescue/enable=true --- quiet 47 | # initrd /install.amd/gtk/initrd.gz 48 | # } 49 | # menuentry '... Graphical automated install' { 50 | # set background_color=black 51 | # linux /install.amd/vmlinuz auto=true priority=critical vga=788 --- quiet 52 | # initrd /install.amd/gtk/initrd.gz 53 | # } 54 | # menuentry --hotkey=x '... Expert install' { 55 | # set background_color=black 56 | # linux /install.amd/vmlinuz priority=low vga=788 --- 57 | # initrd /install.amd/initrd.gz 58 | # } 59 | # menuentry --hotkey=r '... Rescue mode' { 60 | # set background_color=black 61 | # linux /install.amd/vmlinuz vga=788 rescue/enable=true --- quiet 62 | # initrd /install.amd/initrd.gz 63 | # } 64 | # menuentry --hotkey=a '... Automated install' { 65 | # set background_color=black 66 | # linux /install.amd/vmlinuz auto=true priority=critical vga=788 --- quiet 67 | # initrd /install.amd/initrd.gz 68 | # } 69 | # submenu --hotkey=s '... Speech-enabled advanced options ...' { 70 | # set menu_color_normal=cyan/blue 71 | # set menu_color_highlight=white/blue 72 | # set theme=/boot/grub/theme/1-1-1 73 | # menuentry --hotkey=x '... Expert speech install' { 74 | # set background_color=black 75 | # linux /install.amd/vmlinuz priority=low vga=788 speakup.synth=soft --- 76 | # initrd /install.amd/gtk/initrd.gz 77 | # } 78 | # menuentry --hotkey=r '... Rescue speech mode' { 79 | # set background_color=black 80 | # linux /install.amd/vmlinuz vga=788 rescue/enable=true speakup.synth=soft --- quiet 81 | # initrd /install.amd/gtk/initrd.gz 82 | # } 83 | # menuentry --hotkey=a '... Automated speech install' { 84 | # set background_color=black 85 | # linux /install.amd/vmlinuz auto=true priority=critical vga=788 speakup.synth=soft --- quiet 86 | # initrd /install.amd/gtk/initrd.gz 87 | # } 88 | # } 89 | # } 90 | # menuentry --hotkey=s 'Install with speech synthesis' { 91 | # set background_color=black 92 | # linux /install.amd/vmlinuz vga=788 speakup.synth=soft --- quiet 93 | # initrd /install.amd/gtk/initrd.gz 94 | # } 95 | -------------------------------------------------------------------------------- /iso/boot/isolinux.cfg: -------------------------------------------------------------------------------- 1 | # D-I config version 2.0 2 | # search path for the c32 support libraries (libcom32, libutil etc.) 3 | path 4 | include menu.cfg 5 | default vesamenu.c32 6 | prompt 0 7 | timeout 50 8 | -------------------------------------------------------------------------------- /iso/boot/menu.cfg: -------------------------------------------------------------------------------- 1 | menu hshift 7 2 | menu width 61 3 | 4 | menu title DappNode installer boot menu 5 | include stdmenu.cfg 6 | ;include gtk.cfg 7 | include txt.cfg 8 | 9 | label help 10 | menu label ^Help 11 | text help 12 | Display help screens; type 'menu' at boot prompt to return to this menu 13 | endtext 14 | config prompt.cfg 15 | ;include spkgtk.cfg 16 | ;include spk.cfg 17 | -------------------------------------------------------------------------------- /iso/boot/splash.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dappnode/DAppNode_Installer/926a91bcae8cc3c31f009442be8d3cef9ffac6d0/iso/boot/splash.pcx -------------------------------------------------------------------------------- /iso/boot/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dappnode/DAppNode_Installer/926a91bcae8cc3c31f009442be8d3cef9ffac6d0/iso/boot/splash.png -------------------------------------------------------------------------------- /iso/boot/theme_1: -------------------------------------------------------------------------------- 1 | title-color: "white" 2 | title-text: "DAppNode Installer" 3 | title-font: "Sans Regular 16" 4 | desktop-color: "black" 5 | desktop-image: "/isolinux/splash.png" 6 | message-color: "white" 7 | message-bg-color: "black" 8 | terminal-font: "Sans Regular 12" 9 | 10 | + boot_menu { 11 | left = 18% 12 | width = 50% 13 | top = 200 14 | height = 200 15 | item_font = "Sans Regular 12" 16 | item_color = #d3d3d3 17 | selected_item_color = "white" 18 | item_height = 20 19 | item_padding = 15 20 | item_spacing = 5 21 | } 22 | 23 | + vbox { 24 | top = 100%-60 25 | left = 10% 26 | + hbox { 27 | top = 0 28 | left = 20% 29 | + label {text = "Enter: " font = "Sans 10" color = "white" align = "left"} 30 | + label {text = "Select " font = "Sans 10" color = "#d3d3d3" align = "left"} 31 | } 32 | + hbox { 33 | top = 0 34 | left = 20% 35 | + label {text = "E: " font = "Sans 10" color = "white" align = "left"} 36 | + label {text = "Edit Selection " font = "Sans 10" color = "#d3d3d3" align = "left"} 37 | + label {text = " " font = "Sans 10" color = "white" align = "left"} 38 | + label {text = "C: " font = "Sans 10" color = "white" align = "left"} 39 | + label {text = "GRUB Command line" font = "Sans 10" color = "#d3d3d3" align = "left"} 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /iso/boot/txt.cfg: -------------------------------------------------------------------------------- 1 | label install 2 | menu label ^Install 3 | kernel /install.amd/vmlinuz 4 | append vga=788 initrd=/install.amd/initrd.gz FRONTEND_BACKGROUND=dark --- quiet 5 | -------------------------------------------------------------------------------- /iso/extra_dpkg/liblockfile1_1.14-1.1_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dappnode/DAppNode_Installer/926a91bcae8cc3c31f009442be8d3cef9ffac6d0/iso/extra_dpkg/liblockfile1_1.14-1.1_amd64.deb -------------------------------------------------------------------------------- /iso/extra_dpkg/lockfile-progs_0.1.18_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dappnode/DAppNode_Installer/926a91bcae8cc3c31f009442be8d3cef9ffac6d0/iso/extra_dpkg/lockfile-progs_0.1.18_amd64.deb -------------------------------------------------------------------------------- /iso/extra_dpkg/usbmount_0.0.24_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dappnode/DAppNode_Installer/926a91bcae8cc3c31f009442be8d3cef9ffac6d0/iso/extra_dpkg/usbmount_0.0.24_all.deb -------------------------------------------------------------------------------- /iso/preseeds/preseed.cfg: -------------------------------------------------------------------------------- 1 | # Preseed-example: https://www.debian.org/releases/stable/example-preseed.txt 2 | # Buster preseed example: https://www.debian.org/releases/buster/example-preseed.txt 3 | # Bullseye preseed example: https://www.debian.org/releases/testing/example-preseed.txt 4 | ### Network configuration 5 | d-i hw-detect/load_firmware boolean true 6 | d-i netcfg/choose_interface select auto 7 | d-i netcfg/link_wait_timeout string 20 8 | d-i netcfg/get_hostname string dappnode 9 | d-i netcfg/get_hostname seen false 10 | d-i netcfg/hostname seen false 11 | d-i passwd/user-fullname string DAppNode User 12 | d-i netcfg/get_domain string '' 13 | d-i netcfg/get_domain seen true 14 | 15 | ### Account setup 16 | d-i passwd/username string dappnode 17 | d-i passwd/username seen false 18 | 19 | ### Package selection 20 | tasksel tasksel/first multiselect standard 21 | d-i pkgsel/include string openssh-server vim sudo iw iwd wpasupplicant intel-microcode iucode-tool build-essential linux-headers-$(uname -r) firmware-iwlwifi avahi-utils 22 | d-i apt-setup/use_mirror boolean false 23 | d-i mirror/country string manual 24 | d-i mirror/http/hostname string deb.debian.org 25 | d-i mirror/http/directory string /debian 26 | d-i mirror/http/proxy string 27 | d-i apt-setup/local0/repository string http://deb.debian.org/debian/ bullseye main contrib non-free 28 | d-i apt-setup/cdrom/set-first boolean false 29 | d-i apt-setup/cdrom/set-next boolean false 30 | d-i apt-setup/cdrom/set-failed boolean false 31 | popularity-contest popularity-contest/participate boolean false 32 | 33 | ### Preseeding other packages 34 | d-i preseed/late_command string \ 35 | in-target mkdir -p /usr/src/dappnode; \ 36 | cp -ar /cdrom/dappnode/* /target/usr/src/dappnode/; \ 37 | cp -a /cdrom/dappnode/scripts/rc.local /target/etc/rc.local; \ 38 | cp -a /cdrom/dappnode/bin/docker/docker-compose-Linux-x86_64 /target/usr/local/bin/docker-compose; \ 39 | in-target chmod +x /usr/src/dappnode/scripts/dappnode_install_pre.sh; \ 40 | in-target chmod +x /usr/src/dappnode/scripts/static_ip.sh; \ 41 | in-target chmod +x /usr/local/bin/docker-compose; \ 42 | in-target gpasswd -a $(getent passwd "1000" | cut -d: -f1) sudo; \ 43 | /target/usr/src/dappnode/scripts/static_ip.sh; \ 44 | in-target /usr/src/dappnode/scripts/dappnode_install_pre.sh UPDATE 45 | -------------------------------------------------------------------------------- /iso/preseeds/preseed_unattended.cfg: -------------------------------------------------------------------------------- 1 | # Preseed-example: https://www.debian.org/releases/stable/example-preseed.txt 2 | # Buster preseed example: https://www.debian.org/releases/buster/example-preseed.txt 3 | # Bullseye preseed example: https://www.debian.org/releases/testing/example-preseed.txt 4 | ### Localization 5 | d-i debian-installer/locale string en_US.UTF-8 6 | d-i debian-installer/keymap select us 7 | d-i keymap select us 8 | d-i keyboard-configuration/xkb-keymap select us 9 | 10 | ### Network configuration 11 | d-i hw-detect/load_firmware boolean true # Non-free hardware needed ? 12 | d-i netcfg/choose_interface select auto 13 | d-i netcfg/link_wait_timeout string 20 14 | d-i netcfg/get_hostname string dappnode 15 | d-i netcfg/hostname seen true 16 | d-i netcfg/get_domain string dappnode.eth 17 | d-i netcfg/get_domain seen true 18 | 19 | ### Account setup 20 | d-i passwd/root-login boolean false # dappnode user will not be in sudo 21 | d-i passwd/user-fullname string DAppNode 22 | d-i passwd/username string dappnode 23 | # Use `mkpasswd -m sha-512` to generate the hash 24 | # Using "dappnode.s0" as default 25 | d-i passwd/user-password-crypted password $6$insecur3$rnEv9Amdjn3ctXxPYOlzj/cwvLT43GjWzkPECIHNqd8Vvza5bMG8QqMwEIBKYqnj609D.4ngi4qlmt29dLE.71 26 | d-i passwd/root-password-crypted password $6$insecur3$rnEv9Amdjn3ctXxPYOlzj/cwvLT43GjWzkPECIHNqd8Vvza5bMG8QqMwEIBKYqnj609D.4ngi4qlmt29dLE.71 27 | 28 | ### Clock and time zone setup 29 | d-i clock-setup/utc boolean false 30 | d-i time/zone string Europe/Berlin 31 | d-i clock-setup/ntp boolean true 32 | 33 | ### Partitioning 34 | d-i partman/early_command string sh /cdrom/dappnode/scripts/check-disks.sh 35 | d-i partman-auto/purge_lvm_from_device boolean true 36 | d-i partman-auto/method string lvm 37 | d-i partman-auto-lvm/new_vg_name string rootvg 38 | d-i partman-auto-lvm/guided_size string max 39 | d-i partman-lvm/device_remove_lvm boolean true 40 | d-i partman-md/device_remove_md boolean true 41 | d-i partman-lvm/confirm boolean true 42 | d-i partman-lvm/confirm_nooverwrite boolean true 43 | d-i partman-auto/choose_recipe select atomic 44 | d-i partman-partitioning/confirm_write_new_label boolean true 45 | d-i partman/choose_partition select finish 46 | d-i partman/confirm boolean true 47 | d-i partman/confirm_nooverwrite boolean true 48 | d-i partman/mount_style select uuid 49 | d-i partman-efi/non_efi_system boolean true 50 | 51 | ### Boot loader installation 52 | d-i grub-installer/only_debian boolean true 53 | d-i grub-installer/with_other_os boolean true 54 | d-i grub-installer/bootdev string default 55 | 56 | ### Package selection 57 | tasksel tasksel/first multiselect standard 58 | d-i pkgsel/include string openssh-server vim sudo build-essential linux-headers-$(uname -r) iw iwd wpasupplicant intel-microcode iucode-tool firmware-misc-nonfree firmware-iwlwifi avahi-utils 59 | d-i apt-setup/use_mirror boolean false 60 | d-i mirror/country string manual 61 | d-i mirror/http/hostname string deb.debian.org 62 | d-i mirror/http/directory string /debian 63 | d-i mirror/http/proxy string 64 | d-i apt-setup/local0/repository string http://deb.debian.org/debian/ bullseye main contrib non-free 65 | d-i apt-setup/cdrom/set-first boolean false 66 | d-i apt-setup/cdrom/set-next boolean false 67 | d-i apt-setup/cdrom/set-failed boolean false 68 | popularity-contest popularity-contest/participate boolean false 69 | d-i pkgsel/upgrade select none 70 | 71 | ### Preseeding other packages 72 | d-i preseed/late_command string \ 73 | in-target mkdir -p /usr/src/dappnode; \ 74 | sort -u /etc/network/devhotplug > /target/usr/src/dappnode/hotplug; \ 75 | cp -a /etc/network/interfaces /target/etc/network/interfaces; \ 76 | cp -ar /cdrom/dappnode/* /target/usr/src/dappnode/; \ 77 | cp -a /cdrom/dappnode/scripts/rc.local /target/etc/rc.local; \ 78 | cp -a /cdrom/dappnode/bin/docker/docker-compose-Linux-x86_64 /target/usr/local/bin/docker-compose; \ 79 | in-target chmod +x /usr/src/dappnode/scripts/dappnode_install_pre.sh; \ 80 | in-target chmod +x /usr/local/bin/docker-compose; \ 81 | in-target touch /usr/src/dappnode/.firstboot; \ 82 | in-target /usr/src/dappnode/scripts/dappnode_install_pre.sh UPDATE 83 | d-i finish-install/reboot_in_progress note 84 | -------------------------------------------------------------------------------- /iso/scripts/download_core.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | sed '1,/^\#\!ISOBUILD/!d' /usr/src/app/.dappnode_profile >/tmp/vars.sh 6 | # shellcheck disable=SC1091 7 | source /tmp/vars.sh 8 | 9 | DAPPNODE_CORE_DIR="/images" 10 | DAPPNODE_HASH_FILE="${DAPPNODE_CORE_DIR}/packages-content-hash.csv" 11 | CONTENT_HASH_PKGS=(geth openethereum nethermind) 12 | IPFS_ENDPOINT=${IPFS_ENDPOINT:-"http://ipfs.io"} 13 | 14 | SWGET="wget -q -O-" 15 | WGET="wget" 16 | 17 | components=(BIND IPFS WIREGUARD DAPPMANAGER WIFI HTTPS) 18 | 19 | # The indirect variable expansion used in ${!ver##*:} allows us to use versions like 'dev:development' 20 | # If such variable with 'dev:'' suffix is used, then the component is built from specified branch or commit. 21 | for comp in "${components[@]}"; do 22 | ver="${comp}_VERSION" 23 | DOWNLOAD_URL="https://github.com/dappnode/DNP_${comp}/releases/download/v${!ver}" 24 | if [[ ${!ver} == /ipfs/* ]]; then 25 | DOWNLOAD_URL="${IPFS_ENDPOINT}/api/v0/cat?arg=${!ver%:*}" 26 | fi 27 | 28 | eval "${comp}_URL=\"${DOWNLOAD_URL}/${comp,,}.dnp.dappnode.eth_${!ver##*:}_linux-amd64.txz\"" 29 | eval "${comp}_YML=\"${DOWNLOAD_URL}/docker-compose.yml\"" 30 | eval "${comp}_MANIFEST=\"${DOWNLOAD_URL}/dappnode_package.json\"" 31 | eval "${comp}_YML_FILE=\"${DAPPNODE_CORE_DIR}/docker-compose-${comp,,}.yml\"" 32 | eval "${comp}_FILE=\"${DAPPNODE_CORE_DIR}/${comp,,}.dnp.dappnode.eth_${!ver##*:}_linux-amd64.txz\"" 33 | eval "${comp}_MANIFEST_FILE=\"${DAPPNODE_CORE_DIR}/dappnode_package-${comp,,}.json\"" 34 | done 35 | 36 | dappnode_core_download() { 37 | for comp in "${components[@]}"; do 38 | ver="${comp}_VERSION" 39 | if [[ ${!ver} != dev:* ]]; then 40 | # Download DAppNode Core Images if it's needed 41 | eval "[ -f \$${comp}_FILE ] || $WGET -O \$${comp}_FILE \$${comp}_URL" 42 | # Download DAppNode Core docker-compose yml files if it's needed 43 | eval "[ -f \$${comp}_YML_FILE ] || $WGET -O \$${comp}_YML_FILE \$${comp}_YML" 44 | # Download DAppNode Core manifest files if it's needed 45 | eval "[ -f \$${comp}_MANIFEST_FILE ] || $WGET -O \$${comp}_MANIFEST_FILE \$${comp}_MANIFEST" 46 | fi 47 | done 48 | } 49 | 50 | grabContentHashes() { 51 | rm -f $DAPPNODE_HASH_FILE 52 | for comp in "${CONTENT_HASH_PKGS[@]}"; do 53 | echo "Grabbing ${comp}" 54 | CONTENT_HASH=$(eval "${SWGET}" https://github.com/dappnode/DAppNodePackage-"${comp}"/releases/latest/download/content-hash) 55 | if [ -z "$CONTENT_HASH" ]; then 56 | echo "ERROR! Failed to find content hash of ${comp}." 57 | exit 1 58 | fi 59 | echo "${comp}.dnp.dappnode.eth,${CONTENT_HASH}" >>${DAPPNODE_HASH_FILE} 60 | done 61 | } 62 | 63 | echo -e "\e[32mDownloading DAppNode Core...\e[0m" 64 | dappnode_core_download 65 | 66 | echo -e "\e[32mGrabbing latest content hashes...\e[0m" 67 | grabContentHashes 68 | 69 | mkdir -p /usr/src/app/dappnode/DNCORE 70 | 71 | echo -e "\e[32mCopying files...\e[0m" 72 | cp /images/*.txz /usr/src/app/dappnode/DNCORE 73 | cp /images/*.yml /usr/src/app/dappnode/DNCORE 74 | cp /images/*.json /usr/src/app/dappnode/DNCORE 75 | cp ${DAPPNODE_HASH_FILE} /usr/src/app/dappnode/DNCORE 76 | cp /usr/src/app/.dappnode_profile /usr/src/app/dappnode/DNCORE 77 | -------------------------------------------------------------------------------- /iso/scripts/generate_ISO.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | dockerd & 5 | sleep 5 6 | 7 | if [ "$CLEAN" = true ]; then 8 | rm -f /images/*.tar.xz 9 | rm -f /images/*.yml 10 | rm -f /images/*.json 11 | rm -f /images/*.txz 12 | fi 13 | 14 | if [ "$BUILD" = true ]; then 15 | /usr/src/app/iso/scripts/generate_docker_images.sh 16 | else 17 | /usr/src/app/iso/scripts/download_core.sh 18 | fi 19 | 20 | #file generated to detectd ISO installation 21 | mkdir -p /usr/src/app/dappnode 22 | touch /usr/src/app/dappnode/iso_install.log 23 | 24 | /usr/src/app/iso/scripts/generate_dappnode_iso_debian.sh 25 | -------------------------------------------------------------------------------- /iso/scripts/generate_dappnode_iso_debian.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | #echo "Downloading debian ISO image: debian-firmware-testing-amd64-netinst-2020-06-22.iso..." 5 | #if [ ! -f /images/debian-firmware-testing-amd64-netinst-2020-06-22.iso ]; then 6 | # wget http://vdo.dappnode.io/debian-firmware-testing-amd64-netinst-2020-06-22.iso \ 7 | # -O /images/debian-firmware-testing-amd64-netinst-2020-06-22.iso 8 | #fi 9 | #echo "Done!" 10 | 11 | #ISO_NAME=firmware-testing-amd64-netinst.iso 12 | #ISO_URL=https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/weekly-builds/amd64/iso-cd/ 13 | 14 | #ISO_NAME=firmware-bullseye-DI-alpha3-amd64-netinst.iso 15 | #ISO_URL=https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/bullseye_di_alpha3+nonfree/amd64/iso-cd/ 16 | 17 | ISO_NAME=firmware-bullseye-DI-alpha3-amd64-netinst.iso 18 | ISO_URL=https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/bullseye_di_alpha3+nonfree/amd64/iso-cd/ 19 | 20 | echo "Downloading debian ISO image: firmware-bullseye-DI-alpha2-amd64-netinst.iso..." 21 | if [ ! -f /images/${ISO_NAME} ]; then 22 | wget ${ISO_URL}/${ISO_NAME} \ 23 | -O /images/${ISO_NAME} 24 | fi 25 | echo "Done!" 26 | 27 | echo "Clean old files..." 28 | rm -rf dappnode-isoº 29 | rm -rf DappNode-debian-* 30 | 31 | echo "Extracting the iso..." 32 | xorriso -osirrox on -indev /images/${ISO_NAME} \ 33 | -extract / dappnode-iso 34 | 35 | echo "Obtaining the isohdpfx.bin for hybrid ISO..." 36 | dd if=/images/${ISO_NAME} bs=432 count=1 \ 37 | of=dappnode-iso/isolinux/isohdpfx.bin 38 | 39 | cd /usr/src/app/dappnode-iso # /usr/src/app/dappnode-iso 40 | 41 | echo "Downloading third-party packages..." 42 | sed '1,/^\#\!ISOBUILD/!d' /usr/src/app/scripts/dappnode_install_pre.sh >/tmp/vars.sh 43 | # shellcheck disable=SC1091 44 | source /tmp/vars.sh 45 | mkdir -p /images/bin/docker 46 | cd /images/bin/docker 47 | [ -f "${DOCKER_PKG}" ] || wget "${DOCKER_URL}" 48 | [ -f "${DOCKER_CLI_PKG}" ] || wget "${DOCKER_CLI_URL}" 49 | [ -f "${CONTAINERD_PKG}" ] || wget "${CONTAINERD_URL}" 50 | [ -f docker-compose-Linux-x86_64 ] || wget "${DCMP_URL}" 51 | cd - # /usr/src/app/dappnode-iso 52 | 53 | echo "Creating necessary directories and copying files..." 54 | mkdir -p /usr/src/app/dappnode-iso/dappnode 55 | cp -r /usr/src/app/scripts /usr/src/app/dappnode-iso/dappnode 56 | cp -r /usr/src/app/dappnode/* /usr/src/app/dappnode-iso/dappnode 57 | cp -vr /images/bin /usr/src/app/dappnode-iso/dappnode/ 58 | 59 | echo "Customizing preseed..." 60 | mkdir -p /tmp/makeinitrd 61 | cd install.amd 62 | cp initrd.gz /tmp/makeinitrd/ 63 | if [[ ${UNATTENDED} == "true" ]]; then 64 | cp /usr/src/app/iso/preseeds/preseed_unattended.cfg /tmp/makeinitrd/preseed.cfg 65 | else 66 | cp /usr/src/app/iso/preseeds/preseed.cfg /tmp/makeinitrd/preseed.cfg 67 | fi 68 | cd /tmp/makeinitrd 69 | gunzip initrd.gz 70 | cpio -id -H newc /tmp/list 73 | echo "preseed.cfg" >>/tmp/list 74 | rm initrd 75 | cpio -o -H newc initrd 76 | gzip initrd 77 | cd - 78 | mv /tmp/makeinitrd/initrd.gz ./initrd.gz 79 | cd .. 80 | 81 | echo "Configuring the boot menu for DappNode..." 82 | cp /usr/src/app/iso/boot/grub.cfg boot/grub/grub.cfg 83 | cp /usr/src/app/iso/boot/theme_1 boot/grub/theme/1 84 | cp /usr/src/app/iso/boot/isolinux.cfg isolinux/isolinux.cfg 85 | cp /usr/src/app/iso/boot/menu.cfg isolinux/menu.cfg 86 | cp /usr/src/app/iso/boot/txt.cfg isolinux/txt.cfg 87 | cp /usr/src/app/iso/boot/splash.png isolinux/splash.png 88 | 89 | echo "Fix md5 sum..." 90 | # shellcheck disable=SC2046 91 | md5sum $(find ! -name "md5sum.txt" ! -path "./isolinux/*" -type f) >md5sum.txt 92 | 93 | echo "Generating new iso..." 94 | xorriso -as mkisofs -isohybrid-mbr isolinux/isohdpfx.bin \ 95 | -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 \ 96 | -boot-info-table -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot \ 97 | -isohybrid-gpt-basdat -o /images/DAppNode-debian-bullseye-amd64.iso . 98 | -------------------------------------------------------------------------------- /iso/scripts/generate_docker_images.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source /usr/src/app/.dappnode_profile 4 | 5 | echo "Cleaning previous files" 6 | rm -rf ./DNP_* 7 | 8 | echo "Cloning & building DNP_HTTPS..." 9 | git clone -b "v${HTTPS_VERSION}" https://github.com/dappnode/DNP_HTTPS 10 | docker-compose -f ./DNP_HTTPS/docker-compose-https.yml build 11 | docker save https.dnp.dappnode.eth:${HTTPS_VERSION} | xz -e9vT0 >/images/https.dnp.dappnode.eth_${HTTPS_VERSION}_linux-amd64.txz 12 | 13 | echo "Cloning & building DNP_WIREGUARD..." 14 | git clone -b "v${WIREGUARD_VERSION}" https://github.com/dappnode/DNP_WIREGUARD 15 | docker-compose -f ./DNP_WIREGUARD/docker-compose-wireguard.yml build 16 | docker save wireguard.dnp.dappnode.eth:${WIREGUARD_VERSION} | xz -e9vT0 >/images/wireguard.dnp.dappnode.eth_${WIREGUARD_VERSION}_linux-amd64.txz 17 | 18 | echo "Cloning & building DNP_IPFS..." 19 | git clone -b "v${IPFS_VERSION}" https://github.com/dappnode/DNP_IPFS 20 | docker-compose -f ./DNP_IPFS/docker-compose-ipfs.yml build 21 | docker save ipfs.dnp.dappnode.eth:${IPFS_VERSION} | xz -e9vT0 >/images/ipfs.dnp.dappnode.eth_${IPFS_VERSION}_linux-amd64.txz 22 | 23 | echo "Cloning & building DNP_BIND..." 24 | git clone -b "v${BIND_VERSION}" https://github.com/dappnode/DNP_BIND 25 | docker-compose -f ./DNP_BIND/docker-compose-bind.yml build 26 | docker save bind.dnp.dappnode.eth:${BIND_VERSION} | xz -e9vT0 >/images/bind.dnp.dappnode.eth_${BIND_VERSION}_linux-amd64.txz 27 | 28 | echo "Cloning & building DNP_DAPPMANAGER..." 29 | git clone -b "v${DAPPMANAGER_VERSION}" https://github.com/dappnode/DNP_DAPPMANAGER 30 | docker-compose -f ./DNP_DAPPMANAGER/docker-compose-dappmanager.yml build 31 | docker save dappmanager.dnp.dappnode.eth:${DAPPMANAGER_VERSION} | xz -e9vT0 >/images/dappmanager.dnp.dappnode.eth_${DAPPMANAGER_VERSION}_linux-amd64.txz 32 | 33 | echo "Coping dappnode_all_docker_images_linux-amd64.txz to dappnode dir..." 34 | cp /images/* /usr/src/app/dappnode/ 35 | 36 | echo "Finished!" 37 | -------------------------------------------------------------------------------- /iso/scripts/prepare_snapshot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DAPPNODE_INSTALL_SCRIPT_URL=$1 4 | if [ -z "$DAPPNODE_INSTALL_SCRIPT_URL" ]; then 5 | echo "Must supply one argument, DAPPNODE_INSTALL_SCRIPT_URL" 6 | echo "Example: https://raw.githubusercontent.com/dappnode/DAppNode_Installer/monolithic/build/utils/scripts/dappnode_install.sh" 7 | exit 1 8 | fi 9 | 10 | wget -qO - https://prerequisites.dappnode.io | sudo bash 11 | 12 | mkdir -p /usr/src/dappnode/scripts/ 13 | 14 | wget $DAPPNODE_INSTALL_SCRIPT_URL -O /usr/src/dappnode/scripts/dappnode_install.sh 15 | 16 | chmod +x /usr/src/dappnode/scripts/dappnode_install.sh 17 | 18 | touch /usr/src/dappnode/.firstboot 19 | 20 | cat </etc/rc.local 21 | #!/bin/sh -e 22 | /usr/src/dappnode/scripts/dappnode_install.sh 23 | exit 0 24 | EOF 25 | 26 | chmod +x /etc/rc.local 27 | 28 | cat </etc/systemd/system/rc-local.service 29 | [Unit] 30 | Description=/etc/rc.local Compatibility 31 | ConditionPathExists=/etc/rc.local 32 | [Service] 33 | Type=forking 34 | ExecStart=/etc/rc.local start 35 | TimeoutSec=0 36 | StandardOutput=tty 37 | RemainAfterExit=yes 38 | SysVStartPriority=99 39 | [Install] 40 | WantedBy=multi-user.target 41 | EOF 42 | 43 | systemctl enable rc-local 44 | 45 | UPDATE=true /usr/src/dappnode/scripts/dappnode_install.sh 46 | 47 | rm /usr/src/dappnode/.firstboot -------------------------------------------------------------------------------- /iso/sgx/enable_sgx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dappnode/DAppNode_Installer/926a91bcae8cc3c31f009442be8d3cef9ffac6d0/iso/sgx/enable_sgx -------------------------------------------------------------------------------- /iso/sgx/sgx_linux_x64_driver.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dappnode/DAppNode_Installer/926a91bcae8cc3c31f009442be8d3cef9ffac6d0/iso/sgx/sgx_linux_x64_driver.bin -------------------------------------------------------------------------------- /scripts/check-disks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # This is run by d-i before the partman step (e.g. d-i partman/early_command) 4 | 5 | USBDEV=$(list-devices usb-partition | sed "s/\(.*\)./\1/" | sort -u | head -1 ); 6 | if [ -z "${USBDEV}" ]; then 7 | DEVICE=$(list-devices disk) 8 | else 9 | DEVICE=$(list-devices disk | grep -v "${USBDEV}") 10 | fi 11 | for DISK in ${DEVICE}; do 12 | DISKS="${DISKS} ${DISK}"; 13 | done; 14 | DISKS=$(echo ${DISKS} | sed "s/^ //g"); 15 | debconf-set partman-auto/disk "$DISKS"; -------------------------------------------------------------------------------- /scripts/dappnode_access_credentials.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script will iterate over the access methods in dappnode 4 | # and display its credentials based on priority. 5 | # PRIORITY: Wi-Wi > Avahi > VPN (Wireguard > OpenVpn) 6 | 7 | ############# 8 | #0.VARIABLES# 9 | ############# 10 | # Containers 11 | DAPPMANAGER_CONTAINER="DAppNodeCore-dappmanager.dnp.dappnode.eth" 12 | WIFI_CONTAINER="DAppNodeCore-wifi.dnp.dappnode.eth" 13 | WIREGUARD_CONTAINER="DAppNodeCore-api.wireguard.dnp.dappnode.eth" 14 | OPENVPN_CONTAINER="DAppNodeCore-vpn.dnp.dappnode.eth" 15 | HTTPS_CONTAINER="DAppNodeCore-https.dnp.dappnode.eth" 16 | # Credentials 17 | WIREGUARD_GET_CREDS="docker exec -i $WIREGUARD_CONTAINER getWireguardCredentials" 18 | OPENVPN_GET_CREDS="docker exec -i $OPENVPN_CONTAINER getAdminCredentials" 19 | WIFI_GET_CREDS=$(grep 'SSID\|WPA_PASSPHRASE' /usr/src/dappnode/DNCORE/docker-compose-wifi.yml) 20 | # Endpoints 21 | AVAHI_ENDPOINT="dappnode.local" 22 | DAPPNODE_ADMINUI_URL="http://my.dappnode" 23 | DAPPNODE_ADMINUI_LOCAL_URL="http://${AVAHI_ENDPOINT}" 24 | DAPPNODE_WELCOME_URL="http://welcome.dappnode" 25 | 26 | ############# 27 | #1.FUNCTIONS# 28 | ############# 29 | 30 | function dappnode_startup_check () { 31 | echo -n "Wait until DAppNode initializes (press ctrl+c to stop) " 32 | sleep 5 33 | n=0 34 | until [ "$n" -ge 8 ] 35 | do 36 | [ "$(docker inspect -f '{{.State.Running}}' ${DAPPMANAGER_CONTAINER} 2> /dev/null)" = "true" ] && break 37 | n=$((n+1)) 38 | echo -n "." 39 | sleep 8 40 | done 41 | } 42 | 43 | # $1 Connection method $2 Credentials 44 | function create_connection_message () { 45 | echo -e "\n\e[32mConnect to DAppNode through $1 using the following credentials:\e[0m\n$2\n\nAccess your DAppNode at \e[4m$DAPPNODE_ADMINUI_URL\e\n\n[0mDiscover more ways to connect to your DAppNode at \e[4m$DAPPNODE_WELCOME_URL\e[0m\n" 46 | } 47 | 48 | function wifi_connection () { 49 | # NOTE: network interface may be in use by host => $(cat /sys/class/net/${INTERFACE}/operstate)" !== "up") 50 | # NOTE: wifi has a delay up to 1 min 51 | # wifi container running 52 | [ "$(docker inspect -f '{{.State.Running}}' ${WIFI_CONTAINER} 2> /dev/null)" = "true" ] && \ 53 | # Check interface variable is set 54 | [ -n "$(docker exec -it $WIFI_CONTAINER iw dev | grep 'Interface' | awk 'NR==1{print $2}')" ] && \ 55 | create_connection_message "Wi-Fi" "$WIFI_GET_CREDS" && \ 56 | exit 0 || echo -e "\nWifi not detected" 57 | } 58 | 59 | function avahi_connection () { 60 | # Ping to avahi endpoint: -c: number of pings. -w: timeout 61 | avahi-resolve -n $AVAHI_ENDPOINT > /dev/null 2>&1 || { echo "Avahi-daemon not detected" ; return ; } 62 | # Https container exists 63 | # shellcheck disable=SC2143 64 | [ "$(docker ps -a | grep ${HTTPS_CONTAINER})" ] && \ 65 | # Https container running 66 | [ "$(docker inspect -f '{{.State.Running}}' ${HTTPS_CONTAINER})" = "true" ] && \ 67 | # Https env variable LOCAL_PROXYING="true" 68 | [ "$(docker exec -i ${HTTPS_CONTAINER} sh -c 'echo "$LOCAL_PROXYING"')" = "true" ] && \ 69 | # avahi-daemon running => systemctl is-active avahi-daemon RETURNS "active" or "inactive" 70 | [ "$(systemctl is-active avahi-daemon)" = "active" ] && \ 71 | echo -e "\n\e[32mConnect to DAppNode through Local Proxying.\e[0m\n\nVisit \e[4m$DAPPNODE_ADMINUI_LOCAL_URL\e\n\n[0mCheck out all the access methods available to connect to your DAppNode at \e[4m$DAPPNODE_WELCOME_URL\e[0m\n" && \ 72 | exit 0 || echo "Avahi-daemon not detected" 73 | } 74 | 75 | function wireguard_connection () { 76 | # wireguard container exists 77 | # shellcheck disable=SC2143 78 | [ "$(docker ps -a | grep ${WIREGUARD_CONTAINER})" ] && \ 79 | # wireguard container running 80 | [ "$(docker inspect -f '{{.State.Running}}' ${WIREGUARD_CONTAINER})" = "true" ] && \ 81 | create_connection_message "Wireguard" "$($WIREGUARD_GET_CREDS)" && \ 82 | exit 0 || echo "Wireguard not detected" 83 | } 84 | 85 | function openvpn_connection () { 86 | # openvpn container exists 87 | # shellcheck disable=SC2143 88 | [ "$(docker ps -a | grep ${OPENVPN_CONTAINER})" ] && \ 89 | # openvpn container running 90 | [ "$(docker inspect -f '{{.State.Running}}' ${OPENVPN_CONTAINER})" = "true" ] && \ 91 | create_connection_message "Open-VPN" "$($OPENVPN_GET_CREDS)" && \ 92 | exit 0 || echo "Open-VPN not detected" 93 | } 94 | 95 | ######## 96 | #2.MAIN# 97 | ######## 98 | 99 | dappnode_startup_check 100 | wifi_connection 101 | avahi_connection 102 | wireguard_connection 103 | openvpn_connection 104 | 105 | echo -e "\e[33mWARNING: no connection services detected\e[0m Check out all the access methods available to connect to your DAppNode at \e[4m$DAPPNODE_WELCOME_URL\e[0m\n" 106 | exit 0 -------------------------------------------------------------------------------- /scripts/dappnode_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ############# 4 | # VARIABLES # 5 | ############# 6 | # Dirs 7 | DAPPNODE_DIR="/usr/src/dappnode" 8 | DAPPNODE_CORE_DIR="${DAPPNODE_DIR}/DNCORE" 9 | LOGS_DIR="$DAPPNODE_DIR/logs" 10 | # Files 11 | CONTENT_HASH_FILE="${DAPPNODE_CORE_DIR}/packages-content-hash.csv" 12 | LOGFILE="${LOGS_DIR}/dappnode_install.log" 13 | MOTD_FILE="/etc/motd" 14 | DAPPNODE_PROFILE="${DAPPNODE_CORE_DIR}/.dappnode_profile" 15 | # Get URLs 16 | PROFILE_BRANCH=${PROFILE_BRANCH:-"master"} 17 | IPFS_ENDPOINT=${IPFS_ENDPOINT:-"http://ipfs.io"} 18 | PROFILE_URL="https://github.com/dappnode/DAppNode/releases/latest/download/dappnode_profile.sh" 19 | DAPPNODE_ACCESS_CREDENTIALS="${DAPPNODE_DIR}/scripts/dappnode_access_credentials.sh" 20 | DAPPNODE_ACCESS_CREDENTIALS_URL="https://github.com/dappnode/DAppNode/releases/latest/download/dappnode_access_credentials.sh" 21 | WGET="wget -q --show-progress --progress=bar:force" 22 | SWGET="wget -q -O-" 23 | # Other 24 | CONTENT_HASH_PKGS=(geth openethereum nethermind) 25 | ARCH=$(dpkg --print-architecture) 26 | 27 | # Clean if update 28 | if [ "$UPDATE" = true ]; then 29 | echo "Cleaning for update..." 30 | rm -rf $LOGFILE 31 | rm -rf ${DAPPNODE_CORE_DIR}/docker-compose-*.yml 32 | rm -rf ${DAPPNODE_CORE_DIR}/dappnode_package-*.json 33 | rm -rf ${DAPPNODE_CORE_DIR}/*.tar.xz 34 | rm -rf ${DAPPNODE_CORE_DIR}/*.txz 35 | rm -rf ${DAPPNODE_CORE_DIR}/.dappnode_profile 36 | rm -rf ${CONTENT_HASH_FILE} 37 | fi 38 | 39 | # Create necessary directories 40 | mkdir -p $DAPPNODE_DIR 41 | mkdir -p $DAPPNODE_CORE_DIR 42 | mkdir -p "${DAPPNODE_DIR}/scripts" 43 | mkdir -p "${DAPPNODE_CORE_DIR}/scripts" 44 | mkdir -p "${DAPPNODE_DIR}/config" 45 | mkdir -p $LOGS_DIR 46 | 47 | # TEMPORARY: think a way to integrate flags instead of use files to detect installation type 48 | is_iso_install() { 49 | # Check old and new location of iso_install.log 50 | if [ -f "${DAPPNODE_DIR}/iso_install.log" ] || [ -f "${DAPPNODE_DIR}/logs/iso_install.log" ]; then 51 | IS_ISO_INSTALL=true 52 | else 53 | IS_ISO_INSTALL=false 54 | fi 55 | } 56 | 57 | # Check is port 80 in used (necessary for HTTPS) 58 | is_port_used() { 59 | lsof -i -P -n | grep ":80 (LISTEN)" &>/dev/null && IS_PORT_USED=true || IS_PORT_USED=false 60 | } 61 | 62 | # Determine packages to be installed 63 | determine_packages() { 64 | is_iso_install 65 | is_port_used 66 | if [ "$IS_ISO_INSTALL" == "false" ]; then 67 | if [ "$IS_PORT_USED" == "true" ]; then 68 | PKGS=(BIND IPFS VPN DAPPMANAGER WIFI) 69 | else 70 | PKGS=(HTTPS BIND IPFS VPN DAPPMANAGER WIFI) 71 | fi 72 | else 73 | if [ "$IS_PORT_USED" == "true" ]; then 74 | PKGS=(BIND IPFS WIREGUARD DAPPMANAGER WIFI) 75 | else 76 | PKGS=(HTTPS BIND IPFS WIREGUARD DAPPMANAGER WIFI) 77 | fi 78 | fi 79 | echo -e "\e[32mPackages to be installed: ${PKGS[*]}\e[0m" 2>&1 | tee -a $LOGFILE 80 | } 81 | 82 | function valid_ip() { 83 | local ip=$1 84 | local stat=1 85 | 86 | if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then 87 | OIFS=$IFS 88 | IFS='.' 89 | ip=("$ip") 90 | IFS=$OIFS 91 | [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 && \ 92 | ${ip[2]} -le 255 && ${ip[3]} -le 255 ]] 93 | stat=$? 94 | fi 95 | return $stat 96 | } 97 | 98 | if [[ -n "$STATIC_IP" ]]; then 99 | if valid_ip "$STATIC_IP"; then 100 | echo "$STATIC_IP" >${DAPPNODE_DIR}/config/static_ip 101 | else 102 | echo "The static IP provided: ${STATIC_IP} is not valid." 103 | exit 1 104 | fi 105 | fi 106 | 107 | # Load profile 108 | [ -f $DAPPNODE_PROFILE ] || ${WGET} -O ${DAPPNODE_PROFILE} ${PROFILE_URL} 109 | # shellcheck disable=SC1090 110 | source "${DAPPNODE_PROFILE}" 111 | 112 | # The indirect variable expansion used in ${!ver##*:} allows us to use versions like 'dev:development' 113 | # If such variable with 'dev:'' suffix is used, then the component is built from specified branch or commit. 114 | # you can also specify an IPFS version like /ipfs/QmWg8P2b9JKQ8thAVz49J8SbJbCoi2MwkHnUqMtpzDTtxR:0.2.7, it's important 115 | # to include the exact version also in the IPFS hash format since it's needed to be able to download it 116 | determine_packages 117 | for comp in "${PKGS[@]}"; do 118 | ver="${comp}_VERSION" 119 | DOWNLOAD_URL="https://github.com/dappnode/DNP_${comp}/releases/download/v${!ver}" 120 | if [[ ${!ver} == /ipfs/* ]]; then 121 | DOWNLOAD_URL="${IPFS_ENDPOINT}/api/v0/cat?arg=${!ver%:*}" 122 | fi 123 | eval "${comp}_URL=\"${DOWNLOAD_URL}/${comp,,}.dnp.dappnode.eth_${!ver##*:}_linux-${ARCH}.txz\"" 124 | eval "${comp}_YML=\"${DOWNLOAD_URL}/docker-compose.yml\"" 125 | eval "${comp}_MANIFEST=\"${DOWNLOAD_URL}/dappnode_package.json\"" 126 | eval "${comp}_YML_FILE=\"${DAPPNODE_CORE_DIR}/docker-compose-${comp,,}.yml\"" 127 | eval "${comp}_FILE=\"${DAPPNODE_CORE_DIR}/${comp,,}.dnp.dappnode.eth_${!ver##*:}_linux-${ARCH}.txz\"" 128 | eval "${comp}_MANIFEST_FILE=\"${DAPPNODE_CORE_DIR}/dappnode_package-${comp,,}.json\"" 129 | done 130 | 131 | dappnode_core_build() { 132 | for comp in "${PKGS[@]}"; do 133 | ver="${comp}_VERSION" 134 | if [[ ${!ver} == dev:* ]]; then 135 | echo "Cloning & building DNP_${comp}..." 136 | if ! dpkg -s git >/dev/null 2>&1; then 137 | apt-get install -y git 138 | fi 139 | TMPDIR=$(mktemp -d) 140 | pushd "$TMPDIR" || { echo "Error on pushd"; exit 1; } 141 | git clone -b "${!ver##*:}" https://github.com/dappnode/DNP_"${comp}" 142 | # Change version in YAML to the custom one 143 | DOCKER_VER=$(echo "${!ver##*:}" | sed 's/\//_/g') 144 | sed -i "s~^\(\s*image\s*:\s*\).*~\1${comp,,}.dnp.dappnode.eth:${DOCKER_VER}~" DNP_"${comp}"/docker-compose.yml 145 | docker-compose -f ./DNP_"${comp}"/docker-compose.yml build 146 | cp ./DNP_"${comp}"/docker-compose.yml "${DAPPNODE_CORE_DIR}"/docker-compose-"${comp,,}".yml 147 | cp ./DNP_"${comp}"/dappnode_package.json "${DAPPNODE_CORE_DIR}"/dappnode_package-"${comp,,}".json 148 | rm -r ./DNP_"${comp}" 149 | popd || { echo "Error on popd"; exit 1; } 150 | fi 151 | done 152 | } 153 | 154 | dappnode_core_download() { 155 | for comp in "${PKGS[@]}"; do 156 | ver="${comp}_VERSION" 157 | if [[ ${!ver} != dev:* ]]; then 158 | # Download DAppNode Core Images if it's needed 159 | echo "Downloading ${comp} tar..." 160 | eval "[ -f \$${comp}_FILE ] || $WGET -O \$${comp}_FILE \$${comp}_URL || exit 1" 161 | # Download DAppNode Core docker-compose yml files if it's needed 162 | echo "Downloading ${comp} yml..." 163 | eval "[ -f \$${comp}_YML_FILE ] || $WGET -O \$${comp}_YML_FILE \$${comp}_YML || exit 1"; 164 | # Download DAppNode Core manifest files if it's needed 165 | echo "Downloading ${comp} manifest..." 166 | eval "[ -f \$${comp}_MANIFEST_FILE ] || $WGET -O \$${comp}_MANIFEST_FILE \$${comp}_MANIFEST || exit 1"; 167 | fi 168 | done 169 | } 170 | 171 | dappnode_core_load() { 172 | for comp in "${PKGS[@]}"; do 173 | ver="${comp}_VERSION" 174 | if [[ ${!ver} != dev:* ]]; then 175 | eval "[ ! -z \$(docker images -q ${comp,,}.dnp.dappnode.eth:${!ver##*:}) ] || docker load -i \$${comp}_FILE 2>&1 | tee -a \$LOGFILE" 176 | fi 177 | done 178 | } 179 | 180 | customMotd() { 181 | if [ -f ${MOTD_FILE} ]; then 182 | cat <${MOTD_FILE} 183 | ___ _ _ _ _ 184 | | \ /_\ _ __ _ __| \| |___ __| |___ 185 | | |) / _ \| '_ \ '_ \ . / _ \/ _ / -_) 186 | |___/_/ \_\ .__/ .__/_|\_\___/\__,_\___| 187 | |_| |_| 188 | EOF 189 | fi 190 | } 191 | 192 | addSwap() { 193 | # Is swap enabled? 194 | IS_SWAP=$(swapon --show | wc -l) 195 | 196 | # if not then create it 197 | if [ "$IS_SWAP" -eq 0 ]; then 198 | echo -e '\e[32mSwap not found. Adding swapfile.\e[0m' 199 | #RAM=$(awk '/MemTotal/ {print $2}' /proc/meminfo) 200 | #SWAP=$(($RAM * 2)) 201 | SWAP=8388608 202 | fallocate -l ${SWAP}k /swapfile 203 | chmod 600 /swapfile 204 | mkswap /swapfile 205 | swapon /swapfile 206 | echo '/swapfile none swap defaults 0 0' >>/etc/fstab 207 | else 208 | echo -e '\e[32mSwap found. No changes made.\e[0m' 209 | fi 210 | } 211 | 212 | dappnode_start() { 213 | echo -e "\e[32mDAppNode starting...\e[0m" 2>&1 | tee -a $LOGFILE 214 | # shellcheck disable=SC1090 215 | source "${DAPPNODE_PROFILE}" >/dev/null 2>&1 216 | 217 | # Execute `compose-up` independently 218 | # To execute `compose-up` against more than 1 compose, composes files must share compose file version (e.g 3.5) 219 | for comp in "${DNCORE_YMLS_ARRAY[@]}"; do 220 | docker-compose -f "$comp" up -d 2>&1 | tee -a $LOGFILE 221 | echo "${comp} started" 2>&1 | tee -a $LOGFILE 222 | done 223 | echo -e "\e[32mDAppNode started\e[0m" 2>&1 | tee -a $LOGFILE 224 | 225 | # Show credentials to the user on login 226 | USER=$(grep 1000 /etc/passwd | cut -f 1 -d:) 227 | [ -n "$USER" ] && PROFILE=/home/$USER/.profile || PROFILE=/root/.profile 228 | 229 | if ! grep -q "${DAPPNODE_PROFILE}" "$PROFILE"; then 230 | echo "######## DAPPNODE PROFILE ########" >>$PROFILE 231 | echo -e "source ${DAPPNODE_PROFILE}\n" >>$PROFILE 232 | fi 233 | 234 | sed -i '/return/d' $DAPPNODE_PROFILE | tee -a $LOGFILE 235 | 236 | if ! grep -q "$DAPPNODE_ACCESS_CREDENTIALS" "$DAPPNODE_PROFILE"; then 237 | [ -f $DAPPNODE_ACCESS_CREDENTIALS ] || ${WGET} -O ${DAPPNODE_ACCESS_CREDENTIALS} ${DAPPNODE_ACCESS_CREDENTIALS_URL} 238 | # shellcheck disable=SC2216 239 | sed -i "/return/i /bin/bash $DAPPNODE_ACCESS_CREDENTIALS" $DAPPNODE_PROFILE | echo "/bin/bash $DAPPNODE_ACCESS_CREDENTIALS" >>$DAPPNODE_PROFILE 240 | fi 241 | 242 | # Delete dappnode_install.sh execution from rc.local if exists, and is not the unattended firstboot 243 | if [ -f "/etc/rc.local" ] && [ ! -f "/usr/src/dappnode/.firstboot" ]; then 244 | sed -i '/\/usr\/src\/dappnode\/scripts\/dappnode_install.sh/d' /etc/rc.local 2>&1 | tee -a $LOGFILE 245 | fi 246 | 247 | # Display credentials to the user 248 | [ -f $DAPPNODE_ACCESS_CREDENTIALS ] && /bin/bash $DAPPNODE_ACCESS_CREDENTIALS 249 | } 250 | 251 | installExtraDpkg() { 252 | if [ -d "/usr/src/dappnode/extra_dpkg" ]; then 253 | dpkg -i /usr/src/dappnode/iso/extra_dpkg/*.deb 2>&1 | tee -a $LOGFILE 254 | fi 255 | } 256 | 257 | grabContentHashes() { 258 | if [ ! -f "${CONTENT_HASH_FILE}" ]; then 259 | for comp in "${CONTENT_HASH_PKGS[@]}"; do 260 | CONTENT_HASH=$(eval "${SWGET}" https://github.com/dappnode/DAppNodePackage-"${comp}"/releases/latest/download/content-hash) 261 | if [ -z "$CONTENT_HASH" ]; then 262 | echo "ERROR! Failed to find content hash of ${comp}." 2>&1 | tee -a $LOGFILE 263 | exit 1 264 | fi 265 | echo "${comp}.dnp.dappnode.eth,${CONTENT_HASH}" >>${CONTENT_HASH_FILE} 266 | done 267 | fi 268 | } 269 | 270 | # /sgx will only be installed on ISO's dappnode not on standalone script 271 | installSgx() { 272 | if [ -d "/usr/src/dappnode/iso/sgx" ]; then 273 | # from sgx_linux_x64_driver_2.5.0_2605efa.bin 274 | /usr/src/dappnode/iso/sgx/sgx_linux_x64_driver.bin 2>&1 | tee -a $LOGFILE 275 | /usr/src/dappnode/iso/sgx/enable_sgx 2>&1 | tee -a $LOGFILE 276 | fi 277 | } 278 | 279 | # /extra_dpkg will only be installed on ISO's dappnode not on standalone script 280 | installExtraDpkg() { 281 | if [ -d "/usr/src/dappnode/iso/extra_dpkg" ]; then 282 | dpkg -i /usr/src/dappnode/extra_dpkg/*.deb 2>&1 | tee -a $LOGFILE 283 | fi 284 | } 285 | 286 | ############################################## 287 | #### SCRIPT START #### 288 | ############################################## 289 | 290 | echo -e "\e[32m\n##############################################\e[0m" 2>&1 | tee -a $LOGFILE 291 | echo -e "\e[32m#### DAPPNODE INSTALLER ####\e[0m" 2>&1 | tee -a $LOGFILE 292 | echo -e "\e[32m##############################################\e[0m" 2>&1 | tee -a $LOGFILE 293 | 294 | echo -e "\e[32mCreating swap memory...\e[0m" 2>&1 | tee -a $LOGFILE 295 | addSwap 296 | 297 | echo -e "\e[32mCustomizing login...\e[0m" 2>&1 | tee -a $LOGFILE 298 | customMotd 299 | 300 | echo -e "\e[32mInstalling extra packages...\e[0m" 2>&1 | tee -a $LOGFILE 301 | installExtraDpkg 302 | 303 | echo -e "\e[32mGrabbing latest content hashes...\e[0m" 2>&1 | tee -a $LOGFILE 304 | grabContentHashes 305 | 306 | if [ "$ARCH" == "amd64" ]; then 307 | echo -e "\e[32mInstalling SGX modules...\e[0m" 2>&1 | tee -a $LOGFILE 308 | installSgx 309 | 310 | echo -e "\e[32mInstalling extra packages...\e[0m" 2>&1 | tee -a $LOGFILE 311 | installExtraDpkg 312 | fi 313 | 314 | echo -e "\e[32mCreating dncore_network if needed...\e[0m" 2>&1 | tee -a $LOGFILE 315 | docker network create --driver bridge --subnet 172.33.0.0/16 dncore_network 2>&1 | tee -a $LOGFILE 316 | 317 | echo -e "\e[32mBuilding DAppNode Core if needed...\e[0m" 2>&1 | tee -a $LOGFILE 318 | dappnode_core_build 319 | 320 | echo -e "\e[32mDownloading DAppNode Core...\e[0m" 2>&1 | tee -a $LOGFILE 321 | dappnode_core_download 322 | 323 | echo -e "\e[32mLoading DAppNode Core...\e[0m" 2>&1 | tee -a $LOGFILE 324 | dappnode_core_load 325 | 326 | if [ ! -f "/usr/src/dappnode/.firstboot" ]; then 327 | echo -e "\e[32mDAppNode installed\e[0m" 2>&1 | tee -a $LOGFILE 328 | dappnode_start 329 | fi 330 | 331 | # Run test in interactive terminal 332 | if [ -f "/usr/src/dappnode/.firstboot" ]; then 333 | openvt -s -w -- sudo -u root /usr/src/dappnode/scripts/dappnode_test_install.sh 334 | exit 0 335 | fi 336 | 337 | exit 0 338 | -------------------------------------------------------------------------------- /scripts/dappnode_install_pre.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Execute script with flag UPDATE to update the host: ./dappnode_install_pre.sh UPDATE 4 | 5 | DAPPNODE_DIR="/usr/src/dappnode" 6 | LOGS_DIR="$DAPPNODE_DIR/logs" 7 | DOCKER_PKG="docker-ce_20.10.6~3-0~debian-bullseye_amd64.deb" 8 | DOCKER_CLI_PKG="docker-ce-cli_20.10.6~3-0~debian-bullseye_amd64.deb" 9 | CONTAINERD_PKG="containerd.io_1.4.4-1_amd64.deb" 10 | DOCKER_REPO="https://download.docker.com/linux/debian/dists/bullseye/pool/stable/amd64" 11 | DOCKER_PATH="${DAPPNODE_DIR}/bin/docker/${DOCKER_PKG}" 12 | DOCKER_CLI_PATH="${DAPPNODE_DIR}/bin/docker/${DOCKER_CLI_PKG}" 13 | CONTAINERD_PATH="${DAPPNODE_DIR}/bin/docker/${CONTAINERD_PKG}" 14 | DCMP_PATH="/usr/local/bin/docker-compose" 15 | DOCKER_URL="${DOCKER_REPO}/${DOCKER_PKG}" 16 | DOCKER_CLI_URL="${DOCKER_REPO}/${DOCKER_CLI_PKG}" 17 | CONTAINERD_URL="${DOCKER_REPO}/${CONTAINERD_PKG}" 18 | DCMP_URL="https://github.com/docker/compose/releases/download/1.25.5/docker-compose-Linux-x86_64" 19 | WGET="wget -q --show-progress --progress=bar:force" 20 | 21 | #!ISOBUILD Do not modify, variables above imported for ISO build 22 | 23 | detect_installation_type() { 24 | if [ -f "${DAPPNODE_DIR}/iso_install.log" ]; then 25 | LOG_FILE="${LOGS_DIR}/iso_install.log" 26 | rm -f "${DAPPNODE_DIR}/iso_install.log" 27 | ISO_INSTALLATION=true 28 | else 29 | LOG_FILE="${LOGS_DIR}/install.log" 30 | ISO_INSTALLATION=false 31 | fi 32 | } 33 | 34 | # DOCKER INSTALLATION 35 | install_docker() { 36 | # STEP 0: Detect if it's a Debian 9 (stretch) or Debian 10 (Buster) installation 37 | # ---------------------------------------- 38 | if [ -f "/etc/os-release" ] && grep -q "buster" "/etc/os-release"; then 39 | DOCKER_PKG="docker-ce_20.10.2~3-0~debian-buster_amd64.deb" 40 | DOCKER_CLI_PKG="docker-ce-cli_20.10.2~3-0~debian-buster_amd64.deb" 41 | CONTAINERD_PKG="containerd.io_1.4.3-1_amd64.deb" 42 | DOCKER_REPO="https://download.docker.com/linux/debian/dists/buster/pool/stable/amd64" 43 | DOCKER_PATH="${DAPPNODE_DIR}/bin/docker/${DOCKER_PKG}" 44 | DOCKER_CLI_PATH="${DAPPNODE_DIR}/bin/docker/${DOCKER_CLI_PKG}" 45 | CONTAINERD_PATH="${DAPPNODE_DIR}/bin/docker/${CONTAINERD_PKG}" 46 | DOCKER_URL="${DOCKER_REPO}/${DOCKER_PKG}" 47 | DOCKER_CLI_URL="${DOCKER_REPO}/${DOCKER_CLI_PKG}" 48 | CONTAINERD_URL="${DOCKER_REPO}/${CONTAINERD_PKG}" 49 | elif [ -f "/etc/os-release" ] && grep -q "stretch" "/etc/os-release"; then 50 | DOCKER_PKG="docker-ce_19.03.8~3-0~debian-stretch_amd64.deb" 51 | DOCKER_CLI_PKG="docker-ce-cli_19.03.8~3-0~debian-stretch_amd64.deb" 52 | CONTAINERD_PKG="containerd.io_1.2.6-3_amd64.deb" 53 | DOCKER_REPO="https://download.docker.com/linux/debian/dists/stretch/pool/stable/amd64" 54 | DOCKER_PATH="${DAPPNODE_DIR}/bin/docker/${DOCKER_PKG}" 55 | DOCKER_CLI_PATH="${DAPPNODE_DIR}/bin/docker/${DOCKER_CLI_PKG}" 56 | CONTAINERD_PATH="${DAPPNODE_DIR}/bin/docker/${CONTAINERD_PKG}" 57 | DOCKER_URL="${DOCKER_REPO}/${DOCKER_PKG}" 58 | DOCKER_CLI_URL="${DOCKER_REPO}/${DOCKER_CLI_PKG}" 59 | CONTAINERD_URL="${DOCKER_REPO}/${CONTAINERD_PKG}" 60 | fi 61 | 62 | # STEP 1: Download files 63 | # ---------------------------------------- 64 | [ -f $DOCKER_PATH ] || $WGET -O $DOCKER_PATH $DOCKER_URL 65 | [ -f $DOCKER_CLI_PATH ] || $WGET -O $DOCKER_CLI_PATH $DOCKER_CLI_URL 66 | [ -f $CONTAINERD_PATH ] || $WGET -O $CONTAINERD_PATH $CONTAINERD_URL 67 | 68 | # STEP 2: Install packages 69 | # ---------------------------------------- 70 | dpkg -i $CONTAINERD_PATH 2>&1 | tee -a $LOG_FILE 71 | dpkg -i $DOCKER_CLI_PATH 2>&1 | tee -a $LOG_FILE 72 | dpkg -i $DOCKER_PATH 2>&1 | tee -a $LOG_FILE 73 | 74 | # Ensure xz is installed 75 | [ -f "/usr/bin/xz" ] || (apt-get update -y && apt-get install -y xz-utils) 76 | 77 | USER=$(grep 1000 "/etc/passwd" | cut -f 1 -d:) 78 | [ -z "$USER" ] || usermod -aG docker "$USER" 79 | 80 | # Disable check if ISO installation since it is not possible to check in this way 81 | if [ "$ISO_INSTALLATION" = "false" ]; then 82 | # Validate the installation of docker 83 | if docker -v; then 84 | echo -e "\e[32m \n\n Verified docker installation \n\n \e[0m" 2>&1 | tee -a $LOG_FILE 85 | else 86 | echo -e "\e[31m \n\n ERROR: docker is not installed \n\n Please re-install it \n\n \e[0m" 2>&1 | tee -a $LOG_FILE 87 | exit 1 88 | fi 89 | fi 90 | } 91 | 92 | # DOCKER COMPOSE INSTALLATION 93 | install_docker_compose() { 94 | # STEP 0: Declare paths and directories 95 | # ---------------------------------------- 96 | 97 | # Ensure paths exist 98 | mkdir -p "$(dirname "$DCMP_PATH")" 2>&1 | tee -a $LOG_FILE 99 | 100 | # STEP 1: Download files 101 | # ---------------------------------------- 102 | 103 | [ -f $DCMP_PATH ] || $WGET -O $DCMP_PATH $DCMP_URL 104 | # Give permissions 105 | chmod +x $DCMP_PATH 2>&1 | tee -a $LOG_FILE 106 | 107 | # Disable check if ISO installation since it is not possible to check in this way 108 | if [ "$ISO_INSTALLATION" = "false" ]; then 109 | # Validate the installation of docker-compose 110 | if docker-compose -v; then 111 | echo -e "\e[32m \n\n Verified docker-compose installation \n\n \e[0m" 2>&1 | tee -a $LOG_FILE 112 | else 113 | echo -e "\e[31m \n\n ERROR: docker-compose is not installed \n\n Please re-install it \n\n \e[0m" 2>&1 | tee -a $LOG_FILE 114 | exit 1 115 | fi 116 | fi 117 | } 118 | 119 | # WIREGUARD INSTALLATION 120 | install_wireguard_dkms() { 121 | apt-get update -y 122 | if [ -f "/etc/os-release" ] && grep -q "buster" "/etc/os-release"; then 123 | echo "deb http://deb.debian.org/debian/ buster-backports main" > /etc/apt/sources.list.d/buster-backports.list 124 | printf 'Package: *\nPin: release a=buster-backports\nPin-Priority: 90\n' > /etc/apt/preferences.d/limit-backports 125 | fi 126 | 127 | apt-get install wireguard-dkms -y | tee -a $LOG_FILE 128 | 129 | if modprobe wireguard >/dev/null 2>&1 ; then 130 | echo -e "\e[32m \n\n Verified wiregurd-dkms installation \n\n \e[0m" 2>&1 | tee -a $LOG_FILE 131 | else 132 | echo -e "\e[31m \n\n WARNING: wireguard kernel module is not installed, Wireguard DAppNode package might not work! \n\n \e[0m" 2>&1 | tee -a $LOG_FILE 133 | fi 134 | } 135 | 136 | # LSOF INSTALLATION 137 | install_lsof() { 138 | apt-get update -y 139 | apt-get install lsof -y | tee -a $LOG_FILE 140 | if lsof -v >/dev/null 2>&1 ; then 141 | echo -e "\e[32m \n\n Verified lsof installation \n\n \e[0m" 2>&1 | tee -a $LOG_FILE 142 | else 143 | echo -e "\e[31m \n\n WARNING: lsof not installed, HTTPS DAppNode package might not be installed! \n\n \e[0m" 2>&1 | tee -a $LOG_FILE 144 | fi 145 | } 146 | 147 | # HOST UPDATE 148 | host_update () { 149 | apt-get update 2>&1 | tee -a $LOG_FILE 150 | apt-get -y upgrade 2>&1 | tee -a $LOG_FILE 151 | } 152 | 153 | ############################################## 154 | #### SCRIPT START #### 155 | ############################################## 156 | 157 | detect_installation_type 158 | 159 | # Ensure paths exist 160 | mkdir -p $DAPPNODE_DIR 161 | mkdir -p $LOGS_DIR 162 | mkdir -p "$(dirname "$DOCKER_PATH")" 163 | 164 | touch $LOG_FILE 165 | 166 | # Only update && upgrade host if needed 167 | if [ "$1" == "UPDATE" ]; then 168 | echo -e "\e[32m \n\n Updating && upgrading host \n\n \e[0m" 2>&1 | tee -a $LOG_FILE 169 | host_update 2>&1 | tee -a $LOG_FILE 170 | fi 171 | 172 | # Only install docker if needed 173 | if docker -v >/dev/null 2>&1; then 174 | echo -e "\e[32m \n\n docker is already installed \n\n \e[0m" 2>&1 | tee -a $LOG_FILE 175 | else 176 | install_docker 2>&1 | tee -a $LOG_FILE 177 | fi 178 | 179 | # Only install docker-compose if needed 180 | if docker-compose -v >/dev/null 2>&1; then 181 | echo -e "\e[32m \n\n docker-compose is already installed \n\n \e[0m" 2>&1 | tee -a $LOG_FILE 182 | else 183 | install_docker_compose 2>&1 | tee -a $LOG_FILE 184 | fi 185 | 186 | # Only install wireguard-dkms if needed 187 | if modprobe wireguard >/dev/null 2>&1 ; then 188 | echo -e "\e[32m \n\n wireguard-dkms is already installed \n\n \e[0m" 2>&1 | tee -a $LOG_FILE 189 | else 190 | install_wireguard_dkms 2>&1 | tee -a $LOG_FILE 191 | fi 192 | 193 | # Only install lsof if needed 194 | if lsof -v >/dev/null 2>&1; then 195 | echo -e "\e[32m \n\n lsof is already installed \n\n \e[0m" 2>&1 | tee -a $LOG_FILE 196 | else 197 | install_lsof 2>&1 | tee -a $LOG_FILE 198 | fi 199 | 200 | #Check connectivity 201 | { [ -f /etc/network/interfaces ] && grep "iface en.* inet dhcp" /etc/network/interfaces &>/dev/null; } || { echo "Interfaces not found"; exit 1; } 202 | 203 | ## Add missing interfaces 204 | if [ -f /usr/src/dappnode/hotplug ]; then 205 | # shellcheck disable=SC2013 206 | for IFACE in $(grep "en.*" /usr/src/dappnode/hotplug); do 207 | # shellcheck disable=SC2143 208 | if [[ $(grep -L "$IFACE" /etc/network/interfaces) ]]; then 209 | { echo "# $IFACE"; echo "allow-hotplug $IFACE"; echo "iface $IFACE inet dhcp"; } >> /etc/network/interfaces 210 | fi 211 | done 212 | fi 213 | -------------------------------------------------------------------------------- /scripts/dappnode_test_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | HOME=${HOME:-/home/dappnode} 4 | DAPPNODE_DIR="/usr/src/dappnode" 5 | 6 | error_exit() { 7 | echo -e "\e[31m Error on installation!!! \n \e[0m" 8 | read -r -p "Check installation source. Press enter to continue" 9 | exit 1 10 | } 11 | SERIAL=$(dmidecode -s system-serial-number) 12 | echo "DAppNode Installation Test" 13 | date 14 | echo "Serial: ${SERIAL}" 15 | echo "################################" 16 | 17 | # TEMPORARY: think a way to integrate flags instead of use files to detect installation type 18 | detect_installation_type() { 19 | # Check for old and new location of iso_install.log 20 | if [ -f "${DAPPNODE_DIR}/iso_install.log" ] || [ -f "${DAPPNODE_DIR}/logs/iso_install.log" ]; then 21 | components=(BIND IPFS WIREGUARD DAPPMANAGER WIFI HTTPS) 22 | fi 23 | } 24 | 25 | components=(BIND IPFS VPN DAPPMANAGER WIFI) 26 | detect_installation_type 27 | if ping -c 1 -q google.com >&/dev/null; then 28 | echo -e "\e[32m Connectivity OK\n \e[0m" 29 | else 30 | error_exit 31 | fi 32 | 33 | if docker -v >/dev/null 2>&1; then 34 | echo -e "\e[32m Docker installed ok\e[0m" 35 | else 36 | error_exit 37 | fi 38 | 39 | if docker-compose -v >/dev/null 2>&1; then 40 | echo -e "\e[32m docker-compose installed ok\e[0m" 41 | else 42 | error_exit 43 | fi 44 | 45 | for comp in "${components[@]}"; do 46 | if docker images | grep "${comp,,}" >/dev/null 2>&1; then 47 | echo -e "\e[32m ${comp} docker image loaded ok\e[0m" 48 | else 49 | echo -e "\e[31m ${comp} docker image not loaded ok!\e[0m" 50 | error_exit 51 | fi 52 | done 53 | 54 | echo -e "\e[32m docker image versions:\e[0m" 55 | docker images | grep dappnode | awk '{print $1, $2}' 56 | 57 | echo -e "\e[32m doing docker image integrity test...\e[0m" 58 | imgs=$(docker images | grep dappnode | awk '{print $3}') 59 | 60 | for img in $imgs; do 61 | docker save $img >/dev/null && echo -ne "\e[32mImage $img OK\n\e[0m" || echo "\e[31mImage $img Corrupted!\n\e[0m" 62 | done 63 | 64 | rm -f /usr/src/dappnode/.firstboot 65 | read -r -p "Test completed successfully. Press enter to continue" 66 | -------------------------------------------------------------------------------- /scripts/dappnode_uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | DAPPNODE_DIR="/usr/src/dappnode" 3 | DAPPNODE_CORE_DIR="${DAPPNODE_DIR}/DNCORE" 4 | PROFILE_FILE="${DAPPNODE_CORE_DIR}/.dappnode_profile" 5 | input=$1 # Allow to call script with argument (must be Y/N) 6 | 7 | [ -f $PROFILE_FILE ] || ( 8 | echo "Error: DAppNode profile does not exist." 9 | exit 1 10 | ) 11 | 12 | uninstall() { 13 | # shellcheck disable=SC1090 14 | source "${PROFILE_FILE}" &>/dev/null 15 | 16 | # Stop DAppNode containers 17 | docker container stop "$(docker ps --format '{{.Names}}' | grep DAppNode)" || echo "containers already stopped" 18 | # Remove DAppNode containers 19 | docker container rm "$(docker ps -a --format '{{.Names}}' | grep DAppNode)" || echo "containers already removed" 20 | # Remove DAppNode images 21 | docker image rm "$(docker image ls -a | grep "dappnode")" || echo "images already removed" 22 | # Remove DAppNode volumes 23 | docker volume rm "$(docker volume ls | grep "dappnode\|dncore")" || echo "packages already removed" 24 | 25 | # Remove containers, volumes and images 26 | docker-compose "$DNCORE_YMLS" down --rmi 'all' -v || echo "packages already removed" 27 | 28 | # Remove dncore_network 29 | docker network remove dncore_network || echo "dncore_network already removed" 30 | 31 | # Remove dir 32 | rm -rf /usr/src/dappnode 33 | 34 | # Remove profile file 35 | USER=$(grep 1000 /etc/passwd | cut -f 1 -d:) 36 | [ -n "$USER" ] && PROFILE=/home/$USER/.profile || PROFILE=/root/.profile 37 | sed -i '/######## DAPPNODE PROFILE ########/g' $PROFILE 38 | sed -i '/.*dappnode_profile/g' $PROFILE 39 | 40 | echo "DAppNode uninstalled!" 41 | } 42 | 43 | if [ $# -eq 0 ]; then 44 | read -r -p "WARNING: This script will uninstall and delete all DAppNode 45 | containers and volumes. Are You Sure? [Y/n] " input <&2 46 | fi 47 | 48 | 49 | case $input in 50 | [yY][eE][sS] | [yY]) 51 | uninstall 52 | ;; 53 | [nN][oO] | [nN]) 54 | echo "Ok." 55 | ;; 56 | *) 57 | echo "Invalid input. Exiting..." 58 | exit 1 59 | ;; 60 | esac 61 | -------------------------------------------------------------------------------- /scripts/rc.local: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # 3 | # rc.local 4 | # 5 | # This script is executed at the end of each multiuser runlevel. 6 | # Make sure that the script will "exit 0" on success or any other 7 | # value on error. 8 | # 9 | # In order to enable or disable this script just change the execution 10 | # bits. 11 | # 12 | # By default this script does nothing. 13 | 14 | /usr/src/dappnode/scripts/dappnode_install.sh 15 | 16 | exit 0 -------------------------------------------------------------------------------- /scripts/static_ip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This is a debconf-compatible script 3 | . /usr/share/debconf/confmodule 4 | 5 | valid_ip () { 6 | local ip=$1 7 | 8 | if [[ -z $ip ]]; then 9 | return 0 10 | fi 11 | 12 | if expr "$ip" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then 13 | for i in 1 2 3 4; do 14 | if [ $(echo "$ip" | cut -d. -f$i) -gt 255 ]; then 15 | return 1 16 | fi 17 | done 18 | return 0 19 | else 20 | return 1 21 | fi 22 | } 23 | 24 | # Create the template file 25 | cat > /tmp/ip.template <<'!EOF!' 26 | Template: ip-question/ask 27 | Type: string 28 | Description: If your public IP is dynamic, or you don't know, leave this field blank and continue. 29 | DAppNode needs to know the public IP of your node. 30 | 31 | Template: ip-question/title 32 | Type: text 33 | Description: Your public IP. 34 | 35 | Template: ip-question/finished 36 | Type: text 37 | Description: Finished. 38 | !EOF! 39 | 40 | cat > /tmp/ip_fail.template <<'!EOF!' 41 | Template: ip-fail/ask 42 | Type: note 43 | Description: This is not a valid IP. 44 | 45 | Template: ip-fail/title 46 | Type: text 47 | Description: Wrong IP 48 | !EOF! 49 | 50 | db_dialog () { 51 | debconf-loadtemplate ip-question /tmp/ip.template 52 | db_settitle ip-question/title 53 | db_input critical ip-question/ask 54 | db_go 55 | db_get ip-question/ask 56 | 57 | valid_ip $RET 58 | if [[ $? -eq 0 ]]; then 59 | mkdir -p /target/usr/src/dappnode/config 60 | echo "$RET" > /target/usr/src/dappnode/config/static_ip 61 | else 62 | debconf-loadtemplate ip-fail /tmp/ip_fail.template 63 | db_settitle ip-fail/title 64 | db_input critical ip-fail/ask 65 | db_go 66 | db_get ip-fail/ask 67 | # Ask again until done 68 | db_dialog 69 | fi 70 | db_settitle ip-question/title 71 | } 72 | 73 | db_restore () { 74 | debconf-loadtemplate ip-question /tmp/ip.template 75 | db_settitle ip-question/restore 76 | } 77 | 78 | db_dialog 79 | db_restore -------------------------------------------------------------------------------- /test/environment_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################### 4 | #dappnode_install_pre.sh# 5 | ######################### 6 | 7 | # Docker should be uninstalled 8 | # apt-get purge docker-ce docker-ce-cli containerd.io ==> NOT able to uninstall docker on github host 9 | 10 | # Create necessary folder 11 | mkdir -p /etc/network/ 12 | echo "iface en.x inet dhcp" >> /etc/network/interfaces 13 | 14 | ########################## 15 | #dappnode_test_install.sh# 16 | ########################## 17 | 18 | ## Not able to do ping inside github host --------------------------------------------------------------------------------