Mandar mensajes a stderr
Para que no entren en el "eval" de init
This commit is contained in:
parent
3c0f04cf3b
commit
d3a0fc2aef
1 changed files with 8 additions and 8 deletions
16
haini.sh
16
haini.sh
|
@ -11,18 +11,18 @@ SELF="$(basename "$0")"
|
||||||
|
|
||||||
# Sólo se puede correr desde el directorio de Sutty
|
# Sólo se puede correr desde el directorio de Sutty
|
||||||
if test "$ROOT" != "$(dirname "$PWD")" && test "$ROOT" != "$PWD"; then
|
if test "$ROOT" != "$(dirname "$PWD")" && test "$ROOT" != "$PWD"; then
|
||||||
echo "¡No estás corriendo dentro de una carpeta de Sutty!"
|
echo "¡No estás corriendo dentro de una carpeta de Sutty!" >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Necesitamos bubblewrap
|
# Necesitamos bubblewrap
|
||||||
if ! test "$HAIN_ENV" && ! type bwrap >/dev/null 2>&1 ; then
|
if ! test "$HAIN_ENV" && ! type bwrap >/dev/null 2>&1 ; then
|
||||||
echo "Por favor, instala el paquete bubblewrap"
|
echo "Por favor, instala el paquete bubblewrap" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test $(sysctl -n kernel.unprivileged_userns_clone) -ne 1 ; then
|
if test $(sysctl -n kernel.unprivileged_userns_clone) -ne 1 ; then
|
||||||
echo "Necesitamos configurar tu sistema, ingresa tu contraseña para correr el comando" >&2
|
echo "Necesitamos configurar tu sistema, ingresa tu contraseña para correr el comando" >&2
|
||||||
echo "sudo sysctl -a kernel.unprivileged_userns_clone=1"
|
echo "sudo sysctl -a kernel.unprivileged_userns_clone=1" >&2
|
||||||
sudo sysctl -a kernel.unprivileged_userns_clone=1
|
sudo sysctl -a kernel.unprivileged_userns_clone=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ fi
|
||||||
ENTORNO=${ENTORNO:-${ROOT}/hain}
|
ENTORNO=${ENTORNO:-${ROOT}/hain}
|
||||||
|
|
||||||
correr() {
|
correr() {
|
||||||
echo "> $1"
|
echo "> $1" >&2
|
||||||
|
|
||||||
env -i \
|
env -i \
|
||||||
TERM="$TERM" \
|
TERM="$TERM" \
|
||||||
|
@ -83,7 +83,7 @@ generar_certificado() {
|
||||||
if test -f "$ROOT/sutty.local/domain/sutty.local.crt"; then
|
if test -f "$ROOT/sutty.local/domain/sutty.local.crt"; then
|
||||||
SUTTY_LOCAL="$ROOT/sutty.local"
|
SUTTY_LOCAL="$ROOT/sutty.local"
|
||||||
|
|
||||||
echo "Migrando certificados de sutty.local..."
|
echo "Migrando certificados de sutty.local..." >&2
|
||||||
|
|
||||||
cp "$SUTTY_LOCAL/ca/key.key" "$ENTORNO$ca_key"
|
cp "$SUTTY_LOCAL/ca/key.key" "$ENTORNO$ca_key"
|
||||||
cp "$SUTTY_LOCAL/ca/crt.crt" "$ENTORNO$ca_crt"
|
cp "$SUTTY_LOCAL/ca/crt.crt" "$ENTORNO$ca_crt"
|
||||||
|
@ -94,7 +94,7 @@ generar_certificado() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Generando certificados..."
|
echo "Generando certificados..." >&2
|
||||||
|
|
||||||
correr "openssl req -x509 -nodes -new -sha256 -days 3650 -newkey rsa:2048 \
|
correr "openssl req -x509 -nodes -new -sha256 -days 3650 -newkey rsa:2048 \
|
||||||
-keyout $ca_key -out $ca_crt.pem -subj '/C=AR/CN=Sutty-Local-CA'"
|
-keyout $ca_key -out $ca_crt.pem -subj '/C=AR/CN=Sutty-Local-CA'"
|
||||||
|
@ -111,7 +111,7 @@ generar_certificado() {
|
||||||
|
|
||||||
rm "$ENTORNO$ca_crt.pem"
|
rm "$ENTORNO$ca_crt.pem"
|
||||||
|
|
||||||
echo "Instalando certificados..."
|
echo "Instalando certificados..." >&2
|
||||||
if which update-ca-certificates 2>/dev/null; then
|
if which update-ca-certificates 2>/dev/null; then
|
||||||
sudo install -Dm 644 "$ENTORNO$ca_crt" /usr/share/ca-certificates/extra/sutty.crt
|
sudo install -Dm 644 "$ENTORNO$ca_crt" /usr/share/ca-certificates/extra/sutty.crt
|
||||||
sudo dpkg-reconfigure ca-certificates
|
sudo dpkg-reconfigure ca-certificates
|
||||||
|
@ -147,7 +147,7 @@ crear_entorno() {
|
||||||
|
|
||||||
# Instalar las dependencias solo si cambiaron
|
# Instalar las dependencias solo si cambiaron
|
||||||
if test "$ENTORNO/etc/apk/world" -ot "$DIR/packages"; then
|
if test "$ENTORNO/etc/apk/world" -ot "$DIR/packages"; then
|
||||||
echo "Instalando paquetes..."
|
echo "Instalando paquetes..." >&2
|
||||||
packages="$(cat "$DIR/packages" | tr "\n" " ")"
|
packages="$(cat "$DIR/packages" | tr "\n" " ")"
|
||||||
correr "apk add --no-cache $packages"
|
correr "apk add --no-cache $packages"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue