적절한 시스템에 나타나지 않고 패키지를 숨기는 방법은 무엇입니까?

적절한 시스템에 나타나지 않고 패키지를 숨기는 방법은 무엇입니까?

내 폴더에 나타나는 제거된 패키지 목록은 aptitude엄청나지만 절대 설치하지 않을 패키지로 가득 차 있습니다. 예를 들어 내 노트북은 Intel 그래픽을 사용하므로 설치되어 있으므로 xserver-xorg-video-nouveau영원히 숨기고 싶습니다. 이는 설치에 사용할 수 있는 모든 패키지를 표시하므로 목록을 사용할 때 중요합니다 !~i!~v(UNAVAILABLE로 표시된 종속성이 있는 패키지에 대한 필터를 알아야 합니다). 따라서 해당 패키지를 숨길 수 있으면 찾기가 더 쉽습니다. 아직 패키지를 시도하지 않았습니다.

가능하다면 전체 apt 데이터베이스가 흥미롭지 않은 패키지를 무시하도록 하려면 어떻게 해야 합니까?

답변1

#!/bin/sh
# apt-filter
# Shell script for filtering the apt packages list. Useful if you don't want to
# see too many packages in your synaptic/aptitude. Improves startup time of
# both, at the expense of time taken for filtering the updates.
# © 2011 Ahmad Syukri
listpath=/var/lib/apt/lists
skiplist=/etc/apt/skiplist  # This is user defined list of package to skip. Put yours there
skiplist_prev=/var/cache/apt/skiplist
statustmp=/tmp/apt-update.1

cd $listpath
if [ ! -e orig ]
then
  #first time running. create the required folder
  mkdir -p orig
  mv *_dists_* orig
  skiplist_changed=1
else
  #compare current skiplist with  last time's
  skiplist_changed=$(diff -q $skiplist $skiplist_prev)
  #delete prev skiplist, in case update fails, then it will be forced to refilter  
  [ -e $skiplist_prev ] && rm $skiplist_prev
fi
#check for new package lists. Save the output to list, with progress visible.
apt-get update -o Dir::State::Lists=$listpath/orig | tee $statustmp

cd orig
cp *InRelease ..
if [ ! $skiplist_changed ]
then
  #skip processing package lists with no updates
  #apt-get update displays "Get" for each repository that has updated
  pkgs=$(grep Get $statustmp | awk '{\
  if (/Packages/ && !/Diff/){\
    sub(/(ht|f)tp:\/*/,"",$2);\
    sub(/\//,"_",$3);\
    print $2"_debian_dists_"$3"_binary-"$4"_Packages"\
  }\
  }')
else
  #skiplist changed, must reprocess all
  pkgs=$(ls *Packages 2>/dev/null)
fi
#now let the fun begin!
for pkglist in $pkgs
do
  #there is chance the list failed to download, check if it exists
  if [ -e $pkglist ]
  then
    echo Processing $pkglist...
    awk '{\
      skiplist = "'$skiplist'";\
      if (/^Package/){\
        skip = 0;\
        while (!skip && (getline pkg < skiplist) > 0)\
          skip=(pkg==$2);\
          close(skiplist);\
        };\
      if (!skip) print $0\
      }' $pkglist > ../$pkglist
  fi
done
#finally, save state of skiplist for future comparison
cp $skiplist $skiplist_prev

스크립트를 작성하면 됩니다!

주의사항:

  1. 기존 목록을 다른 폴더에 배치하고 필터링된 목록이 해당 목록을 대체합니다. 이는 기존 방법을 통해 업데이트되면 필터 목록이 손상되고 필터 스크립트를 다시 실행해야 함을 의미합니다.
  2. 필터가 최적화되지 않아 프로세스에 오랜 시간이 걸릴 수 있습니다.
  3. 목록이 작을수록 시냅스/능력 시작이 더 빨라진다는 것을 의미하지만, 이를 보장할 수는 없습니다.
  4. 이로 인해 제거 가능한 많은 패키지가 여전히 나열될 수 있습니다. 필터링하는 방법을 알고 계시다면,내 다른 질문에 대답해주세요!

    결과

결과? 나는 더 이상 emacs와 그 하수인이나 windowmaker를 볼 수 없습니다. 지구상의 평화에 대해 이야기하십시오!

답변2

자신만의 APT 저장소를 만들지 않는 이상 지금 방법이 있다고 확신합니다. 이를 달성하기 위한 많은 도구가 있는데, 제가 가장 좋아하는 것은레플리카. 설정이 완료되면 저장소에서 개별 패키지를 제거하는 것은 다음과 같이 간단합니다.

reprepro --basedir /path/to/.custom_repo remove custom_repo_name unwanted_package

인덱스와 파일 시스템에서 모두 제거됩니다. 그 후에는 물론 APT 목록을 업데이트해야 합니다 apt-get update.

관련 정보