:: Re: [DNG] Script to migrate buster …
Page principale
Supprimer ce message
Répondre à ce message
Auteur: Antoine
Date:  
À: dng
Sujet: Re: [DNG] Script to migrate buster desktop to beowulf v1.6
On Wednesday, 14 April at 16:13, tito via Dng wrote:
>
>Hi,
>thanks for your time and effort. My question was rather practical,
>so let me rephrase it: is there a robust way to detect from a script
>if buster non-free and contrib repos are enabled in
>/etc/apt/sources.lists so that I can add the same repos for
>beowulf to sources.list?


Are you looking for something like this?

cat /etc/apt/sources.list /etc/apt/sources.list.d/* | grep -E
'^[^#].*buster.*contrib.*$' > /dev/null 2> /dev/null && contrib=1 || unset
contrib

cat /etc/apt/sources.list /etc/apt/sources.list.d/* | grep -E
'^[^#].*buster.*non-free.*$' > /dev/null 2> /dev/null && nonfree=1 || unset
nonfree

These two lines set the "contrib" and "nonfree" shell variables to 1 if
contrib or non-free are present and uncommented anywhere in the sources list,
or unset them if not.

>Ciao,
>Tito
>


- AnimaInvicta

--
To ask is allowed. To answer is a courtesy.