Find out the patches not available in linux-general Linux technology-Linux programming and kernel information. The following is a detailed description. I first used a perl program to read the patch directory on ftp.kernl.org in a file list. Then I used shell to find the unpatched patch. It was written in C at the beginning, and it was quite troublesome, so I wrote it while watching the shell.
The perl program is as follows:
CODE :#! /Usr/bin/perl Use Net: FTP;
My $ host = "www.kernel.org "; My $ directory = "pub/linux/kernel/v2.6 "; $ Ftp = Net: FTP-> new ($ host, Timeout => 240) or $ newerr = 1; Push @ ERRORS, "Can't connect to ftp $ host: $! \ N "if $ newerr; Myerr () if $ newerr; Print "Connected \ n "; $ Ftp-> login ("anonymous", "drinkey@163.com") or $ newerr = 1; Print "Getting file list \ n "; Push @ ERRORS, "Can't login to $ host: $! \ N "if $ newerr; $ Ftp-> quit if $ newerr; Myerr () if $ newerr; Print "Logged in \ n ";
$ Ftp-> cwd ($ directory) or $ newerr = 1; Push @ ERRORS, "Can't cd $! \ N "if $ newerr; Myerr () if $ newerr; $ Ftp-> quit if $ newerr;
Open (DIRC, "> list") or die "$! \ N "; @ Files = $ ftp-> dir or $ newerr = 1; Push @ ERRORS, "Can't get file list $! \ N "if newerr; Print "Got file list \ n "; Foreach (@ files ){ If ($ _ = ~ /Patch/& amp; $ _!~ /Sign/& amp; $ _!~ /Gz /){ Print DIRC "$ _ \ n "; } } $ Ftp-> quit; Sub myerr { Print "Error: \ n "; Print @ ERRORS; Exit 0; } |