ALT Linux Bugzilla
– Attachment 11296 Details for
Bug 41660
Нет утилиты apt
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
Скрипт-оболочка для apt-get и т.д.
apt (text/x-python3), 2.02 KB, created by
Александр Надворный
on 2022-08-06 13:36:47 MSK
(
hide
)
Description:
Скрипт-оболочка для apt-get и т.д.
Filename:
MIME Type:
Creator:
Александр Надворный
Created:
2022-08-06 13:36:47 MSK
Size:
2.02 KB
patch
obsolete
>#!/usr/bin/env python3 > >import sys >from subprocess import run >from os import getuid > >""" TODO: > РеализоваÑÑ apt [-h] [-o=config_string] [-c=config_file] [-t=target_release] [-a=architecture] {list | > search | show | update | install pkg [{=pkg_version_number | /target_release}]... | > remove pkg... | upgrade | full-upgrade | edit-sources | {-v | --version} | > {-h | --help}} >""" > >def print_help(): > ''' ÐеÑаÑÑ Ð¿Ð¾Ð¼Ð¾Ñи ''' > print("apt {search | show | update | install pkg... | remove pkg... | purge pkg... | upgrade | full-upgrade | dist-upgrade | {-h | --help}}") > >def run_shell(args, root = False): > ''' ÐÑполнÑÐµÑ Ð²Ð½ÐµÑние ÐºÐ¾Ð¼Ð°Ð½Ð´Ñ Ñ Ð²ÑÑ Ð¾Ð´Ð¾Ð¼ пÑи возникновении оÑибки > params - команда Ñ Ð°ÑгÑменÑами в ÑпиÑке > root - ТÑебÑÑÑÑÑ Ð»Ð¸ root пÑава > ''' > if root: > if getuid() != 0: > args.insert(0, 'sudo') ># print(args) > try: > run(args) > except: > print('Ðо вÑÐµÐ¼Ñ Ð²ÑÐ¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ Ð¿ÑоизоÑла оÑибка.') > exit(100) > >if len(sys.argv) <= 1: > print_help() > exit(100) > >arg_list = sys.argv.copy() >arg_list.pop(0) # УдалÑем 1 ÑÐ»ÐµÐ¼ÐµÐ½Ñ (apt) > >arg_command = arg_list.pop(0) > >if arg_command == 'update': > run_shell(["apt-get", arg_command], True) > exit() > >if arg_command in ['upgrade', 'full-upgrade', 'dist-upgrade']: > run_shell(['apt-get', 'dist-upgrade'], True) > exit() > >if arg_command in ['-h', '--help']: > print_help() > exit() > >#if len(arg_list) == 0: ># print('Ðе Ñ Ð²Ð°ÑÐ°ÐµÑ Ð¿Ð°ÑамеÑÑов!') ># print_help() ># exit() > >if arg_command in ['install', 'remove']: > run_shell(['apt-get', arg_command] + arg_list, True) > exit() > >if arg_command in ['purge']: > run_shell(['apt-get', 'remove', '--purge'] + arg_list, True) > exit() > >if arg_command in ['search', 'show']: > run_shell(['apt-cache', arg_command] + arg_list, False) > exit() > >print_help() >exit(100)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 41660
: 11296