Skip to content

Commit 4585de3

Browse files
committed
Revert "Use /etc/os-release as alternative when lsb_release is not available"
This reverts commit 49fb41c.
1 parent 598ac5a commit 4585de3

File tree

1 file changed

+7
-36
lines changed

1 file changed

+7
-36
lines changed

misc-tools/dj_make_chroot.in

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,6 @@ cleanup() {
2323
}
2424
trap cleanup EXIT
2525

26-
if command -v lsb_release; then
27-
get_host () {
28-
lsb_release -i -s
29-
}
30-
get_codename () {
31-
lsb_release -c -s
32-
}
33-
get_release () {
34-
lsb_release -r -s
35-
}
36-
elif -f /etc/os-release; then
37-
sel_grep () {
38-
# Discard everything up to \K and make sure line ends with '"'.
39-
grep -oP '^${1}="\K.*(?=")' /etc/os_release
40-
}
41-
get_host () {
42-
sel_grep "NAME"
43-
}
44-
get_codename () {
45-
sel_gep "VERSION_CODENAME"
46-
}
47-
get_release () {
48-
echo "Please install `lsb_release`."
49-
exit 1
50-
}
51-
else
52-
echo "Please install `lsb_release`."
53-
exit 1
54-
fi
55-
5626
# Default directory where to build the chroot tree:
5727
CHROOTDIR="@judgehost_chrootdir@"
5828

@@ -65,14 +35,15 @@ DEBIAN_ARCHLIST="amd64,arm64,armel,armhf,i386,mips,mips64el,mipsel,ppc64el,s390x
6535
UBUNTU_ARCHLIST="amd64,arm64,armhf,i386,powerpc,ppc64el,s390x"
6636

6737
# If host system is Debian or Ubuntu, use its release and architecture by default
68-
if [ "$(get_host)" = 'Debian' ] || [ "$(get_host)" = 'Ubuntu' ]; then
69-
DISTRO="$(get_host)"
70-
RELEASE="$(get_codename)"
71-
if [ "$(get_host)" = 'Debian' ]; then
72-
if [ "$(get_codename)" = "sid" ]; then
38+
if [ "$(lsb_release -i -s || true)" = 'Debian' ] || \
39+
[ "$(lsb_release -i -s || true)" = 'Ubuntu' ]; then
40+
DISTRO="$(lsb_release -i -s)"
41+
RELEASE="$(lsb_release -c -s)"
42+
if [ "$(lsb_release -i -s)" = 'Debian' ]; then
43+
if [ "$(lsb_release -c -s)" = "sid" ]; then
7344
RELEASE='unstable'
7445
fi
75-
if [ "$(get_release)" = 'testing' ]; then
46+
if [ "$(lsb_release -r -s)" = 'testing' ]; then
7647
RELEASE='testing'
7748
fi
7849
fi

0 commit comments

Comments
 (0)