|
@ -110,7 +110,7 @@ function prepare_nftables() { |
|
|
|
|
|
|
|
|
function miaou_init() { |
|
|
function miaou_init() { |
|
|
# shellcheck source=/dev/null |
|
|
# shellcheck source=/dev/null |
|
|
[[ -f /opt/debian-bash/lib/functions.sh ]] && source /opt/debian-bash/lib/functions.sh |
|
|
|
|
|
|
|
|
[[ -f /opt/miaou-bash/lib/functions.sh ]] && source /opt/miaou-bash/lib/functions.sh |
|
|
|
|
|
|
|
|
# shellcheck source=/dev/null |
|
|
# shellcheck source=/dev/null |
|
|
. "$MIAOU_BASEDIR/lib/functions.sh" |
|
|
. "$MIAOU_BASEDIR/lib/functions.sh" |
|
@ -215,7 +215,7 @@ function container_exists() { |
|
|
lxc list "$1" -c n -f csv | grep -q "^$1\$" |
|
|
lxc list "$1" -c n -f csv | grep -q "^$1\$" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# build debian image with prebuild debian-bash and various useful settings |
|
|
|
|
|
|
|
|
# build debian image with prebuild miaou-bash and various useful settings |
|
|
# ARG1=release [bullseye, buster] |
|
|
# ARG1=release [bullseye, buster] |
|
|
function build_miaou_image() { |
|
|
function build_miaou_image() { |
|
|
local RELEASE="$1" |
|
|
local RELEASE="$1" |
|
@ -230,7 +230,7 @@ function build_miaou_image() { |
|
|
echo "building lxc image <$IMAGE_LABEL> ... " |
|
|
echo "building lxc image <$IMAGE_LABEL> ... " |
|
|
echo "image will reuse same local repository <$DEB_REPOSITORY>" |
|
|
echo "image will reuse same local repository <$DEB_REPOSITORY>" |
|
|
creation_date=$(date +%s) |
|
|
creation_date=$(date +%s) |
|
|
sudo /opt/debian-bash/tools/idem_apt_install debootstrap |
|
|
|
|
|
|
|
|
sudo /opt/miaou-bash/tools/idem_apt_install debootstrap |
|
|
|
|
|
|
|
|
cat <<EOF1 | sudo bash |
|
|
cat <<EOF1 | sudo bash |
|
|
set -euo pipefail |
|
|
set -euo pipefail |
|
@ -263,8 +263,11 @@ EOF3 |
|
|
|
|
|
|
|
|
apt update && apt dist-upgrade -y |
|
|
apt update && apt dist-upgrade -y |
|
|
apt install -y curl wget file git sudo bash-completion |
|
|
apt install -y curl wget file git sudo bash-completion |
|
|
curl https://git.artcode.re/pvincent/debian-bash/raw/branch/master/install.sh | sudo bash -s -- --host |
|
|
|
|
|
ln -sf /usr/share/zoneinfo/Indian/Reunion /etc/localtime |
|
|
|
|
|
|
|
|
curl https://git.artcode.re/miaou/miaou-bash/raw/branch/main/install.sh | sudo bash -s -- --host |
|
|
|
|
|
|
|
|
|
|
|
# TODO: remove line below |
|
|
|
|
|
# ln -sf /usr/share/zoneinfo/Indian/Reunion /etc/localtime |
|
|
|
|
|
|
|
|
cat <<EOF3 >/etc/network/interfaces |
|
|
cat <<EOF3 >/etc/network/interfaces |
|
|
# This file describes the network interfaces available on your system |
|
|
# This file describes the network interfaces available on your system |
|
|
# and how to activate them. For more information, see interfaces(5). |
|
|
# and how to activate them. For more information, see interfaces(5). |
|
@ -418,26 +421,24 @@ function env_or_ask { |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# install_debian_bash() |
|
|
|
|
|
# grab and install related project |
|
|
# grab and install related project |
|
|
function install_debian_bash() { |
|
|
|
|
|
local PREFIX="debian-bash:install" |
|
|
|
|
|
if [[ ! -d /opt/debian-bash ]]; then |
|
|
|
|
|
|
|
|
function install_miaou_bash() { |
|
|
|
|
|
local PREFIX="miaou-bash:install" |
|
|
|
|
|
if [[ ! -d /opt/miaou-bash ]]; then |
|
|
echo "installing curl wget commands ..." |
|
|
echo "installing curl wget commands ..." |
|
|
apt install -y curl wget |
|
|
apt install -y curl wget |
|
|
|
|
|
|
|
|
echo "installing debian-bash..." |
|
|
|
|
|
curl https://git.artcode.re/pvincent/debian-bash/raw/branch/master/install.sh | sudo bash -s -- --host |
|
|
|
|
|
export PATH=$PATH:/opt/debian-bash/tools/ |
|
|
|
|
|
|
|
|
echo "installing miaou-bash..." |
|
|
|
|
|
curl https://git.artcode.re/miaou/miaou-bash/raw/branch/main/install.sh | sudo bash -s -- --host |
|
|
|
|
|
export PATH=$PATH:/opt/miaou-bash/tools/ |
|
|
echo "OK" |
|
|
echo "OK" |
|
|
else |
|
|
else |
|
|
# /opt/debian-bash/tools/debian_bash_upgrade |
|
|
|
|
|
echo "addon <debian-bash> already installed!" |
|
|
|
|
|
|
|
|
echo "addon <miaou-bash> already installed!" |
|
|
fi |
|
|
fi |
|
|
# shellcheck source=/dev/null |
|
|
# shellcheck source=/dev/null |
|
|
source /etc/bash.bashrc |
|
|
source /etc/bash.bashrc |
|
|
|
|
|
|
|
|
sudo /opt/debian-bash/tools/idem_apt_install bash-completion |
|
|
|
|
|
|
|
|
sudo /opt/miaou-bash/tools/idem_apt_install bash-completion |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function add_toolbox_sudoers { |
|
|
function add_toolbox_sudoers { |
|
@ -463,7 +464,7 @@ function prepare_toolbox() { |
|
|
curl -sSf https://sh.rustup.rs | sh -s -- -y |
|
|
curl -sSf https://sh.rustup.rs | sh -s -- -y |
|
|
# shellcheck source=/dev/null |
|
|
# shellcheck source=/dev/null |
|
|
source "$HOME/.cargo/env" |
|
|
source "$HOME/.cargo/env" |
|
|
/opt/debian-bash/tools/append_or_replace "^PATH=\$PATH:\$HOME/\\.cargo/bin" "PATH=\$PATH:\$HOME/.cargo/bin" ~/.bashrc |
|
|
|
|
|
|
|
|
/opt/miaou-bash/tools/append_or_replace "^PATH=\$PATH:\$HOME/\\.cargo/bin" "PATH=\$PATH:\$HOME/.cargo/bin" ~/.bashrc |
|
|
PREFIX="" echo "OK" |
|
|
PREFIX="" echo "OK" |
|
|
else |
|
|
else |
|
|
echo "command <cargo> already installed!" |
|
|
echo "command <cargo> already installed!" |
|
@ -490,7 +491,7 @@ function prepare_toolbox() { |
|
|
echo -n "installing <rg> alias <ripgrep> ... " |
|
|
echo -n "installing <rg> alias <ripgrep> ... " |
|
|
if [ ! -f "/TOOLBOX/rg" ]; then |
|
|
if [ ! -f "/TOOLBOX/rg" ]; then |
|
|
|
|
|
|
|
|
sudo /opt/debian-bash/tools/idem_apt_install ripgrep |
|
|
|
|
|
|
|
|
sudo /opt/miaou-bash/tools/idem_apt_install ripgrep |
|
|
sudo ln /usr/bin/rg /TOOLBOX/ |
|
|
sudo ln /usr/bin/rg /TOOLBOX/ |
|
|
PREFIX="" echo "successfully installed" |
|
|
PREFIX="" echo "successfully installed" |
|
|
else |
|
|
else |
|
@ -499,7 +500,7 @@ function prepare_toolbox() { |
|
|
|
|
|
|
|
|
echo -n "installing <ag> alias <silversearcher-ag> ... " |
|
|
echo -n "installing <ag> alias <silversearcher-ag> ... " |
|
|
if [ ! -f "/TOOLBOX/ag" ]; then |
|
|
if [ ! -f "/TOOLBOX/ag" ]; then |
|
|
sudo /opt/debian-bash/tools/idem_apt_install silversearcher-ag |
|
|
|
|
|
|
|
|
sudo /opt/miaou-bash/tools/idem_apt_install silversearcher-ag |
|
|
sudo ln /usr/bin/ag /TOOLBOX/ |
|
|
sudo ln /usr/bin/ag /TOOLBOX/ |
|
|
PREFIX="" echo "successfully installed" |
|
|
PREFIX="" echo "successfully installed" |
|
|
else |
|
|
else |
|
@ -541,7 +542,7 @@ function prepare_toolbox() { |
|
|
|
|
|
|
|
|
echo -n "installing <ncdu> ... " |
|
|
echo -n "installing <ncdu> ... " |
|
|
if [ ! -f "/TOOLBOX/ncdu" ]; then |
|
|
if [ ! -f "/TOOLBOX/ncdu" ]; then |
|
|
sudo /opt/debian-bash/tools/idem_apt_install ncdu |
|
|
|
|
|
|
|
|
sudo /opt/miaou-bash/tools/idem_apt_install ncdu |
|
|
sudo cp /usr/bin/ncdu /TOOLBOX/ncdu |
|
|
sudo cp /usr/bin/ncdu /TOOLBOX/ncdu |
|
|
PREFIX="" echo "successfully installed" |
|
|
PREFIX="" echo "successfully installed" |
|
|
else |
|
|
else |
|
@ -550,7 +551,7 @@ function prepare_toolbox() { |
|
|
|
|
|
|
|
|
echo -n "installing <unzip> ... " |
|
|
echo -n "installing <unzip> ... " |
|
|
if [ ! -f "/TOOLBOX/unzip" ]; then |
|
|
if [ ! -f "/TOOLBOX/unzip" ]; then |
|
|
sudo /opt/debian-bash/tools/idem_apt_install unzip |
|
|
|
|
|
|
|
|
sudo /opt/miaou-bash/tools/idem_apt_install unzip |
|
|
sudo cp /usr/bin/unzip /TOOLBOX/unzip |
|
|
sudo cp /usr/bin/unzip /TOOLBOX/unzip |
|
|
PREFIX="" echo "successfully installed" |
|
|
PREFIX="" echo "successfully installed" |
|
|
else |
|
|
else |
|
@ -559,7 +560,7 @@ function prepare_toolbox() { |
|
|
|
|
|
|
|
|
echo -n "installing <tree> ... " |
|
|
echo -n "installing <tree> ... " |
|
|
if [ ! -f "/TOOLBOX/tree" ]; then |
|
|
if [ ! -f "/TOOLBOX/tree" ]; then |
|
|
sudo /opt/debian-bash/tools/idem_apt_install tree |
|
|
|
|
|
|
|
|
sudo /opt/miaou-bash/tools/idem_apt_install tree |
|
|
sudo cp /bin/tree /TOOLBOX/tree |
|
|
sudo cp /bin/tree /TOOLBOX/tree |
|
|
PREFIX="" echo "successfully installed" |
|
|
PREFIX="" echo "successfully installed" |
|
|
else |
|
|
else |
|
@ -568,7 +569,7 @@ function prepare_toolbox() { |
|
|
|
|
|
|
|
|
echo -n "installing <duf> ... " |
|
|
echo -n "installing <duf> ... " |
|
|
if [ ! -f "/TOOLBOX/duf" ]; then |
|
|
if [ ! -f "/TOOLBOX/duf" ]; then |
|
|
VERSION=$(/opt/debian-bash/tools/wget_semver github muesli/duf) |
|
|
|
|
|
|
|
|
VERSION=$(/opt/miaou-bash/tools/wget_semver github muesli/duf) |
|
|
VERSION_WITHOUT_V=${VERSION#v} |
|
|
VERSION_WITHOUT_V=${VERSION#v} |
|
|
wget -O /tmp/duf.deb "https://github.com/muesli/duf/releases/download/${VERSION}/duf_${VERSION_WITHOUT_V}_linux_amd64.deb" |
|
|
wget -O /tmp/duf.deb "https://github.com/muesli/duf/releases/download/${VERSION}/duf_${VERSION_WITHOUT_V}_linux_amd64.deb" |
|
|
sudo dpkg -i /tmp/duf.deb |
|
|
sudo dpkg -i /tmp/duf.deb |
|
@ -601,7 +602,7 @@ function prepare_toolbox() { |
|
|
function install_mandatory_commands() { |
|
|
function install_mandatory_commands() { |
|
|
local PREFIX="mandatory:commands" |
|
|
local PREFIX="mandatory:commands" |
|
|
|
|
|
|
|
|
sudo /opt/debian-bash/tools/idem_apt_install dnsutils build-essential curl mariadb-client postgresql-client |
|
|
|
|
|
|
|
|
sudo /opt/miaou-bash/tools/idem_apt_install dnsutils build-essential curl mariadb-client postgresql-client |
|
|
|
|
|
|
|
|
if ! exist_command tera; then |
|
|
if ! exist_command tera; then |
|
|
echo "installing <tera> ..." |
|
|
echo "installing <tera> ..." |
|
|