⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ocap

📁 About: Paco (pacKAGE oRGANIZER) is a simple, yet powerful tool to aid package management when insta
💻
字号:
#!/usr/bin/perl#----------------------------------------------------------------------# ocap - Find files not logged by any package in the paco database.#----------------------------------------------------------------------# This file is part of the package paco# Copyright (C) 2006-2007 David Rosal <david.3r@gmail.com># For more information visit http://paco.sourceforge.net#----------------------------------------------------------------------use warnings;use strict;use Getopt::Long;use Cwd;Getopt::Long::Configure("no_ignore_case", "bundling");my $me = "ocap";my $logdir = '';sub help{print <<EOF;$me - Find files not logged by any package in the paco database.Usage:  $me [-hv] [-L DIR] <directories>Options [default values listed in brackets]:  -v, --version     Display version information.  -h, --help        Display this help message.  -L, --logdir=DIR  Base paco log directory [$logdir].Author:  David Rosal <david.3r\@gmail.com>EOFexit(0);}sub try_help{	my $msg = shift;	$msg and warn("$me: $msg\n");	die("Try '$me --help' for more information.\n");}sub expand_home{	my $x = shift;	$x or return;	my $home = `echo \$HOME`;	$home or return $x;	chomp($home);	$x =~ s/\${?HOME}?/$home/g;	return $x;}#-----------------------------------------------------------## Start                                                     ##-----------------------------------------------------------## Check for paco, and get the version, pacorc and logdirmy $version = `paco --version`	or exit(1);$version =~ s/^paco-//;my $pacorc = `pkg-config --variable=pacorc paco 2>/dev/null`;($pacorc) or $pacorc = "/etc/pacorc";$logdir = `pkg-config --variable=logdir paco 2>/dev/null`;# Parse pacorcif (open(CFG, $pacorc)) {	while (<CFG>) {		chomp;		if (/^LOGDIR=(.+)$/) {			$logdir = &expand_home($1);			last;		}	}	close(CFG);}chomp($logdir);# Command line argumentsGetOptions(	'V|version'		=> sub { print("$me-$version");	exit(0); },	'h|help'		=> \&help,	'L|logdir=s'	=> \$logdir,) or &try_help;($logdir) or $logdir = "/var/log/paco";chomp($logdir);my $dirs_regex = "";my @dirs = @ARGV;@dirs or @dirs = "/";for (@dirs) {	chomp;	s/\/+/\//g;	s/(.)\/$/$1/;	$dirs_regex .= "$_|";}# Get the list of logged filesmy @files = ();for (glob("$logdir/*")) {	open(LOG, $_) or die("$me: open($_): $!\n");	while (<LOG>) {		(/^-?(($dirs_regex)\/[^|]*)(\.gz|\.bz2)?\|/) and push(@files, $1);	}	close(LOG);}chomp(@files);# Find non logged filesmy $found = 0;for my $file (`find @dirs ! -type d`) {	chomp($file);	$file =~ s/\.(gz|bz2)$//;	$found = 0;	for (@files) {		if ($_ eq $file) {			$found++;			last;		}	}	$found or print("$file\n");}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -