
Me pregunto cuál sería la mejor manera de escribir un script bash para instalar paquetes desde el código fuente. ¿Sería necesario profundizar en cómo automatizar la tarea?
Por ejemplo, digamos que quiero compilar Apache.
cd /path/httpd
./configure -arguments here -augment here -blah blah
make
make install
Este proceso sería completamente automatizado, sin interacción humana. ¿Estaría bien simplemente pasar los argumentos como se muestra arriba o cree que debería ser más profundo con declaraciones else y demás?
Gracias por tu tiempo.
Respuesta1
Si sabe de antemano que tiene el requisito previo, puede hacerlo.
Así es como funcionaarchlinux PKGBUILD
s.
Puede usar CI-CD en su gitlab/github para probar que la compilación se realizó correctamente.
Si no está seguro, debe agregar algunas condiciones:
trap 'echo >&2 "Encountered an error"; exit 1' ERR
cd /path/httpd
./configure -arguments here -augment here -blah blah
make
make install
o
set -e
cd /path/httpd
./configure -arguments here -augment here -blah blah
make
make install
o usando lógica booleana:
cd /path/httpd &&
./configure -arguments here -augment here -blah blah &&
make &&
make install
cada comando debe tener éxito para ejecutar el siguiente.