change debian-bash to miaou-bash
This commit is contained in:
+24
-23
@@ -110,7 +110,7 @@ function prepare_nftables() {
|
||||
|
||||
function miaou_init() {
|
||||
# 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
|
||||
. "$MIAOU_BASEDIR/lib/functions.sh"
|
||||
@@ -215,7 +215,7 @@ function container_exists() {
|
||||
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]
|
||||
function build_miaou_image() {
|
||||
local RELEASE="$1"
|
||||
@@ -230,7 +230,7 @@ function build_miaou_image() {
|
||||
echo "building lxc image <$IMAGE_LABEL> ... "
|
||||
echo "image will reuse same local repository <$DEB_REPOSITORY>"
|
||||
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
|
||||
set -euo pipefail
|
||||
@@ -263,8 +263,11 @@ EOF3
|
||||
|
||||
apt update && apt dist-upgrade -y
|
||||
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
|
||||
# This file describes the network interfaces available on your system
|
||||
# and how to activate them. For more information, see interfaces(5).
|
||||
@@ -418,26 +421,24 @@ function env_or_ask {
|
||||
fi
|
||||
}
|
||||
|
||||
# install_debian_bash()
|
||||
# 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 ..."
|
||||
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"
|
||||
else
|
||||
# /opt/debian-bash/tools/debian_bash_upgrade
|
||||
echo "addon <debian-bash> already installed!"
|
||||
echo "addon <miaou-bash> already installed!"
|
||||
fi
|
||||
# shellcheck source=/dev/null
|
||||
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 {
|
||||
@@ -463,7 +464,7 @@ function prepare_toolbox() {
|
||||
curl -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
# shellcheck source=/dev/null
|
||||
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"
|
||||
else
|
||||
echo "command <cargo> already installed!"
|
||||
@@ -490,7 +491,7 @@ function prepare_toolbox() {
|
||||
echo -n "installing <rg> alias <ripgrep> ... "
|
||||
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/
|
||||
PREFIX="" echo "successfully installed"
|
||||
else
|
||||
@@ -499,7 +500,7 @@ function prepare_toolbox() {
|
||||
|
||||
echo -n "installing <ag> alias <silversearcher-ag> ... "
|
||||
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/
|
||||
PREFIX="" echo "successfully installed"
|
||||
else
|
||||
@@ -541,7 +542,7 @@ function prepare_toolbox() {
|
||||
|
||||
echo -n "installing <ncdu> ... "
|
||||
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
|
||||
PREFIX="" echo "successfully installed"
|
||||
else
|
||||
@@ -550,7 +551,7 @@ function prepare_toolbox() {
|
||||
|
||||
echo -n "installing <unzip> ... "
|
||||
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
|
||||
PREFIX="" echo "successfully installed"
|
||||
else
|
||||
@@ -559,7 +560,7 @@ function prepare_toolbox() {
|
||||
|
||||
echo -n "installing <tree> ... "
|
||||
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
|
||||
PREFIX="" echo "successfully installed"
|
||||
else
|
||||
@@ -568,7 +569,7 @@ function prepare_toolbox() {
|
||||
|
||||
echo -n "installing <duf> ... "
|
||||
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}
|
||||
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
|
||||
@@ -601,7 +602,7 @@ function prepare_toolbox() {
|
||||
function install_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
|
||||
echo "installing <tera> ..."
|
||||
|
||||
+6
-6
@@ -87,7 +87,7 @@ function prepare_proxy() {
|
||||
|
||||
if ! grep -Eq "^precedence ::ffff:0:0/96.*" /etc/gai.conf; then
|
||||
echo "prefer ipv4 ..."
|
||||
sudo /opt/debian-bash/tools/append_or_replace "^precedence ::ffff:0:0/96.*" "precedence ::ffff:0:0/96 100" /etc/gai.conf
|
||||
sudo /opt/miaou-bash/tools/append_or_replace "^precedence ::ffff:0:0/96.*" "precedence ::ffff:0:0/96 100" /etc/gai.conf
|
||||
echo "OK"
|
||||
else
|
||||
echo "ipv4 already prefered!"
|
||||
@@ -95,7 +95,7 @@ function prepare_proxy() {
|
||||
|
||||
if ! grep -Eq "^net.ipv4.ip_forward=1" /etc/sysctl.conf; then
|
||||
echo "allow forwarding from kernel ..."
|
||||
sudo /opt/debian-bash/tools/append_or_replace "^net.ipv4.ip_forward=1.*" "net.ipv4.ip_forward=1" /etc/sysctl.conf
|
||||
sudo /opt/miaou-bash/tools/append_or_replace "^net.ipv4.ip_forward=1.*" "net.ipv4.ip_forward=1" /etc/sysctl.conf
|
||||
sudo sysctl -p
|
||||
echo "OK"
|
||||
else
|
||||
@@ -163,7 +163,7 @@ function mailer_alert() {
|
||||
done
|
||||
|
||||
echo "installing <msmtp> ..."
|
||||
sudo /opt/debian-bash/tools/idem_apt_install msmtp msmtp-mta mailutils bsd-mailx
|
||||
sudo /opt/miaou-bash/tools/idem_apt_install msmtp msmtp-mta mailutils bsd-mailx
|
||||
echo "OK"
|
||||
|
||||
echo "configuring </etc/aliases>"
|
||||
@@ -232,7 +232,7 @@ function alert_at_ssh_password() {
|
||||
echo "installing alert_at_ssh_password..."
|
||||
sudo cp "$MIAOU_BASEDIR/templates/hardened/pam/alert_ssh_password.sh" /usr/local/bin/
|
||||
sudo chmod 700 /usr/local/bin/alert_ssh_password.sh
|
||||
sudo /opt/debian-bash/tools/append_or_replace "^session optional pam_exec.so /usr/local/bin/alert_ssh_password.sh" "session optional pam_exec.so /usr/local/bin/alert_ssh_password.sh" /etc/pam.d/sshd
|
||||
sudo /opt/miaou-bash/tools/append_or_replace "^session optional pam_exec.so /usr/local/bin/alert_ssh_password.sh" "session optional pam_exec.so /usr/local/bin/alert_ssh_password.sh" /etc/pam.d/sshd
|
||||
echo "OK"
|
||||
else
|
||||
echo "alert_at_ssh_password already enabled!"
|
||||
@@ -243,7 +243,7 @@ function customize_motd {
|
||||
local PREFIX="harden:motd:customize"
|
||||
if [[ ! -f /etc/update-motd.d/80-users ]]; then
|
||||
echo "customizing motd..."
|
||||
sudo /opt/debian-bash/tools/idem_apt_install figlet lsb-release
|
||||
sudo /opt/miaou-bash/tools/idem_apt_install figlet lsb-release
|
||||
sudo rm -f /etc/motd
|
||||
sudo mkdir -p /etc/update-motd.d
|
||||
sudo rm -f /etc/update-motd.d/*
|
||||
@@ -274,7 +274,7 @@ PREFIX="harden"
|
||||
: $PREFIX
|
||||
|
||||
sudo_required
|
||||
install_debian_bash
|
||||
install_miaou_bash
|
||||
install_mandatory_commands
|
||||
prepare_config_hardened
|
||||
set_current_user
|
||||
|
||||
@@ -8,7 +8,7 @@ function init_strict() {
|
||||
# shellcheck source=/dev/null
|
||||
source "$MIAOU_DIR/lib/functions.sh"
|
||||
# shellcheck source=/dev/null
|
||||
source "/opt/debian-bash/lib/functions.sh"
|
||||
source "/opt/miaou-bash/lib/functions.sh"
|
||||
trap 'trap_error $? $LINENO $BASH_LINENO "$BASH_COMMAND" $(printf "::%s" ${FUNCNAME[@]})' ERR
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ function init_strict() {
|
||||
# shellcheck source=/dev/null
|
||||
source "$MIAOU_DIR/lib/functions.sh"
|
||||
# shellcheck source=/dev/null
|
||||
source "/opt/debian-bash/lib/functions.sh"
|
||||
source "/opt/miaou-bash/lib/functions.sh"
|
||||
|
||||
trap 'trap_error $? $LINENO $BASH_LINENO "$BASH_COMMAND" $(printf "::%s" ${FUNCNAME[@]})' ERR
|
||||
}
|
||||
|
||||
+2
-2
@@ -38,7 +38,7 @@ function prepare_lxd {
|
||||
echo "user <$USER> already belongs to group <lxd>!"
|
||||
fi
|
||||
|
||||
sudo /opt/debian-bash/tools/idem_apt_install lxd btrfs-progs
|
||||
sudo /opt/miaou-bash/tools/idem_apt_install lxd btrfs-progs
|
||||
|
||||
# test lxdbr0
|
||||
if ! lxc network info lxdbr0 &>/dev/null; then
|
||||
@@ -181,7 +181,7 @@ function set_alias {
|
||||
function miaou_evalfrombashrc() {
|
||||
local PREFIX="miaou:bashrc"
|
||||
output=$(
|
||||
/opt/debian-bash/tools/append_or_replace \
|
||||
/opt/miaou-bash/tools/append_or_replace \
|
||||
"^eval \"\\$\($MIAOU_BASEDIR/lib/install.sh shellenv\)\"$" \
|
||||
"eval \"\$($MIAOU_BASEDIR/lib/install.sh shellenv)\"" \
|
||||
"$HOME/.bashrc"
|
||||
|
||||
Reference in New Issue
Block a user