├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── _config.yml ├── apps ├── Agar.io-Clone.sh ├── Ajenti.sh ├── Cloud9.sh ├── Cuberite.sh ├── Curvytron.sh ├── Deluge.sh ├── Dillinger.sh ├── Droppy.sh ├── EtherCalc.sh ├── EtherDraw.sh ├── Etherpad.sh ├── FreshRSS.sh ├── GateOne.sh ├── Ghost.sh ├── GitLab.sh ├── Gitea.sh ├── Gogs.sh ├── JSBin.sh ├── Jitsi-Meet.sh ├── KeystoneJS.sh ├── Laverna.sh ├── Lets-Chat.sh ├── Linx.sh ├── Mailpile.sh ├── Mattermost.sh ├── Modoboa.sh ├── Mopidy.sh ├── Mumble.sh ├── Nextcloud.sh ├── NodeBB.sh ├── OpenVPN.sh ├── OwnCloud.sh ├── ReactionCommerce.sh ├── Rocket.Chat.sh ├── Seafile.sh ├── StackEdit.sh ├── Syncthing.sh ├── Taiga.io.sh ├── TheLounge.sh ├── Transmission.sh ├── WP-Calypso.sh ├── Wagtail.sh ├── Webmin.sh ├── Wekan.sh ├── Wide.sh ├── WordPress.sh ├── dustship.sh └── netdata.sh ├── dplatform.sh ├── init.sh └── sysutils ├── Caddy.sh ├── Docker.sh ├── MongoDB.sh ├── Node.js.sh └── service.sh /.gitignore: -------------------------------------------------------------------------------- 1 | dp.cfg 2 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to DPlatform 2 | 3 | #### Thanks to your interest for the DPlatform project! This document is attended to provide advanced informations for people who wants to add their contribution to the DPlatform ShellCore of DPlatfor. 4 | 5 | ## Shell Style Guide 6 | 7 | DPlatform is made in a POSIX Shell script. Therefore, your contribution must comply to this following coding standards: 8 | - POSIX compliance (`#!/bin/sh`): all commands must work with sh, dash, bash, ksh, zsh 9 | - Unless required no semicolons 10 | - Indentation whenever is possible (for example except for `cat <&1 1>&2 2>&3) 27 | ``` 28 | 29 | Next, the prerequisites 30 | ```sh 31 | # Prerequisites of MyApp that have builtin support in DPlatform's sysutils, for example NodeJS or MongoDB 32 | . sysutils/Node.js.sh 33 | . sysutils/MongoDB.sh 34 | 35 | # Add MyApp user 36 | useradd -mrU myapp 37 | 38 | # Go to myapp user directory 39 | cd /home/myapp 40 | 41 | # Install MyApp dependencies, for example python, gcc... 42 | $install python gcc 43 | ``` 44 | 45 | Follows the install instructions, that depends of your app 46 | ```sh 47 | # If your app has a git repository 48 | git clone https://github.com/MyApp/MyApp 49 | 50 | # Download the archive 51 | download "https://myapp.com/myapp_v1.0.0.tar.gz -O myapp.tar.gz" "Downloading the archive..." 52 | 53 | # Extract the downloaded archive and remove it 54 | extract myapp.tar.gz "tar xzf -" "Extracting the files from the archive..." 55 | rm myapp.tgz 56 | 57 | cd MyApp 58 | ``` 59 | 60 | Here is the following variables that you can use for your installations commands 61 | ```sh 62 | $PKG={deb|rpm|pkg} 63 | $ARCHf={x86|arm} 64 | $ARCH={86|amd64|armv6|armv7|arm64} 65 | 66 | # Detect distribution (from /etc/os-release) 67 | $DIST={Debian|Ubuntu|Fedora|CentOS...} # $ID 68 | $DIST_VER={8|7|16.04|14.04|24|23|8|7|6...} # $VERSION_ID 69 | 70 | # Finally change the owner from root to myapp 71 | chown -R myapp: /home/myapp 72 | ``` 73 | 74 | Create a systemd service for your app 75 | ```sh 76 | # Create the systemd service 77 | cat > "/etc/systemd/system/myapp.service" < "/etc/systemd/system/agar.io-clone.service" < install.sh && bash install.sh 7 | 8 | whiptail --msgbox "Ajenti installed! 9 | 10 | Open http://$URL:8000 in your browser" 12 64 11 | -------------------------------------------------------------------------------- /apps/Cloud9.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$1" = update ] && { cd /home/cloud9; git pull origin master; sudo -u cloud9 scripts/install-sdk.sh; whiptail --msgbox "Cloud9 updated!" 8 32; break;} 4 | [ "$1" = remove ] && { sh sysutils/service.sh remove Cloud9; rm -rf /home/cloud9; userdel -rf cloud9; whiptail --msgbox "Cloud9 removed." 8 32; break; } 5 | 6 | # Defining the port 7 | port=$(whiptail --title "Cloud9 port" --inputbox "Set a port number for Cloud9" 8 48 "8181" 3>&1 1>&2 2>&3) 8 | port=${port:-8181} 9 | 10 | . sysutils/Node.js.sh 11 | 12 | $install gcc make sudo 13 | 14 | # Add cloud9 user 15 | useradd -rU cloud9 16 | 17 | cd /home 18 | git clone https://github.com/c9/core cloud9 19 | 20 | # Change the owner from root to ghost 21 | chown -R cloud9: cloud9 22 | 23 | # Install the sdk 24 | cd cloud9 25 | sudo -u cloud9 scripts/install-sdk.sh 26 | 27 | [ $IP = $LOCALIP ] && access=$IP || access=0.0.0.0 28 | 29 | # Add a systemd service and run the server 30 | sh $DIR/sysutils/service.sh Cloud9 "/usr/bin/node server.js -p $port -l $access -a" /home/cloud9 cloud9 31 | 32 | # Start the service and enable it to start at boot 33 | systemctl start cloud9 34 | systemctl enable cloud9 35 | 36 | whiptail --msgbox "Cloud9 installed! 37 | Open http://$URL:$port in your browser and register. 38 | The first users to register will be promoted to administrator." 12 64 39 | -------------------------------------------------------------------------------- /apps/Cuberite.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | sh -c "$(wget -O - https://raw.githubusercontent.com/cuberite/cuberite/master/easyinstall.sh)" 4 | 5 | whiptail --msgbox "Cuberite installed! 6 | 7 | You might need to open the Minecraft 25565 port 8 | 9 | WebAdmin at http://$URL:8080" 12 64 10 | -------------------------------------------------------------------------------- /apps/Curvytron.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$1" = update ] && { git -C /home/curvytron pull; git -C /home/curvytron reset --hard; chown -R curvytron: /home/curvytron; } 4 | [ "$1" = remove ] && { sh sysutils/service.sh remove Curvytron; userdel -rf curvytron; whiptail --msgbox "Curvytron removed." 8 32; break; } 5 | 6 | # Defining the port 7 | port=$(whiptail --title "Curvytron port" --inputbox "Set a port number for Curvytron" 8 48 "8086" 3>&1 1>&2 2>&3) 8 | 9 | . sysutils/Node.js.sh 10 | 11 | # Add curvytron user 12 | useradd -mrU curvytron 13 | 14 | ## Installation 15 | # Clone the repository 16 | git clone https://github.com/Curvytron/curvytron /home/curvytron 17 | 18 | # Go to the curvytron user directory 19 | cd /home/curvytron 20 | 21 | # Duplicate config.json.sample to config.json to setup a custom configuration, 22 | cp config.json.sample config.json 23 | 24 | sed -i "s/port: 8080/port: $port/" bin/curvytron.js 25 | 26 | # Install dependencies 27 | npm install -g bower gulp 28 | 29 | npm install 30 | npm install node-sass@next 31 | npm install gulp-sass@2.3.1 32 | 33 | bower install --allow-root 34 | 35 | # Build the game 36 | gulp 37 | 38 | # Change the owner from root to agario 39 | chown -R curvytron: /home/curvytron 40 | 41 | # Add a systemd service and run the server 42 | sh sysutils/service.sh Curvytron "/usr/bin/node /home/curvytron/bin/curvytron.js" /home/curvytron curvytron 43 | 44 | # Start the service and enable it to start at boot 45 | systemctl start curvytron 46 | systemctl enable curvyton 47 | 48 | whiptail --msgbox "Curvytron installed! 49 | 50 | The game is accessible at http://$URL:$port" 10 64 51 | -------------------------------------------------------------------------------- /apps/Deluge.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$1" = update ] && { $install deluged deluge-web; whiptail --msgbox "Deluge updated!" 8 32; break; } 4 | [ "$1" = remove ] && { $remove deluged deluge-web; whiptail --msgbox "Deluge removed." 8 32; break; } 5 | 6 | # http://dev.deluge-torrent.org/wiki/UserGuide/Service/systemd 7 | $install deluged deluge-web 8 | 9 | # For security it is best to run a service with a specific user and group. You can create one using the following command: 10 | adduser --system --gecos "Deluge Service" --disabled-password --group --home /var/lib/deluge deluge 11 | # This creates a new system user and group named deluge with no login access and home directory: /var/lib/deluge 12 | 13 | # Migration from init.d 14 | # Remove old init.d files 15 | service deluged stop 16 | rm /etc/init.d/deluged 17 | update-rc.d deluged remove 18 | 19 | # Logging 20 | # Create a log directory for Deluge and give the service user (e.g. deluge), full access: 21 | mkdir -p /var/log/deluge 22 | chown -R deluge:deluge /var/log/deluge 23 | chmod -R 750 /var/log/deluge 24 | # The deluge log directory is now configured so that user deluge has full access, group deluge read only and everyone else denied access. The umask specified in the services sets the permission of new log files. 25 | 26 | # Enable log Rotation 27 | cat > /etc/logrotate.d/deluge </dev/null 2>&1 || true 38 | systemctl restart deluge-web >/dev/null 2>&1 || true 39 | endscript 40 | } 41 | EOF 42 | 43 | # Deluge Daemon (deluged) Service 44 | cat > /etc/systemd/system/deluged.service < /etc/systemd/system/deluge-web.service < /opt/droppy/etc/droppy/config.json <&1 1>&2 2>&3) 10 | 11 | # Add ethercalc user 12 | useradd -rU ethercalc 13 | 14 | cd /srv 15 | npm i ethercalc 16 | 17 | # Create a symlink because ethercalc duplicate the path 18 | ln -rs /srv/node_modules /srv/node_modules/ethercalc/node_modules 19 | 20 | # Change the owner from root to ethercalc 21 | chown -R ethercalc: /srv/node_modules/ethercalc 22 | 23 | [ $IP = $LOCALIP ] && access=$IP || access=0.0.0.0 24 | 25 | # Add a systemd service and run the server 26 | sh $DIR/sysutils/service.sh EtherCalc "/usr/bin/node /srv/node_modules/ethercalc/app.js --host $access --port $port 27 | Environment=NODE_ENV=production" /srv/node_modules/ethercalc ethercalc 28 | 29 | whiptail --msgbox "EtherCalc installed! 30 | 31 | Open http://$URL:$port in your browser." 10 64 32 | -------------------------------------------------------------------------------- /apps/EtherDraw.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$1" = update ] && { git -C /home/etherdraw pull; chown -R etherdraw: /home/etherdraw; whiptail --msgbox "EtherDraw updated!" 8 32; break; } 4 | [ "$1" = remove ] && { sh sysutils/service.sh remove EtherDraw; userdel -rf etherdraw; whiptail --msgbox "EtherDraw removed." 8 32; break; } 5 | 6 | . sysutils/Node.js.sh 7 | 8 | # Add etherdraw user 9 | useradd -mrU etherdraw 10 | 11 | # Go to etherdraw user directory 12 | cd /home/etherdraw 13 | 14 | # Install Requirements 15 | [ $PKG = deb ] && $install build-essential libcairo2-dev libpango1.0-dev libgif-dev g++ && { $install libjpeg8-dev || $install libjpeg62-dev; } 16 | [ $PKG = rpm ] && yum groupinstall 'Development Tools' && $install libcairo2-devel libpango1.0-devel libgif-devel gcc-c++ && { $install libjpeg8-devel || $install libjpeg62-devel; } 17 | 18 | # Install EtherDraw 19 | git clone https://github.com/JohnMcLear/draw . 20 | 21 | # prepare the enviroment 22 | sh bin/installDeps.sh 23 | 24 | npm install sqlite3 25 | 26 | # Change the owner from root to etherdraw 27 | chown -R etherdraw: /home/etherdraw 28 | 29 | # Create the systemd service 30 | cat > /etc/systemd/system/etherdraw.service <&1 1>&2 2>&3) 10 | 11 | # Create etherpad user directory 12 | # Add etherpad user 13 | useradd -rU etherpad 14 | 15 | # gzip, git, curl, libssl develop libraries, python and gcc needed 16 | [ $PKG = deb ] && $install gzip python libssl-dev pkg-config build-essential 17 | [ $PKG = rpm ] && $install gzip python openssl-devel && yum groupinstall "Development Tools" 18 | 19 | cd /home 20 | git clone https://github.com/ether/etherpad-lite etherpad 21 | 22 | cp settings.json.template settings.json 23 | 24 | [ $IP = $LOCALIP ] && sed -i "s/0.0.0.0/$IP/" settings.json 25 | sed -i "s/9001/$port/" settings.json 26 | 27 | # Relace dirty db by SQlite 28 | sed -i 's/"dbType" : "dirty"/"dbType" : "sqlite"/' settings.json 29 | sed -i 's/var\/dirty.db/var\/sqlite.db/' settings.json 30 | 31 | #prepare the enviroment 32 | sh /home/etherpad/bin/installDeps.sh 33 | 34 | npm install sqlite3 35 | 36 | # Change the owner from root to etherpad 37 | chown -R etherpad: /home/etherpad 38 | 39 | # Add a systemd service and run the server 40 | sh $DIR/sysutils/service.sh Etherpad "/usr/bin/node /home/etherpad/node_modules/ep_etherpad-lite/node/server.js" /home/etherpad etherpad 41 | 42 | whiptail --msgbox "Etherpad installed! 43 | 44 | Open http://$URL:$port in your browser." 10 64 45 | -------------------------------------------------------------------------------- /apps/FreshRSS.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$1" = update ] && { cd /var/www/FreshRSS; git reset --hard; git pull; chown -R www-data:www-data ./; chmod -R g+w ./data/; whiptail --msgbox "FreshRSS updated!" 8 32; break; } 4 | [ "$1" = remove ] && { rm /etc/nginx/sites-*/freshrss; systemctl restart nginx; crontab -ru www-data; whiptail --msgbox "FreshRSS removed." 8 32; break; } 5 | 6 | # Defining the port 7 | port=$(whiptail --title "FreshRSS port" --inputbox "Set a port number for FreshRSS" 8 48 "8086" 3>&1 1>&2 2>&3) 8 | 9 | # https://github.com/FreshRSS/FreshRSS 10 | 11 | # PHP5 fallback if PHP7 not available 12 | php_fpm=/run/php/php7.0-fpm.sock 13 | $install php7.0 php7.0-curl php7.0-gmp php7.0-intl php7.0-json php7.0-sqlite php7.0-fpm php7.0-xml nginx sudo || echo "PHP7 not available, fallback to PHP5" && $install php5 php5-curl php5-gmp php5-intl php5-json php5-sqlite php5-fpm nginx sudo && php_fpm=/var/run/php5-fpm.sock 14 | 15 | # Create www-data user and group 16 | groupadd -g 33 www-data 17 | useradd \ 18 | -g www-data --no-user-group \ 19 | --home-dir /var/www --no-create-home \ 20 | --shell /usr/sbin/nologin \ 21 | --system --uid 33 www-data 22 | 23 | mkdir -p /var/www 24 | cd /var/www 25 | 26 | git clone https://github.com/FreshRSS/FreshRSS 27 | 28 | # Replace the default Origine theme by the more modern Flat theme 29 | sed -i "s/'theme' => 'Origine'/'theme' => 'Flat'/" FreshRSS/config-user.default.php 30 | 31 | # Set the rights so that your Web browser can access the files 32 | chown -R www-data:www-data FreshRSS 33 | chmod -R g+w FreshRSS/./data/ 34 | 35 | < 37 | ServerAdmin me@mydomain.com 38 | DocumentRoot /config/www//FreshRSS/p 39 | DirectoryIndex index.html index.php 40 | 41 | 42 | 43 | Options Indexes FollowSymLinks MultiViews 44 | AllowOverride All 45 | Order allow,deny 46 | allow from all 47 | 48 | 49 | 50 | APACHE2 51 | 52 | [ $IP = $LOCALIP ] && access=$IP: || access= 53 | 54 | # Create Nginx configuration file 55 | cat > /etc/nginx/sites-available/freshrss </dev/null 2>&1"; } | sudo -u www-data crontab - 93 | 94 | whiptail --msgbox "FreshRSS installed! 95 | 96 | Open http://$URL:$port in your browser." 10 64 97 | -------------------------------------------------------------------------------- /apps/GateOne.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$1" = update ] && { whiptail --msgbox "Not available yet" 8 32; exit; } 4 | [ "$1" = remove ] && { sh sysutils/service.sh remove GateOne; rm /etc/systemd/system/gateone.service; rm -rf /var/lib/gateone; rm -f /usr/local/bin/gateone; whiptail --msgbox "GateOne removed." 8 32; break; } 5 | 6 | $install python 7 | 8 | # Clone the repository 9 | git clone https://github.com/liftoff/GateOne 10 | 11 | cd GateOne 12 | python setup.py install 13 | 14 | # Start the service and enable it to start at boot 15 | systemctl start gateone 16 | systemctl enable gateone 17 | 18 | whiptail --msgbox "GateOne installed! 19 | 20 | The game is accessible at https://$URL" 10 64 21 | -------------------------------------------------------------------------------- /apps/Ghost.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #http://support.ghost.org/installing-ghost-linux/ 4 | #http://support.ghost.org/how-to-upgrade/ 5 | if [ "$1" = update ] ;then 6 | 7 | # Backuping content and configuration 8 | systemctl stop ghost 9 | cd /opt/ghost 10 | mkdir -p tmp 11 | cp -r lib/node_modules/ghost/content tmp 12 | cp lib/node_modules/ghost/core/server/config/env/config.production.json tmp 13 | 14 | # Update ghost 15 | echo "Updating Ghost" 16 | export NODE_ENV=production 17 | npm install ghost -g --unsafe-perm --save --prefix . 18 | 19 | # Restore the data and the configurations 20 | cp -r tmp/content lib/node_modules/ghost 21 | mv tmp/config.production.json lib/node_modules/ghost/core/server/config/env 22 | rm -r tmp 23 | 24 | # Migrate the DB 25 | cd lib/node_modules/ghost 26 | node node_modules/knex-migrator/bin/knex-migrator migrate 27 | 28 | # Change the owner from root to ghost 29 | chown -R ghost: /opt/ghost 30 | 31 | systemctl start ghost 32 | 33 | whiptail --msgbox " Ghost updated!" 8 64 34 | break 35 | fi 36 | [ "$1" = remove ] && { sh sysutils/service.sh remove Ghost; rm -rf /opt/ghost; userdel -rf ghost; whiptail --msgbox "Ghost removed." 8 32; break; } 37 | 38 | # Defining the port 39 | port=$(whiptail --title "Ghost port" --inputbox "Set a port number for Ghost" 8 48 "2368" 3>&1 1>&2 2>&3) 40 | 41 | . sysutils/Node.js.sh 42 | 43 | # Needed to build sqlite3 on ARM (no binaries available) 44 | if [ $ARCHf = arm ]; then 45 | [ $PKG = deb ] && $install gzip python libssl-dev pkg-config build-essential 46 | [ $PKG = rpm ] && $install gzip python openssl-devel && yum groupinstall "Development Tools" 47 | fi 48 | # https://docs.ghost.org/docs 49 | 50 | # Move to the new ghost directory, and install Ghost production dependencies 51 | mkdir -p /opt/ghost 52 | cd /opt/ghost 53 | export NODE_ENV=production 54 | npm install ghost -g --prefix . --unsafe-perm 55 | 56 | # Init the db 57 | cd /opt/ghost/lib/node_modules/ghost 58 | node node_modules/knex-migrator/bin/knex-migrator init 59 | 60 | # Ghost configuration 61 | [ $IP = $LOCALIP ] && access=$IP || access=0.0.0.0 62 | 63 | # Change the owner from root to ghost 64 | useradd -rU ghost 65 | chown -R ghost: /opt/ghost 66 | 67 | cat > "core/server/config/env/config.production.json" < "/etc/systemd/system/ghost.service" </dev/null ] ;then 11 | $install curl openssh-server 12 | systemctl enable sshd 13 | systemctl start sshd 14 | yum install postfix 15 | systemctl enable postfix 16 | systemctl start postfix 17 | firewall-cmd --permanent --add-service=http 18 | systemctl reload firewalld 19 | # CentOS 6 (and RedHat/Oracle/Scientific Linux 6) 20 | elif [ $PKG = rpm ] ;then 21 | $install openssh-server postfix cronie 22 | service postfix start 23 | chkconfig postfix on 24 | lokkit -s http -s ssh 25 | else 26 | whiptail --msgbox " Your system is not supported. It is still possible to install GitLab yourself. 27 | Please see the installation from source guide and the unofficial installation guides on the public wiki for more information" 12 64 28 | fi 29 | [ $PKG != pkg ] || break 30 | 31 | # Add the GitLab package server and install the package 32 | if [ $ARCH = armv7 ] && [ $PKG = deb ] ;then 33 | $install apt-transport-https 34 | curl -sS https://packages.gitlab.com/install/repositories/gitlab/raspberry-pi2/script.deb.sh | bash 35 | else 36 | curl -Ss https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.$PKG.sh | bash 37 | fi 38 | $install gitlab-ce 39 | 40 | gitlab-ctl reconfigure 41 | 42 | whiptail --msgbox "GitLab installed! 43 | Browse to $IP and login 44 | Username: root 45 | Password: 5iveL\!fe 46 | 47 | You can use gitlab-ctl {start|stop|status}" 12 64 48 | -------------------------------------------------------------------------------- /apps/Gitea.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$1" = update ] && { /home/git/gitea/gitea update; chown -R git: /home/git/gitea; whiptail --msgbox "Gitea updated!" 8 32; break; } 4 | [ "$1" = remove ] && { sh sysutils/service.sh remove Gitea; rm -rf /home/git/gitea; whiptail --msgbox "Gitea removed." 8 32; break; } 5 | 6 | # Prerequisites 7 | $install sqlite3 8 | 9 | # Create a git user 10 | useradd -mrU git 11 | 12 | # Go to its directory 13 | mkdir /home/git/gitea 14 | cd /home/git/gitea 15 | 16 | # Get the latest Gogs release 17 | ver=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/go-gitea/gitea/releases/latest) 18 | 19 | # Only keep the version number in the url 20 | ver=${ver#*v} 21 | 22 | case $ARCH in 23 | amd64) arch=amd64;; 24 | 86) arch=386;; 25 | arm64) arch=arm64;; 26 | armv7) arch=arm-7;; 27 | armv6) arch=arm-6;; 28 | esac 29 | 30 | # Download the archive 31 | download "https://dl.gitea.io/gitea/$ver/gitea-$ver-linux-$arch -O gitea" "Downloading the Gitea $ver binary..." 32 | 33 | # Start the service and enable it to start up at boot 34 | download "https://raw.githubusercontent.com/go-gitea/gitea/master/scripts/systemd/gitea.service -O /etc/systemd/system/gitea.service" "Downloading the Gitea systemd service..." 35 | 36 | # Change the owner from root to git 37 | chown -R git: /home/git/gitea 38 | 39 | # Start the service and enable it to start at boot 40 | systemctl start gitea 41 | systemctl enable gitea 42 | 43 | </dev/null ;then 45 | [ $IP = $LOCALIP ] && access=$IP || access=0.0.0.0 46 | cat >> /etc/caddy/Caddyfile </dev/null || $install unzip 38 | 39 | # Download the archive 40 | [ $ARCH = armv7 ] && url=https://cdn.gogs.io/gogs_v${ver}_raspi2.zip || url=https://cdn.gogs.io/gogs_v${ver}_linux_armv6.zip 41 | download "$url -O gogs.zip" "Downloading the Gogs $ver archive..." 42 | 43 | # Extract the downloaded archive and remove it 44 | unzip gogs.zip 45 | rm gogs.zip 46 | fi 47 | # Add a systemd service for Gogs 48 | cp /home/git/gogs/scripts/systemd/gogs.service /etc/systemd/system 49 | 50 | # Change the owner from root to git 51 | chown -R git: /home/git/gogs 52 | 53 | # Start the service and enable it to start at boot 54 | systemctl start gogs 55 | systemctl enable gogs 56 | 57 | </dev/null ;then 59 | [ $IP = $LOCALIP ] && access=$IP || access=0.0.0.0 60 | cat >> /etc/caddy/Caddyfile <> /etc/apt/sources.list 13 | wget -qO - https://download.jitsi.org/nightly/deb/unstable/archive.key | apt-key add - 14 | 15 | # Update the package lists 16 | apt-get update 17 | 18 | #Install Jitsi Meet 19 | $install jitsi-meet 20 | 21 | # Adding sip-gateway to Jitsi Meet 22 | whiptail --yesno "Would you like to add the sip-gateway Jigasi to Jitsi Meet?" 8 48 23 | case $? in 24 | 0) # Install Jigasi 25 | $install jigasi;; 26 | 1) ;; # Continue 27 | esac 28 | whiptail --msgbox "Jitsi Meet installed! 29 | 30 | It will be accessible at http://$URL" 12 64 31 | -------------------------------------------------------------------------------- /apps/KeystoneJS.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . sysutils/Node.js.sh 4 | . sysutils/MongoDB.sh 5 | 6 | cd 7 | # Install the generator 8 | npm install -g generator-keystone 9 | 10 | # Create project folder 11 | mkdir keystone-site-project 12 | cd keystone-site-project 13 | 14 | yo keystone 15 | 16 | node keystone 17 | 18 | whiptail --msgbox "KeystoneJS installed! 19 | 20 | To run your KeystoneJS project: cd keystone-site-project && node keystone 21 | 22 | Open http://$URL:3000 to view it in your browser." 12 64 23 | -------------------------------------------------------------------------------- /apps/Laverna.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$1" = update ] && { git -C /var/www/static-laverna pull; whiptail --msgbox "Laverna updated!" 8 32; break; } 4 | [ "$1" = remove ] && { rm -rf /var/www/static-laverna; rm /etc/nginx/sites-*/laverna; systemctl restart nginx; whiptail --msgbox "Laverna removed." 8 32; break; } 5 | 6 | # Defining the port 7 | port=$(whiptail --title "Laverna port" --inputbox "Set a port number for Laverna" 8 48 "8007" 3>&1 1>&2 2>&3) 8 | 9 | # Create www-data user and group 10 | groupadd -g 33 www-data 11 | useradd \ 12 | -g www-data --no-user-group \ 13 | --home-dir /var/www --no-create-home \ 14 | --shell /usr/sbin/nologin \ 15 | --system --uid 33 www-data 16 | 17 | # Go to its directory 18 | mkdir -p /var/www 19 | cd /var/www 20 | 21 | # Clone the prebuilt static version 22 | git clone https://github.com/Laverna/static-laverna 23 | 24 | # Change the owner from root to www-data 25 | chown -R www-data: /var/www/static-laverna 26 | 27 | if hash caddy 2>/dev/null ;then 28 | [ $IP = $LOCALIP ] && access=$IP || access=0.0.0.0 29 | cat >> /etc/caddy/Caddyfile < /etc/nginx/sites-available/laverna < "/etc/systemd/system/lets-chat.service" <&1 1>&2 2>&3) 8 | 9 | # Create a linx user 10 | useradd -mrU linx 11 | 12 | # Go to its directory 13 | cd /home/linx 14 | 15 | # Get the latest Linx-server release 16 | ver=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/andreimarcu/linx-server/releases/latest) 17 | 18 | # Only keep the version number in the url 19 | ver=${ver#*/v} 20 | 21 | arch=amd64 22 | [ $ARCHf = arm ] && arch=arm 23 | [ $ARCH = 86 ] && arch=386 24 | 25 | # Download and extract the arcive 26 | download "https://github.com/andreimarcu/linx-server/releases/download/v$ver/linx-server-v${ver}_linux-$arch" "Downloading the archive..." 27 | 28 | # Set the file executable 29 | chmod +x linx-server-v${ver}_linux-$arch 30 | 31 | cat > config.ini < "/etc/systemd/system/linx.service" < /etc/nginx/sites-enabled/mailpile < "/etc/systemd/system/maipile.service" <&1 1>&2 2>&3) 13 | 14 | $install postgresql nginx 15 | 16 | # Create a git user 17 | useradd -rU mattermost 18 | 19 | INSTALL_DIR=/opt/mattermost 20 | config=$INSTALL_DIR/config/config.json 21 | MM_USER=mmuser 22 | MM_PWD=mmuser_password 23 | MM_DBNAME=mattermost 24 | DB_HOST=db 25 | 26 | mkdir $INSTALL_DIR 27 | cd $INSTALL_DIR 28 | 29 | # Download the arcive 30 | download "https://releases.mattermost.com/3.5.1/mattermost-3.5.1-linux-amd64.tar.gz -O mattermost.tar.gz" "Downloading the Mattermost archive..." 31 | 32 | # Extract the downloaded archive and remove it 33 | extract mattermost.tar.gz "xzf -" "Extracting the files from the archive..." 34 | rm mattermost.tar.gz 35 | 36 | psql -v ON_ERROR_STOP=1 --username "postgres" <<- EOSQL 37 | CREATE DATABASE $MM_DBNAME; 38 | CREATE USER $MM_USER WITH PASSWORD $MM_PWD; 39 | GRANT ALL PRIVILEGES ON DATABASE $MM_DBNAME to $MM_USER; 40 | EOSQL 41 | 42 | printf "Configure database connection..." 43 | if [ ! -f $config ] ;then 44 | cp /config.template.json $config 45 | sed -Ei "s/DB_HOST/$DB_HOST/" $config 46 | sed -Ei "s/DB_PORT/5432/" $config 47 | sed -Ei "s/MM_USERNAME/$MM_USER/" $config 48 | sed -Ei "s/MM_PASSWORD/$MM_PWD/" $config 49 | sed -Ei "s/MM_DBNAME/$MM_DBNAME/" $config 50 | echo OK 51 | else 52 | echo SKIP 53 | fi 54 | 55 | sed -i "/DataSource/ s|mmuser.*|postgres://$MM_USER:$MM_PWD@127.0.0.1:5432/mattermost?sslmode=disable\&connect_timeout=10\",|" $config 56 | 57 | # Change the owner from root to mattermost 58 | chown -R mattermost: /opt/mattermost 59 | chmod -R g+w /opt/mattermost 60 | 61 | cat > /etc/systemd/system/mattermost.service < /etc/nginx/sites-available/mattermost <&1 1>&2 2>&3) 8 | 9 | port=$(whiptail --title "Mopify web client port" --inputbox "Set a port number for the Mopify web client" 8 48 "6680" 3>&1 1>&2 2>&3) 10 | 11 | if [ $PKG = deb ] ;then 12 | # Add the archive’s GPG key 13 | wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add - 14 | case "$DIST$DIST_VER" in 15 | # For Debian wheezy or Ubuntu 12.04 LTS 16 | debian7*|*ubuntu*12.04*) wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/wheezy.list;; 17 | # For any newer Debian/Ubuntu distro 18 | *) wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/jessie.list;; 19 | esac 20 | # Install Mopidy and all dependencies 21 | apt-get update 22 | fi 23 | [ $PKG = rpm ] && whiptail --yesno "Your have $DIST. $PKG based OS aren't supported yet." 8 32 24 | [ $PKG != rpm ] || break 25 | $install mopidy 26 | 27 | # Install Mopify, a web client for Mopidy 28 | pip install Mopidy-Mopify 29 | 30 | [ $IP = $LOCALIP ] && access=$IP || access=:: 31 | cat > /etc/mopidy/mopidy.conf <&1 1>&2 2>&3) 8 | 9 | # PHP5 fallback if PHP7 not available 10 | php_fpm=/run/php/php7.0-fpm.sock 11 | $install mariadb-server php7.0-mysql php7.0-fpm php7.0-zip php7.0-gd php7.0-mbstring || echo "PHP7 not available, fallback to PHP5" && $install mariadb-server php-mysql php-fpm php-zip php-gd php-mbstring && php_fpm=/var/run/php5-fpm.sock 12 | 13 | mkdir -p /var/www/nextcloud 14 | 15 | download "https://download.nextcloud.com/server/installer/setup-nextcloud.php -O /var/www/nextcloud/index.php" "Downloading the NextCloud wizard..." 16 | 17 | # Change the owner from root to www-data 18 | chown -R www-data:www-data /var/www/nextcloud 19 | 20 | if hash caddy 2>/dev/null ;then 21 | [ $IP = $LOCALIP ] && access=$IP || access=0.0.0.0 22 | cat >> /etc/caddy/Caddyfile < /etc/nginx/sites-available/nextcloud < config.json 47 | < /etc/systemd/system/nodebb.service <> /etc/apt/sources.list.d/owncloud.list" 22 | apt-get update 23 | $install owncloud 24 | 25 | elif [ $PGK = rpm ] ;then 26 | case "$DIST$DIST_VER" in 27 | "Red Hat6"|"Red Hat7") dist=RHEL_$DIST_VER;; 28 | centos6|centos7) dist=CentOS_$DIST_VER;; 29 | *) whiptail --yes-no "Your operating system $DIST doesn't appear to be officially supported. Try with the CentOS 7 repo?" 8 64 30 | [ $? = 0 ] || break 31 | dist=CentOS_7;; 32 | esac 33 | # Trust the repository 34 | rpm --import https://download.owncloud.org/download/repositories/stable/$dist/repodata/repomd.xml.key 35 | 36 | # Add the repository 37 | wget http://download.owncloud.org/download/repositories/stable/$dist/ce:stable.repo -O /etc/yum.repos.d/ce:stable.repo 38 | yum clean expire-cache 39 | $install -y owncloud 40 | else 41 | whiptail --msgbox "Your operating system doesn't appear to be supported.\ 42 | Try to install OwnCloud manually" 8 64; break 43 | fi 44 | 45 | whiptail --msgbox "OwnCloud installed! 46 | 47 | Open http://$URL/owncloud in your browser." 12 64 48 | -------------------------------------------------------------------------------- /apps/ReactionCommerce.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$1" = update ] && { .$HOME/reaction pull; whiptail --msgbox "ReactionCommerce updated!" 8 32; break; } 4 | [ "$1" = remove ] && { sh sysutils/service.sh remove ReactionCommerce; rm -rf ~/reaction; whiptail --msgbox "ReactionCommerce removed." 8 32; break; } 5 | 6 | # ARM architecture not supported 7 | if [ $ARCHf = arm ] ;then 8 | whiptail --yesno "Your architecture $ARCHf isn't supported" 8 32 9 | [ $? = 1 ] && sed -i "/ReactionCommerce/d" dp.cfg 10 | break 11 | fi 12 | 13 | . sysutils/Node.js.sh 14 | . sysutils/Meteor.sh 15 | 16 | cd 17 | # Install Reaction 18 | git clone https://github.com/reactioncommerce/reaction 19 | 20 | # Start the latest release 21 | cd reaction 22 | git checkout master # default branch is development 23 | 24 | ./reaction install 25 | 26 | # Add a systemd service and run the server 27 | sh $DIR/sysutils/service.sh ReactionCommerce "$HOME/reaction/reaction" $HOME/reaction/bin 28 | 29 | whiptail --msgbox "Reaction Commerce installed! 30 | 31 | Open http://$URL:3000 in your browser" 10 64 32 | -------------------------------------------------------------------------------- /apps/Rocket.Chat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Remove the old server executables 4 | [ "$1" = update ] && { systemctl stop rocket.chat; rm -rf /var/www/rocketchat; } 5 | [ "$1" = remove ] && { sh sysutils/service.sh remove Rocket.Chat; userdel -f rocketchat; rm -rf /var/www/rocketchat; whiptail --msgbox "Rocket.Chat removed." 8 32; break; } 6 | 7 | # Defining the port 8 | port=$(whiptail --title "Rocket.Chat port" --inputbox "Set a port number for Rocket.Chat" 8 48 "3004" 3>&1 1>&2 2>&3) 9 | 10 | . sysutils/Node.js.sh 11 | 12 | # Define ReplicaSet 13 | while : ;do 14 | whiptail --yesno --title "Define the Rocket.Chat MongoDB database" \ 15 | "Rocket.Chat needs a MongoDB database. A new local one will be installed, unless you have already an external database" 10 48 \ 16 | --yes-button Local --no-button External 17 | case $? in 18 | 0) MONGO_URL=MONGO_URL=mongodb://127.0.0.1:27017/rocketchat 19 | # Define the ReplicaSet 20 | [ "$1" = "" ] && { . sysutils/MongoDB.sh; } 21 | <> /etc/mongod.conf 29 | # else 30 | # Mongo 2.6+: using YAML syntax 31 | echo 'replication: 32 | replSetName: "001-rs"' >> /etc/mongod.conf 33 | # fi 34 | systemctl restart mongodb 35 | 36 | # Start the MongoDB shell and initiate the replica set 37 | mongo rs.initiate 38 | 39 | # RESULT EXPECTED 40 | # { 41 | # "info2" : "no configuration explicitly specified -- making one", 42 | # "me" : "localhost:27017", 43 | # "info" : "Config now saved locally. Should come online in about a minute.", 44 | # "ok" : 1 45 | # } 46 | MONGO_URL=MONGO_OPLOG_URL=mongodb://localhost:27017/local" 47 | fi 48 | NOT_READY_YET 49 | break;; 50 | 51 | 1) MONGO_URL=$(whiptail --inputbox --title "Set your MongoDB instance URL" "\ 52 | If you have a MongoDB database, you can enter its URL and use it. 53 | You can also use a MongoDB service provider on the Internet. 54 | You can use a free https://mongolab.com/ database. 55 | Enter your Mongo URL instance (with the brackets removed): \ 56 | " 10 72 "mongodb://:{user}:{password}@{host}:{port}/{datalink}" 3>&1 1>&2 2>&3) 57 | [ $? = 1 ] || break;; 58 | esac 59 | done 60 | 61 | useradd -rU rocketchat 62 | 63 | # Go to rocketchat user directory 64 | mkdir -p /var/www/rocketchat 65 | cd /var/www/rocketchat 66 | 67 | # Dependencies needed for npm install 68 | if [ $ARCH = arm64 ]; then 69 | [ $PKG = rpm ] && $install gcc-c++ || $install g++ 70 | $install python make 71 | fi 72 | 73 | # https://github.com/RocketChat/Rocket.Chat/wiki/Deploy-Rocket.Chat-without-docker 74 | [ $PKG = rpm ] && $install epel-release && $install GraphicsMagick || $install graphicsmagick 75 | 76 | # Download the latest Stable version of Rocket.Chat 77 | download "https://releases.rocket.chat/latest/download -O rocket.chat.tar.gz" "Downloading the Rocket.Chat archive..." 78 | 79 | # Extract the downloaded archive and remove it 80 | extract rocket.chat.tar.gz "xzf -" "Extracting the files from the archive..." 81 | 82 | # Extract the bundle to the current directory 83 | mv -f bundle/* bundle/.[^.]* . 84 | 85 | rm -r bundle rocket.chat.tgz 86 | 87 | # Override the recommended Node.js version (4.x) by the current system one 88 | echo $(node -v) > .node_version.txt 89 | 90 | # Install dependencies and start Rocket.Chat 91 | cd programs/server 92 | 93 | npm install 94 | 95 | # Change the owner from root to rocketchat 96 | chown -R rocketchat: /var/www/rocketchat 97 | 98 | [ $PKG = deb ] && mongo=mongodb || mongo=mongod 99 | # Create the systemd service 100 | cat > "/etc/systemd/system/rocket.chat.service" <&1 1>&2 2>&3) 15 | case $db_choice in 16 | 17 | # https://manual.seafile.com/deploy/using_sqlite.html 18 | "SQLite") 19 | # Defining the ports 20 | webui_port=$(whiptail --title "Seahub WebUI port" --inputbox "Set a port number for the Seahub WebUI" 8 48 "8001" 3>&1 1>&2 2>&3) 21 | 22 | fileserver_port=$(whiptail --title "Seafile fileserver port" --inputbox "Set a port number for the Seafile fileserver" 8 48 "8082" 3>&1 1>&2 2>&3) 23 | 24 | # Create a seafile user 25 | useradd -rU seafile 26 | 27 | # Go to its directory 28 | mkdir -p /var/www/seafile 29 | cd /var/www/seafile 30 | 31 | if [ $ARCHf = arm ]; then 32 | # Get the latest Seafile release 33 | ver=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/haiwen/seafile-rpi/releases/latest) 34 | # Only keep the version number in the url 35 | ver=${ver#*v} 36 | # One of this 3 link works 37 | wget https://github.com/haiwen/seafile-rpi/releases/download/v$ver/seafile-server_${ver}_pi.tar.gz | wget https://github.com/haiwen/seafile-rpi/releases/download/v$ver/seafile-server_stable_${ver}_pi.tar.gz | wget https://github.com/haiwen/seafile-rpi/releases/download/v$ver/seafile-server_beta_${ver}_pi.tar.gz 38 | else 39 | # Get the latest Seafile release 40 | ver=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/haiwen/seafile/releases/latest) 41 | # Only keep the version number in the url 42 | ver=${ver#*v} 43 | ver=${ver%-server} 44 | 45 | [ $ARCH = amd64 ] && url=https://bintray.com/artifact/download/seafile-org/seafile/seafile-server_${ver}_x86-64.tar.gz 46 | [ $ARCH = 86 ] && url=https://bintray.com/artifact/download/seafile-org/seafile/seafile-server_${ver}_i386.tar.gz 47 | 48 | # Download the arcive 49 | download $url "Downloading the Seafile $ver archive..." 50 | fi 51 | 52 | # Extract the downloaded archive and remove it 53 | extract seafile-server_* "xzf -" "Extracting the files from the archive..." 54 | rm seafile-server_* 55 | 56 | # Prerequisites 57 | $install python2.7 libpython2.7 python-setuptools python-imaging python-ldap sqlite3 sudo 58 | 59 | cd seafile-server-$ver 60 | #run the setup script & answer prompted questions 61 | ./setup-seafile.sh auto -n $(hostname) -i $IP -p $fileserver_port 62 | 63 | # Change the port in the ccnet.conf 64 | sed -i "s/8000/$webui_port/g" /var/www/seafile/conf/ccnet.conf 65 | 66 | # Change the owner from root to seafile 67 | chown -R seafile:seafile /var/www/seafile 68 | # Create systemd service and run the server 69 | cat > /etc/systemd/system/seafile.service < /etc/systemd/system/seahub.service <&1 1>&2 2>&3) 8 | 9 | . sysutils/Node.js.sh 10 | 11 | # Create stackedit user 12 | useradd -rU stackedit 13 | 14 | # Pre-requisites 15 | git clone https://github.com/benweet/stackedit /home/stackedit 16 | npm i -g gulp bower 17 | 18 | # Go to the stackedit user directory 19 | cd /home/stackedit 20 | 21 | # Download development tools 22 | npm install 23 | 24 | # Download dependencies 25 | bower install --allow-root 26 | 27 | # Change the owner from root to git 28 | chown -R stackedit: /home/stackedit 29 | 30 | # Add a systemd service 31 | cat > /etc/systemd/system/stackedit.service <&1 1>&2 2>&3) 8 | port=${port:-9000} 9 | 10 | . sysutils/Node.js.sh 11 | 12 | # Add thelounge user 13 | useradd -rU thelounge 14 | 15 | cd /srv 16 | 17 | # Install 18 | npm install thelounge 19 | 20 | # Change the owner from root to thelounge 21 | chown -R thelounge: /srv/node_modules/thelounge 22 | 23 | # Add a systemd service and run the server 24 | sh $DIR/sysutils/service.sh "The Lounge" "/usr/bin/node /srv/node_modules/thelounge/index.js -P $port" /srv/node_modules/thelounge/node_modules/thelounge thelounge 25 | 26 | whiptail --msgbox "The Lounge installed! 27 | 28 | Open http://$URL:$port in your browser." 10 64 29 | -------------------------------------------------------------------------------- /apps/Transmission.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$1" = update ] && { $install transmission-daemon; whiptail --msgbox "Transmission updated!" 8 32; break; } 4 | [ "$1" = remove ] && { $remove transmission-daemon; whiptail --msgbox "Transmission removed." 8 32; break; } 5 | 6 | $install transmission-daemon 7 | 8 | #sed -i 's/"rpc-whitelist": "127.0.0.1"/"rpc-whitelist": "127.0.0.1"/' /etc/transmission-daemon/settings.json 9 | 10 | sed -i 's/"rpc-whitelist-enabled": true/"rpc-whitelist-enabled": false/' /etc/transmission-daemon/settings.json 11 | #~/.config/transmission-daemon/settings.json 12 | 13 | whiptail --msgbox "$CHOICE installed! 14 | 15 | Open http://$URL:9091 in your browser to access to the web UI 16 | User Name: transmission | Password: transmission" 10 64 17 | -------------------------------------------------------------------------------- /apps/WP-Calypso.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #https://github.com/Automattic/wp-calypso/blob/master/docs/install.md 4 | 5 | # Prerequisites 6 | . sysutils/Node.js.sh 7 | 8 | $install make 9 | 10 | cd 11 | # Installing and Running 12 | git clone https://github.com/Automattic/wp-calypso 13 | cd wp-calypso 14 | make run 15 | 16 | # Add 127.0.0.1 calypso.localhost to your local hosts file 17 | echo 127.0.0.1 calypso.localhost >> /etc/hosts 18 | 19 | whiptail --msgbox "Wordpress Calypso installed! 20 | 21 | Open http://calypso.$URL:3000 in your browser" 10 64 22 | -------------------------------------------------------------------------------- /apps/Wagtail.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | $install python3 libjpeg zlib 4 | 5 | cd 6 | # Install Wagtail 7 | pip install wagtail 8 | 9 | wagtail start mysite 10 | cd mysite 11 | pip install -r requirements.txt 12 | ./manage.py migrate 13 | ./manage.py createsuperuser 14 | ./manage.py runserver 15 | 16 | whiptail --msgbox "Wagtail installed! 17 | 18 | Your site is now accessible at http://$URL:8000 19 | Admin backend available at http://$URL:8000/admin" 16 64 20 | -------------------------------------------------------------------------------- /apps/Webmin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$1" = update ] && { $install webmin; whiptail --msgbox "Webmin updated!" 8 32; break; } 4 | [ "$1" = remove ] && { $remove webmin; whiptail --msgbox "Webmin removed." 8 32; break; } 5 | 6 | # add repository to sources.list 7 | cat >> /etc/apt/sources.list <&1 1>&2 2>&3) 9 | 10 | [ "$1" = install ] && { . sysutils/MongoDB.sh; } 11 | 12 | # https://github.com/4commerce-technologies-AG/meteor 13 | # Special Meteor + Node.js bundle for ARM 14 | if [ -d ~./meteor ] || [ -d /usr/share/meteor ] ;then 15 | echo "You have Meteor installed" 16 | elif [ $ARCHf = arm ] && [ "$1" = "" ]; then 17 | cd /usr/local/share 18 | git clone --depth 1 -b release-1.2.1-universal https://github.com/4commerce-technologies-AG/meteor 19 | 20 | # Fix curl CA error 21 | echo insecure > ~/.curlrc 22 | # Check installed version, try to download a compatible pre-built dev_bundle and finish the installation 23 | /usr/local/share/meteor/meteor -v 24 | rm ~/.curlrc 25 | fi 26 | 27 | # Add wekan user 28 | useradd -mrU wekan 29 | 30 | # Go to wekan user directory 31 | cd /home/wekan 32 | 33 | # Get the latest Wekan release 34 | ver=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/wekan/wekan/releases/latest) 35 | 36 | # Only keep the version number in the url 37 | ver=${ver#*v} 38 | 39 | # Download the arcive 40 | download "https://github.com/wekan/wekan/releases/download/v$ver/wekan-$ver.tar.gz" "Downloading the Wekan $ver archive..." 41 | 42 | # Extract the downloaded archive and remove it 43 | extract wekan-$ver.tar.gz "xzf -" "Extracting the files from the archive..." 44 | 45 | mv -f bundle/* bundle/.[^.]* . 46 | rm wekan-$ver.tar.gz 47 | 48 | # Dependencies needed for npm install 49 | [ $PKG = rpm ] && $install gcc-c++ || $install g++ 50 | $install python make 51 | 52 | if [ $ARCHf = arm ] ;then 53 | # Reinstall bcrypt and bson to a newer version is needed 54 | cd /home/wekan/programs/server/npm/npm-bcrypt && /usr/local/share/meteor/dev_bundle/bin/npm uninstall bcrypt && /usr/local/share/meteor/dev_bundle/bin/npm install bcrypt 55 | cd /home/wekan/programs/server/npm/cfs_gridfs/node_modules/mongodb && /usr/local/share/meteor/dev_bundle/bin/npm uninstall bson && /usr/local/share/meteor/dev_bundle/bin/npm install bson 56 | elif [ $ARCHf = x86 ] ;then 57 | [ $PKG = rpm ] && $install epel-release && $install GraphicsMagick || $install graphicsmagick 58 | 59 | # Meteor needs Node.js 0.10.48 60 | download "https://nodejs.org/dist/v0.10.48/node-v0.10.48-linux-x64.tar.gz" "Downloading the Node.js 0.10.48 archive..." 61 | 62 | # Extract the downloaded archive and remove it 63 | extract node-v0.10.48-linux-x64.tar.gz "xzf - -C /usr/local/share" "Extracting the files from the archive..." 64 | rm node-v0.10.48-linux-x64.tar.gz 65 | else 66 | whiptail --msgbox "Your architecture $ARCHf isn't supported" 8 48 67 | fi 68 | 69 | # Move to the server directory and install the dependencies: 70 | cd /home/wekan/programs/server 71 | 72 | [ $ARCHf = x86 ] && /usr/local/share/node-v0.10.48-linux-x64/bin/npm install 73 | [ $ARCHf = arm ] && /usr/local/share/meteor/dev_bundle/bin/npm install 74 | 75 | # Change the owner from root to wekan 76 | chown -R wekan: /home/wekan 77 | 78 | [ $ARCHf = x86 ] && node=/usr/local/share/node-v0.10.48-linux-x64/bin/node 79 | [ $ARCHf = arm ] && node=/usr/local/share/meteor/dev_bundle/bin/node 80 | 81 | # Create the systemd service 82 | cat > "/etc/systemd/system/wekan.service" <&1 1>&2 2>&3) 8 | 9 | # PHP5 fallback if PHP7 not available 10 | php_fpm=/run/php/php7.0-fpm.sock 11 | $install mariadb-server php7.0-mysql php7.0-fpm || echo "PHP7 not available, fallback to PHP5" && $install mariadb-server php5-mysql php5-fpm && php_fpm=/var/run/php5-fpm.sock 12 | 13 | # Create www-data user and group 14 | groupadd -g 33 www-data 15 | useradd \ 16 | -g www-data --no-user-group \ 17 | --home-dir /var/www --no-create-home \ 18 | --shell /usr/sbin/nologin \ 19 | --system --uid 33 www-data 20 | 21 | mkdir -p /var/www/wordpress 22 | cd /var/www/wordpress 23 | git clone https://github.com/GeekPress/WP-Quick-Install 24 | mv WP-Quick-Install/wp-quick-install/* . 25 | rm -rf WP-Quick-Install 26 | 27 | # Change the owner from root to www-data 28 | chown -R www-data: /var/www/ 29 | 30 | if hash caddy 2>/dev/null ;then 31 | [ $IP = $LOCALIP ] && access=$IP || access=0.0.0.0 32 | cat >> /etc/caddy/Caddyfile < /etc/nginx/sites-available/wordpress < or WASD. Quit with 'Q' 29 | 30 | Press Enter <-'" 31 | 32 | read null 33 | 34 | # Get the game time 35 | game_time() { 36 | time=$(cat /proc/uptime) 37 | time_ms=${time%%? *} 38 | time_ms=${time_ms#*.} 39 | time=${time%%.*} 40 | time=$(( $time - $time0 )) 41 | } 42 | 43 | # Generate random numbers 44 | get_rand() { 45 | RAND255=$(od -An -N1 -tu1 /dev/urandom) 46 | RAND3=${RAND255%??} 47 | RAND10=${RAND255%?} 48 | RAND10=${RAND255#$RAND10} 49 | RAND30=$RAND3$RAND10 50 | 51 | RAND100=${RAND255%?} 52 | RAND100=${RAND255#$RAND100} 53 | } 54 | 55 | # Get the key form the TTY 56 | get_key() { 57 | stty_state=$(stty -g) 58 | stty raw -echo min 0 59 | key=$(printf "$(dd bs=3 count=1 2>/dev/null)" | od -a) 60 | stty "$stty_state" 61 | key=${key#* * } 62 | key=${key%*????????} 63 | } 64 | 65 | # Create a new item 66 | create_item() { 67 | get_rand 68 | item_x=$(( 64 - $RAND30 )) 69 | item_y=17 70 | neg_y= 71 | item_neg_y= 72 | item_x_space= 73 | i=0 74 | 75 | # Random item skin 76 | case "$RAND3" in 77 | ' ') item_skin="\33[1;94m0\33[0m";; 78 | ' 1') item_skin="\33[1;95mQ\33[0m";; 79 | ' 2') item_skin="\33[1;96mD\33[0m";; 80 | esac 81 | 82 | while [ $item_x != $i ] ;do 83 | item_x_space="$item_x_space " 84 | i=$(( i + 1 )) 85 | done 86 | item_time=$time_ms 87 | } 88 | 89 | # Determine the item position 90 | item_pos() { 91 | [ "$item_x" = "" ] && create_item 92 | if [ $item_time != $time_ms ] && { [ $time_ms = 0 ] || [ $time_ms = 2 ] || [ $time_ms = 4 ] || [ $time_ms = 6 ] || [ $time_ms = 8 ]; } ;then 93 | item_x_space=${item_x_space#???} 94 | item_x=$(( item_x - 3 )) 95 | item_neg_y="$item_neg_y\n" 96 | item_y=$(( item_y - 1 )) 97 | neg_y=$neg_y?? && item_time=$time_ms 98 | fi 99 | } 100 | 101 | # Move the player and determine its position 102 | position_move() { 103 | case $key in 104 | w|W|' [ A') [ $player_y != 16 ] && player_y=$(( player_y + 1 )) && game_neg_y=${game_neg_y#??} && game_y="$game_y\n";; # UP 105 | s|S|' [ B') [ $player_y != 0 ] && player_y=$(( player_y - 1 )) && game_neg_y="$game_neg_y\n" && game_y=${game_y#??};; # DOWN 106 | d|D|' [ C') [ $player_x != 48 ] && player_x=$(( player_x + 1 )) && game_x="$game_x ";; # RIGHT 107 | a|A|' [ D') [ $player_x != 0 ] && player_x=$(( player_x - 1 )) && game_x=${game_x#?};; # LEFT 108 | q|Q) clear; exit 1;; 109 | esac 110 | } 111 | 112 | # Player ship position 113 | player_ship() { 114 | # __ 115 | # L/ 116 | [ $engine = $engine0 ] && engine=$engine1 || engine=$engine0 117 | } 118 | 119 | # Score, life and gameover 120 | state() { 121 | [ $player_y -gt $(( item_y - 4 )) ] && { [ $player_x = $item_x ] || [ $(( player_x + 1 )) = $item_x ]; } && score=$(( score + 1 )) && item_x= 122 | [ $item_x -lt 0 ] && life=$(( life - 1 )) && item_x= 123 | [ $item_y = $player_y ] && item_x= && life=$(( life - 1 )) 124 | if [ $life -lt 1 ] ;then 125 | printf "\033c \33[1;90m===\33[0m\33[1;97m\ \ \33[0m\33[1;91mGAME OVER\33[0m\33[1;97m / /\33[0m\33[1;90m===\33[0m 126 | 127 | You score: \33[1;93m$score\33[0m 128 | 129 | time: $time.$time_ms 130 | 131 | https://github.com/j8r/DustShip 132 | Copyright (c) 2016 Julien Reichardt - MIT License (MIT) 133 | 134 | Press Enter <-'" 135 | read null 136 | exit 137 | fi 138 | } 139 | # Create the game canvas 140 | game_canvas() { 141 | player_neg_y=${game_neg_y#$neg_y} 142 | canvas="$item_neg_y${item_x_space}$item_skin$player_neg_y ${game_x}$weapon 143 | $game_x${engine}\33[1;93mL\33[0m\33[1;96m/\33[0m$game_y" 144 | } 145 | 146 | # Main game loop function 147 | main_game() { 148 | while game_time ;do 149 | get_key 150 | position_move 151 | player_ship 152 | item_pos 153 | game_canvas 154 | state 155 | printf "\033c\33[40mLife: \33[1;91m$life \33[0m\33[40mScore: \33[1;93m$score\33[0m 156 | $canvas 157 | time: $time.$time_ms Q: quit" 158 | done 159 | } 160 | main_game 161 | -------------------------------------------------------------------------------- /apps/netdata.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Update, rebuild and install netdata 4 | [ "$1" = update ] && { cd /opt/netdata; ./netdata-updater.sh; whiptail --msgbox "netdata updated!" 8 32; break; } 5 | [ "$1" = remove ] && { rm /etc/nginx/sites-*/netdata; systemctl restart nginx; sh sysutils/service.sh remove netdata; rm -rf /usr/sbin/netdata /etc/netdata /usr/share/netdata /usr/libexec/netdata /var/cache/netdata /var/log/netdata /opt/netdata; userdel netdata; whiptail --msgbox "netdata removed." 8 32; break; } 6 | 7 | # Defining the port 8 | port=$(whiptail --title "netdata port" --inputbox "Set a port number for netdata" 8 48 "19999" 3>&1 1>&2 2>&3) 9 | 10 | install_choice=$(whiptail --title Seafile --menu " What netdata packages installation do you want?" 16 96 3 \ 11 | "Basic" "System monitoring and many applications. No mariadb, named, hardware sensors and SNMP" \ 12 | "Advanced" "Install all the required packages for monitoring everything netdata can monitor" \ 13 | 3>&1 1>&2 2>&3) 14 | 15 | 16 | [ "$install_choice" = "Basic" ] && { curl -Ss 'https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh' >/tmp/kickstart.sh && bash /tmp/kickstart.sh netdata; } 17 | [ "$install_choice" = "Advanced" ] && { curl -Ss 'https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh' >/tmp/kickstart.sh && bash /tmp/kickstart.sh netdata-all; } 18 | 19 | # https://github.com/firehol/netdata/wiki/Installation 20 | # ArchLinux 21 | if [ $PKG = pkg ] ;then 22 | $install netdata 23 | else 24 | # Debian / Ubuntu 25 | [ $PKG = deb ] && $install zlib1g-dev uuid-dev libmnl-dev gcc make autoconf autogen automake pkg-config 26 | 27 | # Centos / Fedora / Redhat 28 | [ $PKG = rpm ] && $install zlib-devel libuuid-devel libmnl-devel gcc make autoconf autogen automake pkgconfig 29 | 30 | cd /tmp 31 | # download it - the directory 'netdata' will be created 32 | git clone https://github.com/firehol/netdata --depth=1 33 | 34 | # build it, install it, start it 35 | cd netdata 36 | ./netdata-installer.sh --install /opt 37 | fi 38 | 39 | # Run netdata via Caddy's proxying 40 | if hash caddy 2>/dev/null ;then 41 | [ $IP = $LOCALIP ] && access=$IP || access=0.0.0.0 42 | cat >> /etc/caddy/Caddyfile < /etc/nginx/sites-available/netdata </dev/null ;then 34 | PKG=deb 35 | install="debconf-apt-progress -- apt-get install -y" 36 | remove="apt-get purge -y" 37 | elif hash dnf 2>/dev/null ;then 38 | PKG=rpm 39 | install="dnf install -y" 40 | remove="dnf remove -y" 41 | elif hash yum 2>/dev/null ;then 42 | PKG=rpm 43 | install="yum install -y" 44 | remove="yum remove -y" 45 | elif hash pacman 2>/dev/null ;then 46 | PKG=pkg 47 | install="pacman -Syu" 48 | remove="pacman -Rsy" 49 | else 50 | echo "Your operating system $DIST isn't supported" 8 48; exit 1 51 | fi 52 | 53 | # Prerequisites 54 | hash git whiptail curl wget 2>/dev/null || $install git whiptail curl wget 55 | 56 | # Detect architecture 57 | ARCH=$(uname -m) 58 | case $ARCH in 59 | x86_64) ARCHf=x86; ARCH=amd64;; 60 | i*86) ARCHf=x86; ARCH=86;; 61 | aarch64) ARCHf=arm; ARCH=arm64;; 62 | armv7*) ARCHf=arm; ARCH=armv7;; 63 | armv6*) ARCHf=arm; ARCH=armv6;; 64 | *) whiptail --msgbox "Your architecture $ARCH isn't supported" 8 48; exit 1;; 65 | esac 66 | 67 | # Check if systemd is the init system 68 | hash systemctl 2>/dev/null || whiptail --title '/!\ WARNING - systemd services not available /!\' --msgbox " You don't have systemd as an init system. 69 | 70 | Your apps will be installed successfully but you won't 71 | be able to use custom app services that run in the background" 10 64 72 | 73 | # Test if cuby responds 74 | echo "Obtaining the IPv4 address from http://ipv4.icanhazip.com..." 75 | IPv4=$(wget -qO- http://ipv4.icanhazip.com && sleep 1) && echo "done." || echo "failed" 76 | # Else use this site 77 | [ "$IPv4" = "" ] && { echo "Can't retrieve the IPv4 from http://ipv4.icanhazip.com.\nTrying to obtaining the IPv4 address from http://cuby-hebergs.com..." && IPv4=$(wget -qO- https://ip4.cuby-hebergs.com && sleep 1) && echo "done." || echo "failed."; } 78 | 79 | # Check Internet availability 80 | ping -c 1 g.co >/dev/null 2>&1 || whiptail --title '/!\ WARNING - No Internet Connection /!\' --msgbox "\ 81 | You have no internet connection. You can do everything but install new apps" 8 48 82 | 83 | IPv6=$(ip -6 a | sed -n 's/.*inet6 \([^ ]*\)\/.*/\1/p' | head -n 2 | tail -1) 84 | 85 | LOCALIP=$(ip -4 a | sed -n 's/.*inet \([^ ]*\)\/.*/\1/p' | head -n 2 | tail -1) 86 | 87 | # Download with progress bary 88 | download() { 89 | wget $1 2>&1 | stdbuf -o0 awk '/[.] +[0-9][0-9]?[0-9]?%/ { print substr($0,63,3) }' | whiptail --gauge "${2:-downloading...}" 6 64 0 90 | } 91 | 92 | # Extract with progress bar 93 | extract() { 94 | hash pv 2>/dev/null || $install pv 95 | (pv -n $1 | tar $2) 2>&1 | whiptail --gauge "$3" 6 64 0 96 | } 97 | 98 | # Domain configuration 99 | network_access() { 100 | NET=$(whiptail --nocancel --title "DPlatform - First launch setup" --menu "Select with arrows <-v-> and Tab <=>. Confirm with Enter <-' 101 | It appears that you run DPlatform for the first time. You need to setup the network access of your applications. \ 102 | You can change this setup anytime if you want a different access before installing new apps" 14 96 2 \ 103 | "Local" "Your apps will be available only in your local network / from your home" \ 104 | "Public IP/FQDN" "Only if you can open your ports / make redirections in your router's firewall" 3>&1 1>&2 2>&3) 105 | #Worlwide with generrated URL" "Secure access with a generated/custom URL with a Firewall passthrough. No further configurations needed" \ 106 | case $NET in 107 | "Local") whiptail --msgbox "You can access to your apps by opening >| $(hostname) |< in your browser. \ 108 | Howewer, it might not work depending of your local DNS configuration. \ 109 | You can always use the local IP of your server in your local network" 10 64 110 | sed -i "/URL=/URL=hostname/d" dp.cfg 2>/dev/null || echo "URL=hostname" > dp.cfg;; 111 | 112 | "Public IP/FQDN") 113 | # IP address choice if both IPv4 and IPv6 are present 114 | [ $IPv6 != ::1 ] && [ "$IPv4" != "" ] && whiptail --yesno "You have two public IP addresses available. Which one do you want to use?" --yes-button IPv6 --no-button IPv4 8 48 && IP=IP || IP=IPv4 115 | sed -i "/URL=/URL=$IP/d" dp.cfg 2>/dev/null || echo "URL=$IP" > dp.cfg 116 | [ $IP = IP ] && IP=IPv6 117 | eval IP=\$$IP 118 | whiptail --msgbox "You can access to your apps by opening in your browser 119 | >| $IP |< " 8 64;; 120 | esac 121 | } 122 | 123 | # Create a dp.cfg with a URL variable if it doesn't exist 124 | [ -f dp.cfg ] || network_access 125 | 126 | change_hostname() { 127 | new_hostname=$(whiptail --inputbox --title "Change your hostname" "\ 128 | Your hostname must contain only ASCII letters 'a' through 'z' (case-insensitive), 129 | the digits '0' through '9', and the hyphen. 130 | Hostname labels cannot begin or end with a hyphen. 131 | No other symbols, punctuation characters, or blank spaces are permitted. 132 | Please enter a hostname:" 14 64 "$(hostname)" 3>&1 1>&2 2>&3) 133 | if [ $? = 0 ] ;then 134 | echo $new_hostname > /etc/hostname 135 | sed -i "s/ $($hostname) / $new_hostname /g" /etc/hosts 136 | whiptail --yesno "You need to reboot to apply the hostname change. Reboot now?" 8 32 137 | [ $? = 0 ] && reboot 138 | fi 139 | } 140 | 141 | # Applications menus 142 | apps_menus() { 143 | if [ "$1" = update ] || [ "$1" = remove ] ;then 144 | # Reset previous apps_choice variable 145 | apps_choice= 146 | [ $1 = update ] && apps_choice="Update Syncronize_new_packages_available" 147 | 148 | # Read dp.cfg to create entries 149 | while read app ;do 150 | [ "$app" = "$(grep URL= dp.cfg)" ] || apps_choice="$apps_choice $app $1_$app" 151 | done < dp.cfg 152 | # Update and remove menu 153 | APP=$(whiptail --title "DPlatform - $1 menu" --menu " 154 | What application would you like to $1?" 16 64 8 $apps_choice 3>&1 1>&2 2>&3) 155 | # Confirmation message 156 | [ $? = 1 ] || whiptail --yesno " $APP will be $1d. 157 | Are you sure to want to continue?" 8 48 158 | # Remove the app entry 159 | [ $? = 1 ] || case $APP in 160 | "") ;; # Return to the menu 161 | Update) [ $PKG = deb ] && apt-get update 162 | [ $PKG = rpm ] && yum update 163 | git pull;; 164 | # Create a loop to break 165 | Caddy|Docker|MongoDB|Node.js) for a in a; do . sysutils/$APP.sh $1; done; [ $1 = remove ] && sed -i "/$APP/d" dp.cfg;; 166 | $APP) for a in a; do . apps/$APP.sh $1; done; [ $1 = remove ] && sed -i "/$APP/d" dp.cfg;; 167 | esac 168 | cd $DIR 169 | else 170 | # Installation menu 171 | while APP=$(whiptail --title "DPlatform - Installation menu" --menu "\ 172 | What application would you like to deploy? 173 | Apps with /!\ are not finished, same with |~| but might works" 24 96 14 \ 174 | Rocket.Chat "The Ultimate Open Source WebChat Platform" \ 175 | Gogs "Gogs(Go Git Service), a painless self-hosted Git Service" \ 176 | Syncthing "Open Source Continuous File Synchronization" \ 177 | OpenVPN "Open source secure tunneling VPN daemon" \ 178 | Mumble "Voicechat utility" \ 179 | Seafile "Cloud storage with file encryption and group sharing" \ 180 | Mopidy "Mopidy is an extensible music server written in Python" \ 181 | FreshRSS "A free, self-hostable aggregator" \ 182 | OwnCloud "Access & share your files, calendars, contacts, mail" \ 183 | Nextcloud "Access, share and protect your files, calendars, contacts, communication" \ 184 | Agar.io-Clone "Agar.io clone written with Socket.IO and HTML5 canvas" \ 185 | Ajenti "Web admin panel" \ 186 | Cuberite "A custom Minecraft compatible game server written in C++" \ 187 | Deluge "A lightweight, Free Software, cross-platform BitTorrent client" \ 188 | Dillinger "The last Markdown editor, ever" \ 189 | Droppy "Self-hosted file storage server, with file editing and media view" \ 190 | EtherCalc "Web spreadsheet, Node.js port of Multi-user SocialCalc" \ 191 | EtherDraw "Collaborative real-time drawing, sketching & painting" \ 192 | Etherpad "Real-time collaborative document editor" \ 193 | GateOne "An HTML5-powered terminal emulator and SSH client" \ 194 | Gitea "Git with a cup of tea - A painless self-hosted Git service" \ 195 | GitLab "Open source Version Control to collaborate on code" \ 196 | Ghost "Simple and powerful blogging/publishing platform" \ 197 | Jitsi-Meet "|~| Secure, Simple and Scalable Video Conferences" \ 198 | JSBin "|~| Collaborative JavaScript Debugging App" \ 199 | KeystoneJS "|~| Node.js CMS & Web Application Platform" \ 200 | Laverna "Note taking application with Mardown editor and encryption" \ 201 | LetsChat "Self-hosted chat app for small teams" \ 202 | Linx "Self-hosted file/code/media sharing website" \ 203 | Cloud9 "Cloud9 3.0 SDK for Plugin Development" \ 204 | Curvytron "A web multiplayer Tron-like game with curves" \ 205 | Caddy "Fast, cross-platform HTTP/2 web server with automatic HTTPS" \ 206 | Docker "Open container engine platform for distributed application" \ 207 | Mailpile "Modern, fast email client with user-friendly privacy features" \ 208 | Mattermost "/!\ Mattermost is an open source, on-prem Slack-alternative" \ 209 | Modoboa "Mail hosting made simple" \ 210 | MongoDB "The next-generation database" \ 211 | netdata "Real-time performance monitoring, in the greatest possible detail" \ 212 | Node.js "Install Node.js using nvm" \ 213 | NodeBB "Node.js based community forum built for the modern web" \ 214 | ReactionCommerce "|~| Modern reactive, real-time event driven ecommerce platform" \ 215 | TheLounge "The self-hosted web IRC client" \ 216 | StackEdit "In-browser markdown editor" \ 217 | Taiga.io "/!\ Agile, Free and Open Source Project Management Platform" \ 218 | Transmission "A cross-platform BitTorrent client that is easy and powerful use" \ 219 | Wagtail "|~| Django CMS focused on flexibility and user experience" \ 220 | Wide "|~| Web-based IDE for Teams using Go(lang)" \ 221 | WordPress "Create a beautiful website, blog, or app" \ 222 | WP-Calypso "|~| Reading, writing, and managing all of your WordPress sites" \ 223 | 3>&1 1>&2 2>&3) ;do 224 | # Confirmation message 225 | whiptail --yesno " $APP will be installed. 226 | Are you sure to want to continue?" 8 48 227 | case $? in 228 | 1) ;; # Return to installation menu 229 | 0) if grep -q $APP dp.cfg ;then 230 | whiptail --msgbox "$APP is already installed" 8 32 231 | else 232 | case $APP in 233 | Caddy|Docker|MongoDB|Node.js) . sysutils/$APP.sh;; 234 | $APP) . apps/$APP.sh; cd $DIR; grep -q $APP dp.cfg || echo $APP >> dp.cfg;; 235 | esac 236 | fi;; 237 | esac 238 | done 239 | fi 240 | } 241 | 242 | # Configuration Entry 243 | if hash bananian-config 2>/dev/null ;then 244 | config=bananian-config 245 | configOption=" Banana_Pi_Configuration_Tool" 246 | elif hash raspi-config 2>/dev/null ;then 247 | config=raspi-config 248 | configOption=" Raspberry_Pi_Configuration_Tool" 249 | fi 250 | 251 | while 252 | # Recuperate the URL variable from dp.cfg 253 | case $(grep URL= dp.cfg) in 254 | URL=hostname) URL=$(hostname); IP=$LOCALIP;; 255 | URL=IP) [ $IPv6 = ::1 ] && IP=$IPv4 || IP=[$IPv6]; URL=$IP;; 256 | URL=IPv4) IP=$IPv4; URL=$IP;; 257 | esac 258 | # Main menu 259 | CHOICE=$(whiptail --title "DPlatform - Main menu" --menu " Select with arrows <-v-> and Tab <=>. Confirm with Enter <-' 260 | Your can access to your apps by opening this address in your browser: 261 | >| http://$URL(:port) |<" 18 80 8 \ 262 | Install "Install new applications" \ 263 | Update "Update applications and DPlatform" \ 264 | Remove "Uninstall applications" \ 265 | "App Service Manager" "Start/Stop and auto start services at boot" \ 266 | "Network app access" "Define the network accessibility of your apps" \ 267 | Hostname "Change the name of the server on your local network" \ 268 | About "Informations about this project and your system" \ 269 | $config$configOption 3>&1 1>&2 2>&3) ;do 270 | case $CHOICE in 271 | Install) apps_menus;; 272 | Update) apps_menus update;; 273 | Remove) apps_menus remove;; 274 | "App Service Manager") . sysutils/service.sh;; 275 | "Network app access") network_access;; 276 | Hostname) change_hostname;; 277 | About) whiptail --title "DPlatform - About" --yesno "DPlatform - Deploy self-hosted apps easily 278 | https://github.com/DFabric/DPlatform-ShellCore 279 | 280 | - Domain/host name: `hostname` 281 | - Local IPv4: $LOCALIP 282 | - Public IPv4: $IPv4 283 | - IPv6: $IPv6 284 | Your OS: $DIST $DIST_VER $(uname -m) 285 | 286 | Copyright (c) 2015-2016 Julien Reichardt - MIT License (MIT)" 16 64 --yes-button " Ok " --no-button "" 287 | [ $? = 1 ] && sh apps/dustship.sh;; 288 | $config) $config;; 289 | esac 290 | done 291 | -------------------------------------------------------------------------------- /init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ $(id -u) != 0 ] && whiptail --title '/!\ WARNING - Not runned as root /!\' --msgbox " You don't run this as root! 4 | You will need to have root permissions" 8 48 5 | 6 | # Detect package manager 7 | if hash apt-get 2>/dev/null ;then 8 | PKG=deb 9 | hash whiptail dialog 2>/dev/null && install="debconf-apt-progress -- apt-get install -y" || install="apt-get install -y" 10 | remove="apt-get purge -y" 11 | elif hash dnf 2>/dev/null ;then 12 | PKG=rpm 13 | install="dnf install -y" 14 | remove="dnf remove -y" 15 | elif hash yum 2>/dev/null ;then 16 | PKG=rpm 17 | install="yum install -y" 18 | remove="yum remove -y" 19 | elif hash pacman 2>/dev/null ;then 20 | PKG=pkg 21 | install="pacman -Syu" 22 | remove="pacman -Rsy" 23 | else 24 | echo "Your operating system isn't supported" 8 48; exit 1 25 | fi 26 | 27 | # Prerequisites 28 | hash git whiptail curl wget 2>/dev/null || $install git whiptail curl wget 29 | 30 | # Current directory 31 | DIR=$(cd -P $(dirname $0) && pwd) 32 | cd $DIR 33 | 34 | # Check available updates or clone the project 35 | [ -d $DIR/.git ] && git pull 36 | [ -d $DIR/DPlatform-ShellCore ] && DIR=$DIR/DPlatform-ShellCore || [ "${DIR##*/}" != DPlatform-ShellCore ] && git clone -b master --single-branch https://github.com/DFabric/DPlatform-ShellCore && DIR=$DIR/DPlatform-ShellCore 37 | . $DIR/dplatform.sh 38 | -------------------------------------------------------------------------------- /sysutils/Caddy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # https://github.com/mholt/caddy/tree/master/dist/init/linux-systemd 4 | 5 | if [ "$1" = update ] ;then 6 | # Check Caddy version 7 | caddy_ver=$(caddy -version) 8 | # Keep the version number 9 | caddy_ver=${caddy_ver#Caddy *} 10 | 11 | # Get the latest Caddy release 12 | ver=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/mholt/caddy/releases/latest) 13 | # Only keep the version number in the url 14 | ver=${ver#*v} 15 | 16 | [ "$caddy_ver" = "$ver" ] && whiptail --msgbox "You have the $ver version of Caddy, the latest avalaible!" 8 48 17 | [ "$caddy_ver" != "$ver" ] && { whiptail --yesno "You have Caddy $caddy_ver, the latest is $ver. 18 | Would you like also use the newest Caddy service?" 10 64; [ $? = 0 ]; } || break 19 | fi 20 | 21 | [ "$1" = remove ] && [ "$2" = "" ] && { sh sysutils/service.sh remove Caddy; rm -f /usr/local/bin/caddy; rm -f /etc/caddy/Caddyfile; whiptail --msgbox "Caddy removed." 8 32; break; } 22 | 23 | # Install Caddy if not installed 24 | if [ "$1" = update ] || ! hash caddy 2>/dev/null ;then 25 | # Install unzip if not installed 26 | $install unzip 27 | arch=$ARCH 28 | [ $ARCH = armv7 ] && arch=arm7 29 | [ $ARCHf = 86 ] && arch=386 30 | 31 | groupadd -g 33 www-data 32 | useradd \ 33 | -g www-data --no-user-group \ 34 | --home-dir /var/www --no-create-home \ 35 | --shell /usr/sbin/nologin \ 36 | --system --uid 33 www-data 37 | 38 | # Create a caddy directory and create the Caddyfile configuration file 39 | mkdir -p /etc/caddy 40 | touch /etc/caddy/Caddyfile 41 | chown -R root:www-data /etc/caddy 42 | mkdir -p /etc/ssl/caddy 43 | chown -R www-data:root /etc/ssl/caddy 44 | chmod 0770 /etc/ssl/caddy 45 | 46 | # Create a temp directrory 47 | mkdir /tmp/caddy 48 | 49 | # Download Caddy 50 | download "https://caddyserver.com/download/linux/$arch?license=personal -O /tmp/caddy.tar.gz" "Download the Caddy $ver archive..." 51 | 52 | # Extract the downloaded archive and remove it 53 | extract "/tmp/caddy.tar.gz" "xzf - -C /tmp/caddy" "Extracting the files from the archive..." 54 | rm /tmp/caddy.tar.gz 55 | 56 | # Put the caddy binary to its directrory 57 | mv /tmp/caddy/caddy /usr/local/bin 58 | chmod 755 /usr/local/bin/caddy 59 | 60 | # Give the caddy binary the ability to bind to privileged ports (e.g. 80, 443) as a non-root user 61 | setcap 'cap_net_bind_service=+ep' /usr/local/bin/caddy 62 | 63 | # Put the caddy systemd service to its directrory 64 | mv /tmp/caddy/init/linux-systemd/caddy.service /etc/systemd/system 65 | 66 | # Set additional security directives. Only working with systemd v229 67 | if [ "$(systemctl --version | sed -n 's/systemd \([^ ]*\).*/\1/p')" -ge 229 ]; then 68 | # Uncommenting 69 | sed -i -e 's/;CapabilityBoundingSet/CapabilityBoundingSet/' -e 's/;AmbientCapabilities/AmbientCapabilities/' -e 's/;NoNewPrivileges/NoNewPrivileges/' /etc/systemd/system/caddy.service 70 | fi 71 | 72 | rm -r /tmp/caddy 73 | 74 | if [ "$1" = update ] ;then 75 | systemctl daemon-reload 76 | systemctl restart caddy 77 | whiptail --msgbox "Caddy updated!" 8 32 78 | else 79 | # Start Caddy and enable the auto-start it at boot 80 | systemctl start caddy 81 | systemctl enable caddy 82 | 83 | grep -q Caddy dp.cfg || echo Caddy >> dp.cfg 84 | whiptail --msgbox " Caddy installed! 85 | Caddy run as 'www-data' user and group 86 | 87 | You can modify the Caddy configuration files: 88 | Caddyfile configuration: '/etc/caddy/Caddyfile' 89 | Service configuration: '/etc/systemd/system/caddy.service'" 12 64 90 | fi 91 | else 92 | echo "Caddy is already installed" 93 | fi 94 | 95 | if grep "$1" /etc/caddy/Caddyfile ;then 96 | # Remove the app entry from the Caddyfile 97 | sed "/$1/,/}/d" /etc/caddy/Caddyfile 98 | 99 | # Restart Caddy to apply the changes 100 | systemctl restart caddy 101 | fi 102 | -------------------------------------------------------------------------------- /sysutils/Docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$1" = update ] && { [ $ARCH = amd64 ] && $install docker-engine || $install docker.io || $install docker; whiptail --msgbox "Docker updated!" 8 32; break; } 4 | [ "$1" = remove ] && { [ $ARCH = amd64 ] && $remove docker-engine || $remove docker.io || $remove docker; whiptail --msgbox "Docker removed." 8 32; break; } 5 | 6 | # Get the latest Docker package. 7 | hash docker 2>/dev/null && echo Docker is already installed || [ $ARCH = amd64 ] && curl -sSL https://get.docker.com/ | sh || $install docker.io || $install docker 8 | 9 | grep -q Docker dp.cfg 2>/dev/null || echo Docker >> dp.cfg 10 | -------------------------------------------------------------------------------- /sysutils/MongoDB.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$1" = update ] && { hash mongodb-org 2>/dev/null && $install mongodb-org; hash mongodb-server 2>/dev/null && [ $DIST$DIST_VER != debian8 ] && $install mongodb-server; whiptail --msgbox "MongoDB updated!" 8 32; break; } 4 | [ "$1" = remove ] && { $remove 'mongo*'; whiptail --msgbox "MongoDB removed." 8 32; break; } 5 | 6 | if hash mongo 2>/dev/null ;then 7 | # Check MongoDB version 8 | mongo_ver=$(mongo --version) 9 | # Keep the version number 10 | mongo_ver=${mongo_ver#*: } 11 | mongo_ver=${mongo_ver%.*} 12 | # Concatenate major and minor version numbers together 13 | mongo_ver=${mongo_ver%.*}${mongo_ver#*.} 14 | fi 15 | 16 | # Check if the mongodv version is recent 17 | if [ "$mongo_ver" -gt 25 ] 2> /dev/null ;then 18 | echo You have the newer MongoDB version available 19 | 20 | elif [ $PKG = pkg ] ;then 21 | $install mongodb 22 | 23 | elif [ $ARCHf = arm ] ;then 24 | [ $DIST$DIST_VER = debian8 ] && echo "deb http://httpredir.debian.org/debian stretch main contrib non-free" >> /etc/apt/sources.list && apt update 25 | $install mongodb-server 26 | [ $DIST$DIST_VER = debian8 ] && sed -i '$ d' /etc/apt/sources.list && apt update 27 | ln -s /lib/systemd/system/mongodb.service /lib/systemd/system/mongod.service 28 | 29 | elif [ $ARCHf = x86 ] ;then 30 | [ $PKG = deb ] && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 31 | case "$DIST$DIST_VER" in 32 | ubuntu12.04) echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list;; 33 | ubuntu14.04) echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list;; 34 | ubuntu16.04) echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list;; 35 | debian7) echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.4 main" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list;; 36 | debian8) echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list;; 37 | centos*|redhat*) cat > /etc/yum.repos.d/mongodb-org-3.4.repo </dev/null || echo MongoDB >> $DIR/dp.cfg 55 | -------------------------------------------------------------------------------- /sysutils/Node.js.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$1" = update ] && [ $ARCH != arm64 ] && [ $PKG = deb ] && { apt-get update; $install nodejs; whiptail --msgbox "Node.js updated!" 8 32; break; } 4 | [ "$1" = update ] && [ $PKG = rpm ] && { yum update; $install nodejs; whiptail --msgbox "Node.js updated!" 8 32; break; } 5 | [ "$1" = remove ] && [ $ARCH = arm64 ] && [ $PKG = deb ] && { cd /usr; rm -rf */node*; rm -rf doc/node; rm -rf share/*/*/node*; rm bin/npm; whiptail --msgbox "Node.js removed." 8 32; break; } 6 | [ "$1" = remove ] && { $remove nodejs; whiptail --msgbox "Node.js removed." 8 32; break; } 7 | 8 | 9 | # https://github.com/nodesource/distributions/ 10 | if hash npm 2>/dev/null && [ "$1" = "" ] ;then 11 | echo "You have Node.js installed" 12 | elif [ $ARCH != arm64 ] ;then 13 | curl -sL https://$PKG.nodesource.com/setup_8.x | bash - 14 | $install nodejs 15 | echo "Node.js installed" 16 | 17 | elif [ $PKG = deb ] ;then 18 | # Install Node.js directly from the official archive 19 | arch=x64 20 | [ $ARCHf = arm ] && arch=${ARCH}l 21 | [ $ARCH = arm64 ] && arch=arm64 22 | [ $ARCH = 86 ] && arch=x86 23 | 24 | ver=$(curl https://nodejs.org/dist/latest-v8.x/SHASUMS256.txt) 25 | ver=${ver##*v} 26 | ver=${ver%%-*} 27 | cd /tmp 28 | download "https://nodejs.org/dist/v$ver/node-v$ver-linux-$arch.tar.xz" "Downloading the Node.js $ver archive..." 29 | 30 | # Extract the downloaded archive and remove it 31 | extract node-v$ver-linux-$arch.tar.xz "xJf -" "Extracting the files from the archive..." 32 | 33 | # Remove not used files 34 | rm node-v$ver-linux-$arch/*.md node-v$ver-linux-$arch/LICENSE 35 | 36 | # Merge the folder in the usr directory 37 | rsync -aPr node-v$ver-linux-$arch/* /usr 38 | rm -r node-v$ver-linux-$arch* 39 | 40 | [ "$1" = install ] && state=installed || state=updated 41 | echo "Node.js $state ($ver)" 42 | else 43 | [ $PKG = rpm ] && $install epel-release 44 | $install nodejs npm 45 | echo "Node.js installed" 46 | fi 47 | 48 | grep -q Node.js $DIR/dp.cfg 2>/dev/null || echo Node.js >> $DIR/dp.cfg 49 | -------------------------------------------------------------------------------- /sysutils/service.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | service_detection() { 4 | service_list= 5 | service_list="systemd [status]auto-start-at-boot" 6 | 7 | # Parse line by line dp.cfg, and create en entry for each 8 | while read service ;do 9 | # Covert uppercase app name to lowercase service name 10 | service=$(echo "$service" | tr '[:upper:]' '[:lower:]') 11 | 12 | # Correct the service name of the app 13 | [ $service = mumble ] && service_list="$service_list mumble-server ${service_description#*=}[$(systemctl is-active mumble-server)]$(systemctl is-enabled mumble-server)" 14 | [ $service = deluge ] && service=deluged 15 | [ $service = mongodb ] && service=mongod 16 | # Only create an entry for existing services 17 | if [ -f /etc/systemd/system/$service.service ] || [ -f /lib/systemd/system/$service.service ] ;then 18 | # Concatenate the service into a list 19 | service_list="$service_list $service ${service_description#*=}[$(systemctl is-active $service)]$(systemctl is-enabled $service)" 20 | fi 21 | # Add related services to the app 22 | [ $service = seafile ] && service_list="$service_list seahub [$(systemctl is-active seahub)]$(systemctl is-enabled seahub)" 23 | [ $service = deluge ] && service_list="$service_list deluge-web [$(systemctl is-active deluge-web)]$(systemctl is-enabled deluge-web)" 24 | done < dp.cfg 25 | } 26 | 27 | # Service's setup menu 28 | service_setup(){ 29 | 30 | restart= 31 | # Create entries in function of actual service status and configuration 32 | [ $(systemctl is-active $service_choice) = inactive ] && state_action=Start || state_action=Stop && restart="Restart Restart_the_current_${service_choice}_service_process" 33 | [ $(systemctl is-enabled $service_choice) = enabled ] && enabled_state=Disable 34 | [ $(systemctl is-enabled $service_choice) = disabled ] && enabled_state=Enable 35 | 36 | service_action=$(whiptail --title "$service_choice service setup" --menu " $(systemctl show $service_choice -p Description) 37 | Active status: $(systemctl is-active $service_choice) 38 | Auto-start at boot: $(systemctl is-enabled $service_choice)" 14 72 4 \ 39 | $state_action "$state_action the current $service_choice service process" $restart \ 40 | ${enabled_state}_auto-start-at-boot "$enabled_state the current $service_choice service process" \ 41 | Status "Details about the current service status" \ 42 | 3>&1 1>&2 2>&3) 43 | case $service_action in 44 | Stop) systemctl stop $service_choice; whiptail --msgbox "$service_choice stopped" 8 32;; 45 | Start) systemctl start $service_choice; whiptail --msgbox "$service_choice started" 8 32;; 46 | Restart) systemctl restart $service_choice; whiptail --msgbox "$service_choice restarted" 8 32;; 47 | Disable_auto-start-at-boot) systemctl disable $service_choice; whiptail --msgbox "$service_choice disabled" 8 32;; 48 | Enable_auto-start-at-boot) systemctl enable $service_choice; whiptail --msgbox "$service_choice enabled" 8 32;; 49 | Status) whiptail --msgbox "$(systemctl status $service_choice)" 11 64;; 50 | esac 51 | } 52 | 53 | # Main App Service Manager menu 54 | if [ "$1" = "" ] ;then 55 | while 56 | service_detection 57 | used_memory=$(free -m | awk '/Mem/ {printf "%.2g\n", (($3+$5)/1000)}') 58 | total_memory=$(free -m | awk '/Mem/ {printf "%.2g\n", ($2/1000)}') 59 | 60 | service_choice=$(whiptail --title "App Service Manager" --menu " 61 | Select with Arrows <-v-> and/or Tab <=> 62 | Memory usage: $used_memory GiB used / $total_memory GiB total" 16 72 6 \ 63 | $service_list 3>&1 1>&2 2>&3) ;do 64 | cd $DIR 65 | [ $service_choice = systemd ] && whiptail --msgbox "$(systemctl status)" 11 64 || service_setup 66 | service_detection 67 | done 68 | 69 | elif [ "$1" = remove ] ;then 70 | # Convert uppercase app name to lowercase service name 71 | name=$(echo "$2" | tr '[:upper:]' '[:lower:]') 72 | systemctl stop $name 73 | systemctl disable $name 74 | rm /etc/systemd/system/$name.service 75 | systemctl daemon-reload 76 | systemctl reset-failed 77 | 78 | # Create systemd service 79 | else 80 | # Convert uppercase app name to lowercase service name 81 | name=$(echo "$1" | tr '[:upper:]' '[:lower:]') 82 | [ "$4" != "" ] && user=$4 || user=$USER 83 | cat > "/etc/systemd/system/$name.service" <