Bonjour a tous
Je créer un scripts de paramétrage de Debian lors de réinstallation, mais j'ai un petit problème avec Sed, le but est modifier mon sources.list pour ajouter les backports, dans mon scripts de test je mais ceci :
sed "16i\ \n\a# buster-backports\n\adeb http://deb.debian.org/debian buster-backports main contrib non-free\n\a#deb http://deb.debian.org/debian buster-backports-sloppy main contrib non-free # available after bullseye release" /etc/apt/sources.list
Voici mon sources.list avant la modification:
#
# deb cdrom:[Debian GNU/Linux 10.4.0 _Buster_ - Official amd64 NETINST 20200509-10:25]/ buster main
#deb cdrom:[Debian GNU/Linux 10.4.0 _Buster_ - Official amd64 NETINST 20200509-10:25]/ buster main
deb http://deb.debian.org/debian/ buster main contrib non-free
deb-src http://deb.debian.org/debian/ buster main contrib non-free
deb http://security.debian.org/debian-security buster/updates main contrib non-free
deb-src http://security.debian.org/debian-security buster/updates main contrib non-free
# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ buster-updates main contrib non-free
deb-src http://deb.debian.org/debian/ buster-updates main contrib non-free
# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.
Une fois que je lance mon scripts en test le terminal me renvois :
#
# deb cdrom:[Debian GNU/Linux 10.4.0 _Buster_ - Official amd64 NETINST 20200509-10:25]/ buster main
#deb cdrom:[Debian GNU/Linux 10.4.0 _Buster_ - Official amd64 NETINST 20200509-10:25]/ buster main
deb http://deb.debian.org/debian/ buster main contrib non-free
deb-src http://deb.debian.org/debian/ buster main contrib non-free
deb http://security.debian.org/debian-security buster/updates main contrib non-free
deb-src http://security.debian.org/debian-security buster/updates main contrib non-free
# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ buster-updates main contrib non-free
deb-src http://deb.debian.org/debian/ buster-updates main contrib non-free
# buster-backports
deb http://deb.debian.org/debian buster-backports main contrib non-free
#deb http://deb.debian.org/debian buster-backports-sloppy main contrib non-free # available after bullseye release
# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.
Donc sur le coup tout me parait nickel donc je rajoute un -i après sed pour l'appliquer directement au fichier :
sed -i "16i\ \n\a# buster-backports\n\adeb http://deb.debian.org/debian buster-backports main contrib non-free\n\a#deb http://deb.debian.org/debian buster-backports-sloppy main contrib non-free # available after bullseye release" /etc/apt/sources.list
Une fois le script exécuter, le résultat n'est pas exactement a quoi je m'attendait :
#
# deb cdrom:[Debian GNU/Linux 10.4.0 _Buster_ - Official amd64 NETINST 20200509-10:25]/ buster main
#deb cdrom:[Debian GNU/Linux 10.4.0 _Buster_ - Official amd64 NETINST 20200509-10:25]/ buster main
deb http://deb.debian.org/debian/ buster main contrib non-free
deb-src http://deb.debian.org/debian/ buster main contrib non-free
deb http://security.debian.org/debian-security buster/updates main contrib non-free
deb-src http://security.debian.org/debian-security buster/updates main contrib non-free
^G# buster-updates, previously known as 'volatile'
^Gdeb http://deb.debian.org/debian/ buster-updates main contrib non-free
^Gdeb-src http://deb.debian.org/debian/ buster-updates main contrib non-free
# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.
Que vienne faire les " ^G " sur le début des ligne modifier par Sed
Dernière modification par Mca (24-08-2020 02:39:46)