Jak wyodrębnić pliki z archiwum pakietu RPM

Jak wyodrębnić pliki z archiwum pakietu RPM

Ten krótki artykuł pokaże, jak wyodrębnić pojedyncze lub wiele plików z archiwum pakietu RPM. Aby rozpocząć, najpierw pobieramy przykładowy pakiet Witam.

$ wget ftp: // rpmfind.net/linux/openSuse/Factory/repo/OSS/suse/x86_64/hello-2.9-4.3.x86_64.rpm $ ls hello-2.9-4.3.x86_64.RPM 

Teraz mamy opcję wyodrębnia całość lub pojedynczy plik z powyższego archiwum pakietu RPM. Poniższe polecenie Linux wyodrębnie wszystkie pliki do naszego bieżącego katalogu roboczego:

$ rpm2cpio hello-2.9-4.3.x86_64.RPM | CPIO -id 525 bloków $ ls hello -2.9-4.3.x86_64.RPM USR 

Powyższe RPM2CPIO Najpierw przekształca RPM w archiwum CPIO. Następnie przekazujemy jego stdout do CPIO polecenie, które przyjmuje to jako wejście i wyodrębnia swoją zawartość -I do odpowiednich katalogów -D. W rezultacie USR Katalog zawiera teraz wszystkie wyodrębnione pliki z Hello-2.9-4.3.x86_64.RPM Archiwum pakietu RPM.

Alternatywnie możemy wyodrębnić pojedynczy/wybrany plik z archiwum pakietu RPM. Aby to zrobić, najpierw musimy wymienić zawartość pakietu RPM bez wyodrębnienia jej zawartości. Polecenie Bellow tylko wymienia zawartość pakietu RPM Hello-2.9-4.3.x86_64.RPM

$ rpm -lqp hello -2.9-4.3.x86_64.OSTRZEŻENIE RPM: Hello-2.9-4.3.x86_64.RPM: Podpis nagłówka V3 RSA/SHA256, Klucz ID 3DBDC284: NOKEKE/USR/BIN/Hello/usr/Doc/Packages/Hello/usr/shar /pakiety/hello/copying/usr/share/doc/pakiety/hello/news/usr/share/doc/pakiety/hello/readme/usr/share/doc/pakiety/hello/dzięki/usr/share/doc/pakiety /hello/todo/usr/share/info/hello.informacje.GZ/usr/share/locale/bg/lc_messages/hello.MO/usr/share/locale/ca/lc_messages/hello.mo/usr/share/locale/da/lc_messages/hello.mo/usr/share/locale/de/lc_messages/hello.mo/usr/share/locale/el/lc_messages/hello.mo/usr/share/locale/eo/lc_messages/hello.mo/usr/share/locale/es/lc_messages/hello.mo/usr/share/locale/et/lc_messages/hello.mo/usr/share/locale/eu/lc_messages/hello.mo/usr/share/locale/fa/lc_messages/hello.mo/usr/share/locale/fi/lc_messages/hello.MO/usr/share/locale/fr/lc_messages/hello.mo/usr/share/locale/ga/lc_messages/hello.MO/usr/share/locale/gl/lc_messages/hello.mo/usr/share/locale/he/lc_messages/hello.Mo/usr/share/locale/hr/lc_messages/hello.Mo/usr/share/locale/hu/lc_messages/hello.mo/usr/share/locale/id/lc_messages/hello.mo/usr/share/locale/it/lc_messages/hello.MO/usr/share/locale/ja/lc_messages/hello.Mo/usr/share/locale/ko/lc_messages/hello.mo/usr/share/locale/lv/lc_messages/hello.mo/usr/share/locale/nb/lc_messages/hello.Mo/usr/share/locale/nl/lc_messages/hello.mo/usr/share/locale/nn/lc_messages/hello.MO/usr/share/locale/pl/lc_messages/hello.mo/usr/share/locale/pt/lc_messages/hello.mo/usr/share/locale/pt_br/lc_messages/hello.Mo/usr/share/locale/ro/lc_messages/hello.MO/usr/share/locale/ru/lc_messages/hello.mo/usr/share/locale/sk/lc_messages/hello.MO/usr/share/locale/sl/lc_messages/hello.Mo/usr/share/locale/sr/lc_messages/hello.MO/usr/share/locale/sv/lc_messages/hello.mo/usr/share/locale/th/lc_messages/hello.mo/usr/share/locale/tr/lc_messages/hello.MO/usr/share/locale/uk/lc_messages/hello.Mo/usr/share/locale/vi/lc_messages/hello.mo/usr/share/locale/zh_cn/lc_messages/hello.MO/usr/share/locale/zh_tw/lc_messages/hello.mo/usr/share/man/man1/hello.1.GZ 

Użyj następującego polecenia Linux, aby wyodrębnić pojedynczy plik /usr/bin/hello z pakietu RPM i zapisz go w np. /tmp/ informator:

$ rpm2cpio hello-2.9-4.3.x86_64.RPM | CPIO -iv -to -Stdout ./usr/bin/hello>/tmp/hello 

Wszystkie zrobione Witam Binarne wykonywalne zostało teraz zapisane /tmp/ informator:

$ chmod +x /tmp /hello $ /tmp /hello hello, świat! 

Powiązane samouczki Linux:

  • Plik WGET Pobierz na Linux
  • Jak połączyć się z serwerem FTP za pomocą Pythona
  • Skonfiguruj serwer FTP w systemie Linux
  • Lista klientów FTP i instalacja na Ubuntu 20.04 Linux…
  • Lista klientów FTP i instalacja na Ubuntu 22.04 Linux…
  • Jak tworzyć i wyodrębnić archiwa CPIO na przykładach Linux
  • Jak skonfigurować serwer FTP/SFTP i klient na Almalinux
  • Rzeczy do zainstalowania na Ubuntu 20.04
  • Samouczek LFTP na Linux z przykładami
  • Jak zainstalować vscode open source bez telemetrii w Linux