From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.2.5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to; bh=8gcYJv/rSkKd0gi7pto+DlvFEaLac8PtFLJPkN/AxaA=; b=QHFZUh/2UEJn7w2JYtDOa5f0Mrz3kgeKsiu/RpZ4GYaAUJTRQi0DYE1wG1au46vLcb IOQ3YYiHEWi0nvmekuDQAuZBfXRRENcnGA6sxAnhizOrddTldWhMLVHJ2fDrvHv8cJVa ce0nVwQULPW99a/A9OfDSB9sIqf15pkL3GJf4oGID5q9xDSJN9wAkY8XZkeNo4WOcnng ADuT4QGe2SbXNtn6wuOf3F9sSuTN2rKKGi0974RXA90PxSx1EJaoYj/Z7+4U5s5saVRD ISgBZyF+9KJKF9M5dyeZkPl7eoxNnP8OJRfbBqfeGtycdNr78UzODmvJFR/y1qrYHdmm KxsQ== X-Received: by 10.112.145.136 with SMTP id su8mr3203771lbb.105.1406650582633; Tue, 29 Jul 2014 09:16:22 -0700 (PDT) Sender: Denis Smirnov Date: Tue, 29 Jul 2014 20:16:19 +0400 From: =?koi8-r?B?5MXOydMg883J0s7P1w==?= To: community@lists.altlinux.org Message-ID: <20140729161619.GB7385@mw.mithraen.ru> Mail-Followup-To: community@lists.altlinux.org References: <20140723165034.GA16664@mw.mithraen.ru> <804381406224830@web19j.yandex.ru> <53D1614C.9080402@rambler.ru> <1082471406231394@web30h.yandex.ru> <20140725012132.5a6a5835@sem-notebook> <1256811406243387@web28h.yandex.ru> <20140728234111.GB19913@mw.mithraen.ru> <3406861406630905@web13j.yandex.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="iFRdW5/EC4oqxDHL" Content-Disposition: inline In-Reply-To: <3406861406630905@web13j.yandex.ru> Subject: Re: [Comm] =?koi8-r?b?wdfUz83PztTJ0s/Xwc7JxSDCxdogREU=?= X-BeenThere: community@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Community general discussions List-Id: ALT Linux Community general discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 16:16:30 -0000 Archived-At: List-Archive: List-Post: --iFRdW5/EC4oqxDHL Content-Type: multipart/mixed; boundary="KFztAG8eRSV9hGtP" Content-Disposition: inline --KFztAG8eRSV9hGtP Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 29, 2014 at 02:48:25PM +0400, Speccyfighter wrote: > - lsblk, =CB=CF=D4=CF=D2=D9=CA =D0=D2=C9=C4=A3=D4=D3=D1 =C7=D2=C5=D0=C1= =D4=D8 =C9=CE=D7=C5=D2=D3=C9=C5=CA =EE=E5, =C9=CE=C1=DE=C5 =D7=D9=C2=D2=CF= =D3=C9=D4 > =CC=C9=D3=D4=C9=CE=C7=CF=CD =CE=C5 =D4=CF=CC=D8=CB=CF =D3=DF=A3=CD=CE=D9= =C5 wtf HE? =E9 =CB=C1=CB =CF=D0=D2=C5=C4=C5=CC=C9=D4=D8 =D3=DF=C5=CD=CE=D9=C5? =F1 =D4= =D5=D4 =CF=C2=CE=C1=D2=D5=D6=C9=CC, =DE=D4=CF =D7 /sys/block/sdk/removable =D5 =CD=C5=CE=D1 '0', =D0=D2=C9 =D4=CF=CD =DE=D4=CF sdk =DC=D4=CF =C6=CC=C5= =DB=CB=C1. > (=D5 =D3=C5=C2=D1 =D0=D2=C9 =C4=D7=D5=C8 hdd =C9 usb-hdd =DC=D4=CF =D7=D9= =C2=D2=CF=D3=C9=D4 20 =C6=C1=CA=CC=CF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=D4=CF, =DE= =D4=CF =D7=D9 =C8=CF=D4=C9=D4=C5. --=20 =F3 =D5=D7=C1=D6=C5=CE=C9=C5=CD, =E4=C5=CE=C9=D3 http://mithraen.ru/ --KFztAG8eRSV9hGtP Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=lmount #!/usr/bin/perl -w #============================================================================# # List all block devices that not exists in fstab # #============================================================================# # (C) Denis Smirnov # #============================================================================# use strict; use warnings qw(FATAL all); use utf8; use open qw(:utf8 :std); use Cwd 'abs_path'; my @lsblk = split( "\n", `/bin/lsblk -o NAME,FSTYPE,LABEL,MOUNTPOINT,SIZE,RM,KNAME,MODEL,TYPE,UUID -P` ); my %disks; my %fstab_dev; my %fstab_uuid; my %fstab_label; sub parse_fstab() { open( my $fh, "<", "/etc/fstab" ) || die; while (<$fh>) { s/#.*//; next if /^\s*$/; s/\s+.*$//; s/\s+$//; if (/^LABEL=\"([^\"]+)\"/) { $fstab_label{$1} = 1; } elsif (/^LABEL=([^\"]+)/) { $fstab_label{$1} = 1; } if (/^UUID=\"([^\"]+)\"/) { $fstab_uuid{$1} = 1; } elsif (/^UUID=([^\"]+)/) { $fstab_uuid{$1} = 1; } else { my $dev = $_; $dev = abs_path($dev) if -l $dev; $fstab_dev{$dev} = 1; } } close($fh); } sub parse_line($) { my $fields = $_[0]; my %h; while ( $fields =~ s/^\s*([^"]+)="([^\"]*)"\s*// ) { $h{$1} = $2; } my $dev = $h{KNAME}; if ( $h{TYPE} eq 'disk' ) { $disks{$dev} = \%h; } if ( $h{TYPE} eq 'part' ) { my $basedev = $dev; $basedev =~ s/\d+$//; foreach my $key ( keys %h ) { if ( $h{$key} eq '' ) { $h{$key} = $disks{$basedev}->{$key}; } } } # return if $h{RM} eq '0'; return if $h{FSTYPE} eq ''; return if $h{FSTYPE} eq 'swap'; return if $h{FSTYPE} eq 'linux_raid_member'; return if $h{FSTYPE} eq 'LVM2_member'; # skip LVM partitions return if $h{TYPE} eq 'lvm'; # skip FS in fstab return if defined $fstab_label{ $h{LABEL} }; return if defined $fstab_uuid{ $h{UUID} }; return if defined $fstab_dev{ "/dev/" . $h{KNAME} }; return \%h; } use Data::Dump qw/ddx/; parse_fstab; my @out; foreach (@lsblk) { my $h = parse_line($_); next unless defined $h; # ddx $h; my $dev = "/dev/" . $h->{KNAME}; push @out, $dev; } my $devices = join( ' ', @out ); print `/bin/lsblk -o NAME,FSTYPE,LABEL,MOUNTPOINT,SIZE,RM,KNAME,MODEL,TYPE,UUID -l $devices`; --KFztAG8eRSV9hGtP-- --iFRdW5/EC4oqxDHL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlPXyNEACgkQPuR8c4jhFKL/qwCfe/Q+lOMhOJN4Z/jv8q15/BtX 0T8AnRmgtaXSafzPnshPp3RO9t/ZuDBG =G0Ac -----END PGP SIGNATURE----- --iFRdW5/EC4oqxDHL--