#!/usr/bin/env zsh # Copyright (c) 2017 Dyne.org Foundation # # decode.blend is written and maintained by Ivan J. # # This source code is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this source code. If not, see . ## libdevuansdk build script for decode-os source "$R/../config" blend_preinst() { fn blend_preinst req=(strapdir) ckreq || return 1 notice "executing $blend_name preinst" add-user decode decode } blend_postinst() { fn blend_postinst req=(strapdir) ckreq || return 1 notice "executing $blend_name postinst" nopackage=(musl tomb golang netdata mongodb multichain) for app in $nopackage; do blend_install_${app} || zerr done || zerr notice "copying rootfs-overlay" rootfs_overlay_path="$R/../rootfs-overlay" sudo cp -rav "${rootfs_overlay_path}/*" "${strapdir}/" blend_finalize || zerr } ## {{{ blend_install_musl() blend_install_musl() { fn blend_install_musl req=(strapdir musl_version musl_url) ckreq || return 1 notice "cloning musl gits" sudo git clone "$musl_url" "$strapdir/root/musl" || zerr notice "installing musl in $strapdir" cat </dev/null #!/bin/sh cd /root/musl git checkout ${musl_version} ./configure && \ make ${MAKEOPTS} && make install || exit 1 cd .. rm -rf musl EOF chroot-script install-musl || zerr } ## }}} ## {{{ blend_install_tomb() blend_install_tomb() { fn blend_install_tomb req=(strapdir tomb_version tomb_url) ckreq || return 1 notice "cloning tomb gits" sudo git clone "$tomb_url" "$strapdir/root/tomb" || zerr notice "installing tomb in $strapdir" cat </dev/null #!/bin/sh cd /root/tomb git checkout ${tomb_version} make install cd extras/kdf-keys make && make install || exit 1 cd /root rm -rf tomb EOF chroot-script install-tomb || zerr } ## }}} ## {{{ blend_install_golang() blend_install_golang() { fn blend_install_golang req=(strapdir golang_version golang_arch golang_url) ckreq || return 1 notice "grabbing golang tarball" sudo curl -o "$strapdir/usr/local/go.tgz" "${golang_url}" notice "unpacking golang in $strapdir" cat </dev/null #!/bin/sh cd /usr/local tar xvf go.tgz rm -f go.tgz EOF chroot-script install-golang || zerr } ## }}} ## {{{ blend_install_netdata() blend_install_netdata() { fn blend_install_netdata req=(strapdir netdata_version netdata_url) ckreq || return 1 notice "downloading netdata tarball" sudo wget -O "$strapdir/root/netdata.tgz" "$netdata_url" || zerr notice "installing netdata in $strapdir" cat </dev/null #!/bin/sh cd /root tar xvf netdata.tgz || exit 1 cd netdata-${netdata_version} ./netdata-installer.sh --dont-wait --dont-start-it || exit 1 cd .. rm -rf netdata.tgz netdata-${netdata_version} EOF chroot-script install-netdata || zerr } ## }}} ## {{{ blend_install_mongodb() blend_install_mongodb() { # XXX: should be a from-source build at a later point fn blend_install_mongodb req=(strapdir mongodb_version mongodb_url) ckreq || return 1 notice "downloading mongodb tarball" sudo wget -O "$strapdir/root/mongodb.tgz" "$mongodb_url" || zerr notice "installing mongodb in $strapdir" cat </dev/null #!/bin/sh cd /root tar xvf mongodb.tgz || exit 1 mv -v $(basename -s .tgz $mongodb_url)/bin/* /usr/local/bin/ rm -rf mongodb.tgz $(basename -s .tgz $mongodb_url) EOF chroot-script install-mongodb || zerr } ## }}} ## {{{ blend_install_multichain() blend_install_multichain() { fn blend_install_multichain req=(strapdir multichain_version multichain_url) ckreq || return 1 notice "downloading multichain tarball" sudo wget -O "$strapdir/root/multichain.tar.gz" "$multichain_url" || zerr notice "installing multichain in $strapdir" cat </dev/null #!/bin/sh cd /root tar xvf multichain.tar.gz || exit 1 cd multichain-${multichain_version} mv -v multichaind multichain-cli multichain-util /usr/local/bin/ cd .. rm -rf multichain.tar.gz multichain-${multichain_version} EOF chroot-script install-multichain || zerr } ## }}} ## {{{ blend_finalize() blend_finalize() { fn blend_finalize req=(strapdir) ckreq || return 1 cat </dev/null #!/bin/sh chsh -s /bin/bash decode for i in users ; do gpasswd -a decode \$i done sed -e 's/UsePAM yes/UsePAM no/' -i /etc/ssh/sshd_config ## misc rm -rf /usr/local/share/zsh/site-functions sed -i -e 's/devuan/decode/' /etc/hosts ## cleanup apt-get --yes --force-yes purge ${finalize_purge_packages} apt-get --yes --force-yes autoremove apt-get clean apt-get update cleanupfiles=" /var/log/bootstrap.log /var/log/dpkg.log /var/log/alternatives.log /var/log/fontconfig.log /var/log/apt /var/log/fsck /var/log/ConsoleKit /var/lib/polkit-1 " for i in \$cleanupfiles ; do rm -rf \$i done updatedb EOF chroot-script -d finalize || zerr } ## }}} ## {{{ conf_print_sorceslist() conf_print_sourceslist() { fn conf_print_sourceslist "(override)" cat <