2018-03-12 10:51:30 +01:00
|
|
|
#!/bin/bash
|
2018-04-08 14:30:21 +02:00
|
|
|
# _____ _ _
|
|
|
|
# | __|___ ___ ___ _| |___ _____| |_ ___ ___ ___
|
|
|
|
# | __| _| -_| -_| . | . | | . | . | | -_|
|
|
|
|
# |__| |_| |___|___|___|___|_|_|_|___|___|_|_|___|
|
2018-03-12 10:51:30 +01:00
|
|
|
#
|
2018-04-08 14:30:21 +02:00
|
|
|
# Freedom in the Cloud
|
2018-03-12 10:51:30 +01:00
|
|
|
#
|
|
|
|
# Elixir functions
|
|
|
|
#
|
|
|
|
# There's a problem with installing this onto mesh images, which is
|
|
|
|
# that qemu appears to run out of RAM when using yarn to add webpack.
|
|
|
|
#
|
|
|
|
# License
|
|
|
|
# =======
|
|
|
|
#
|
|
|
|
# Copyright (C) 2018 Bob Mottram <bob@freedombone.net>
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program 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 Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2018-03-12 11:06:45 +01:00
|
|
|
erlang_package='erlang-solutions_1.0_all.deb'
|
|
|
|
|
2018-03-12 10:51:30 +01:00
|
|
|
function remove_elixir {
|
|
|
|
apt-get -yq remove elixir erlang-xmerl erlang-dev erlang-parsetools
|
|
|
|
apt-get -yq remove esl-erlang
|
|
|
|
}
|
|
|
|
|
|
|
|
function install_elixir {
|
2018-03-12 11:06:45 +01:00
|
|
|
if [ -f /usr/local/bin/mix ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2018-03-12 10:51:30 +01:00
|
|
|
apt-get -yq install wget build-essential
|
|
|
|
|
|
|
|
if [ ! -d "$INSTALL_DIR" ]; then
|
|
|
|
mkdir -p "$INSTALL_DIR"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "$INSTALL_DIR" || exit 768345274
|
|
|
|
wget https://packages.erlang-solutions.com/$erlang_package
|
|
|
|
if [ ! -f "$INSTALL_DIR/$erlang_package" ]; then
|
|
|
|
exit 72853
|
|
|
|
fi
|
|
|
|
dpkg -i $erlang_package
|
|
|
|
apt-get -yq update
|
|
|
|
apt-get -yq install esl-erlang
|
|
|
|
apt-get -yq install elixir erlang-xmerl erlang-dev erlang-parsetools
|
|
|
|
|
|
|
|
if [ ! -f /usr/local/bin/mix ]; then
|
|
|
|
echo $'/usr/local/bin/mix not found after elixir installation'
|
|
|
|
exit 629352
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-03-12 11:06:45 +01:00
|
|
|
function image_install_elixir {
|
|
|
|
if [[ $VARIANT == "mesh"* ]]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
# shellcheck disable=SC2154
|
|
|
|
chroot "$rootdir" apt-get -yq install wget build-essential
|
|
|
|
|
|
|
|
if [ ! -d "$rootdir$INSTALL_DIR" ]; then
|
|
|
|
mkdir -p "$rootdir$INSTALL_DIR"
|
|
|
|
fi
|
|
|
|
|
|
|
|
{ echo '#!/bin/bash';
|
2018-03-12 11:08:47 +01:00
|
|
|
echo "cd $INSTALL_DIR || exit 1";
|
2018-03-12 11:06:45 +01:00
|
|
|
echo "erlang_package=$erlang_package";
|
|
|
|
echo "wget https://packages.erlang-solutions.com/\$erlang_package";
|
2018-03-12 15:19:28 +01:00
|
|
|
echo "if [ ! -f \"$INSTALL_DIR/\$erlang_package\" ]; then";
|
2018-03-12 11:08:47 +01:00
|
|
|
echo ' exit 2';
|
2018-03-12 11:06:45 +01:00
|
|
|
echo 'fi';
|
|
|
|
echo "dpkg -i \$erlang_package"; } > "$rootdir/usr/bin/install_elixir"
|
|
|
|
chmod +x "$rootdir/usr/bin/install_elixir"
|
|
|
|
chroot "$rootdir" /usr/bin/install_elixir
|
|
|
|
chroot "$rootdir" apt-get -yq update
|
|
|
|
chroot "$rootdir" apt-get -yq install esl-erlang
|
|
|
|
chroot "$rootdir" apt-get -yq install elixir erlang-xmerl erlang-dev erlang-parsetools
|
|
|
|
|
|
|
|
if [ ! -f "$rootdir/usr/local/bin/mix" ]; then
|
|
|
|
echo $'/usr/local/bin/mix not found after elixir installation'
|
|
|
|
exit 629352
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-03-12 10:51:30 +01:00
|
|
|
# NOTE: deliberately no exit 0
|