Случайно удалите файл lsb_release

Я случайно удалил [sudo rm -r /....../lsb_releases] этот файл, как мне отменить процесс? Я не знаю, что делать, пожалуйста, помогите мне в этом.

1 ответ

Если ты имеешь ввиду/usr/bin/lsb_releaseчто на самом деле является сценарием оболочки:

      $ cat /usr/bin/lsb_release
#!/bin/sh

# SPDX-FileCopyrightText: 2021-2022 Gioele Barabucci
# SPDX-License-Identifier: ISC

set -eu

export LC_ALL="C.UTF-8"

help () {
    cat <<-EOD
        Usage: lsb_release [options]

        Options:
          -h, --help         show this help message and exit
          -v, --version      show LSB modules this system supports
          -i, --id           show distributor ID
          -d, --description  show description of this distribution
          -r, --release      show release number of this distribution
          -c, --codename     show code name of this distribution
          -a, --all          show all of the above information
          -s, --short        show requested information in short format
    EOD
    exit
}

show_id=false
show_desc=false
show_release=false
show_codename=false
short_format=false

options=$(getopt --name lsb_release -o hvidrcas -l help,version,id,description,release,codename,all,short -- "$@") || exit 2
eval set -- "$options"
while [ $# -gt 0 ] ; do
    case "$1" in
        -h|--help) help ;;
        -v|--version) ;;
        -i|--id) show_id=true ;;
        -d|--description) show_desc=true ;;
        -r|--release) show_release=true ;;
        -c|--codename) show_codename=true ;;
        -a|--all) show_id=true ; show_desc=true ; show_release=true ; show_codename=true ;;
        -s|--short) short_format=true ;;
        *) break  ;;
    esac
    shift
done

display_line () {
    label="$1"
    value="$2"

    if $short_format ; then
        printf "%s\n" "$value"
    else
        printf "%s:\t%s\n" "$label" "$value"
    fi
}

# Load release info from standard identification data files
[ -f /usr/lib/os-release ] && os_release=/usr/lib/os-release
[ -f /etc/os-release ] && os_release=/etc/os-release
[ "${LSB_OS_RELEASE-x}" != "x" ] && [ -f "$LSB_OS_RELEASE" ] && os_release="$LSB_OS_RELEASE"
[ "${os_release-x}" != "x" ] && . "$os_release"

# Mimic the output of Debian's Python-based lsb_release
# Capitalize ID
: "${ID=}"
ID="$(printf "%s" "$ID" | cut -c1 | tr '[:lower:]' '[:upper:]')$(printf "%s" "$ID" | cut -c2-)"
# Use NAME if set and different from ID only in capitalization.
if [ "${NAME-x}" != "x" ] ; then
    lower_case_id=$(printf "%s" "$ID" | tr '[:upper:]' '[:lower:]')
    lower_case_name=$(printf "%s" "$NAME" | tr '[:upper:]'  '[:lower:]')
    if [ "${lower_case_id}" = "${lower_case_name}" ] ; then
        ID="$NAME"
    fi
fi

# Generate minimal standard-conform output (if stdout is a TTY).
[ -t 1 ] && echo "No LSB modules are available." >& 2

if $show_id ; then
    display_line "Distributor ID" "${ID:-n/a}"
fi

if $show_desc ; then
    display_line "Description" "${PRETTY_NAME:-n/a}"
fi

if $show_release ; then
    display_line "Release" "${VERSION_ID:-n/a}"
fi

if $show_codename ; then
    display_line "Codename" "${VERSION_CODENAME:-n/a}"
fi

... и обеспечиваетсяlsb-releaseупаковка:

      $ dpkg -S /usr/bin/lsb_release
lsb-release: /usr/bin/lsb_release

... это описывается как:

      $ apt show lsb-release
Package: lsb-release
Version: 12.0-2
Priority: important
Section: misc
Source: lsb-release-minimal
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Gioele Barabucci <gioele@svario.it>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 17.4 kB
Homepage: https://gioele.io/lsb-release-minimal
Task: minimal, server-minimal, cloud-minimal
Download-Size: 6,564 B
APT-Manual-Installed: yes
APT-Sources: http://archive.ubuntu.com/ubuntu mantic/main amd64 Packages
Description: Linux Standard Base version reporting utility (minimal implementation)
 The Linux Standard Base (http://www.linuxbase.org/) is a standard core
 system that third-party applications written for Linux can depend upon.
 .
 The lsb_release command is a simple tool to help identify the Linux
 distribution being used and its compliance with the Linux Standard Base.
 .
 This package contains a bare-bones implementation that uses the
 information in /etc/os-release instead of relying on LSB packages.

..., затем выполняется:

      sudo apt reinstall lsb-release

... должен вернуть его в целости и сохранности.

Другие вопросы по тегам