/usr/bin/gnupod_INIT is in gnupod-tools 0.99.8-2.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | #!/usr/bin/perl
# Copyright (C) 2002-2007 Adrian Ulrich <pab at blinkenlights.ch>
# Part of the gnupod-tools collection
#
# URL: http://www.gnu.org/software/gnupod/
#
# GNUpod is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# GNUpod is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.#
#
# iTunes and iPod are trademarks of Apple
#
# This product is not supported/written/published by Apple!
use strict;
use GNUpod::FooBar;
use GNUpod::XMLhelper;
use Getopt::Long;
use vars qw(%opts);
print "gnupod_INIT 0.99.8 (C) Adrian Ulrich\n";
$opts{mount} = $ENV{IPOD_MOUNTPOINT};
#Don't add xml and itunes opts.. we *NEED* the mount opt to be set..
GetOptions(\%opts, "version", "help|h", "mount|m=s", "disable-convert|d", "france|f", "noask", "model=s", "fwguid|g=s");
GNUpod::FooBar::GetConfig(\%opts, {model=>'s'}, "gnupod_INIT");
#gnupod_INIT does not read configuration files!
usage() if $opts{help};
version() if $opts{version};
go();
sub go {
#Disable autosync
$opts{_no_sync} = 1;
my $con = GNUpod::FooBar::connect(\%opts);
usage("$con->{status}\n") if $con->{status};
## Ask the user, if he still knows what he/she's doing..
print << "EOF";
Your iPod is mounted at $opts{mount}, ok ?
*********************************************************
This tool creates the default directory tree on your iPod
and creates an *empty* GNUtunesDB (..or convert your old
iTunesDB to a new GNUtunesDB).
You only have to use this command if
-> You never used GNUpod with this iPod
or -> You did an 'rm -rf' on your iPod
btw: use 'gnupod_addsong -m $opts{mount} --restore'
if you lost your songs on the iPod after using
gnupod_INIT (..but this won't happen, because
this tool has no bugs ;) )
*********************************************************
Hit ENTER to continue or CTRL+C to abort
EOF
##
<STDIN> unless $opts{noask};
print "Creating directory structure on $opts{mount}\n\n";
print "> AppFolders:\n";
foreach( ($con->{rootdir}, $con->{musicdir},
$con->{itunesdir}, $con->{etc}) ) {
my $path = $_;
next if -d $path;
mkdir("$path") or die "Could not create $path ($!)\n";
print "+$path\n";
}
print "> Music folders:\n";
for(0..19) {
my $path = sprintf($con->{musicdir}."/F%02d", $_);
next if -d $path;
mkdir("$path") or die "Could not create $path ($!)\n";
print "+$path\n";
}
if($opts{france}) {
print "> Creating 'Limit' file (because you used --france)\n";
mkdir("$con->{rootdir}/Device");
open(LIMIT, ">$con->{rootdir}/Device/Limit") or die "Failed: $!\n";
print LIMIT "216\n"; #Why?
close(LIMIT);
}
elsif(-e "$con->{rootdir}/Device/Limit") {
print "> Removing 'Limit' file (because you didn't use --france)\n";
unlink("$con->{rootdir}/Device/Limit");
}
else {
print "> No 'Limit' file created or deleted..\n";
}
print "> Creating dummy files\n";
GNUpod::XMLhelper::writexml($con);
my $t2pfail = 0;
if(-e $con->{itunesdb} && !$opts{'disable-convert'}) {
#We have an iTunesDB, call tunes2pod
print "Found *existing* iTunesDB, running tunes2pod\n";
$t2pfail = system("$con->{bindir}/tunes2pod", "--force", "-m", $opts{mount});
}
else {
#No iTunesDB, run mktunes
print "No iTunesDB found, running mktunes\n";
my @mktunescmd = ("$con->{bindir}/mktunes", "-m" ,"$opts{mount}");
if ($opts{'fwguid'}) { push @mktunescmd, "-g", "$opts{fwguid}"; }
$t2pfail = system(@mktunescmd);
}
if($t2pfail) {
print "\n Done\n ..Looks like something went wrong :-/\n";
}
else {
print "\n Done\n Your iPod is now ready for GNUpod :)\n";
}
}
###############################################################
# Basic help
sub usage {
my($rtxt) = @_;
die << "EOF";
$rtxt
Usage: gnupod_INIT [-h] [-m directory]
-h, --help display this help and exit
--version output version information and exit
-m, --mount=directory iPod mountpoint, default is \$IPOD_MOUNTPOINT
-d, --disable-convert Don't try to convert an existing iTunesDB
-g, --fwguid=HEXVAL FirewireGuid / Serial of connected iPod (passed to mktunes)
-f, --france Limit volume to 100dB (For French-Law/People)
Maximal-volume without this is ~104dB (VERY LOUD)
*WARNING* This works only for iPods running
Firmware 1.x (1st & 2nd generation)
You can also use mktunes '--volume PERCENT'
to adjust the volume (Works with Firmware 1.x AND 2.x)
--noask Do not wait for any user input
Report bugs to <bug-gnupod\@nongnu.org>
EOF
}
sub version {
die << "EOF";
gnupod_INIT (gnupod) 0.99.8
Copyright (C) Adrian Ulrich 2002-2004
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
EOF
}
|