summaryrefslogtreecommitdiffstats
path: root/po/ja.po
blob: c9aabc3baf5cdd980b5a24208ff857e3ee61e85a (plain)
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
# translation of Mandriva Online-ja.po to Japanese
# Mandriva Online, Japanese Version
# Copyright (C) 2002,2003 Free Software Foundation, Inc.
# Budi Rachmanto <rac@linux-mandrake.com>, 2002 - 2003.
# utuhiro, 2003
# Yukiko Bando <ybando@k6.dion.ne.jp>, 2004-2008.
#
msgid ""
msgstr ""
"Project-Id-Version: mdkonline-ja\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-11-20 16:49+0100\n"
"PO-Revision-Date: 2008-10-19 07:30+0900\n"
"Last-Translator: Yukiko Bando <ybando@k6.dion.ne.jp>\n"
"Language-Team: Japanese <cooker-i18n@mandrivalinux.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.0.1\n"
"Plural-Forms: nplurals=1; plural=0;\n"

#. -PO: here %s will be replaced by the local time (eg: "Will check updates at 14:03:50"
#: ../mdkapplet:65
#, c-format
msgid "Will check updates at %s"
msgstr "%s に更新をチェックします"

#: ../mdkapplet:74
#, c-format
msgid "Your system is up-to-date"
msgstr "新しい更新はありません"

#: ../mdkapplet:80
#, c-format
msgid ""
"Service configuration problem. Please check logs and send mail to "
"support@mandrivaonline.com"
msgstr ""
"サービスの設定に問題があります。ログを調べて support@mandrivaonline.com に"
"メールしてください。"

#: ../mdkapplet:87
#, c-format
msgid "Please wait, finding available packages..."
msgstr "利用可能なパッケージを探しています。お待ちください..."

#: ../mdkapplet:93
#, c-format
msgid "New updates are available for your system"
msgstr "新しい更新があります"

#: ../mdkapplet:100
#, fuzzy, c-format
msgid "A new version of Mandriva Linux distribution has been released"
msgstr "Mandriva Linux の新しい安定バージョンがリリースされました"

#: ../mdkapplet:107
#, c-format
msgid "An additional package medium is available for your distribution."
msgstr ""

#: ../mdkapplet:113
#, c-format
msgid "Network is down. Please configure your network"
msgstr "ネットワークが未接続です。ネットワークを設定してください。"

#: ../mdkapplet:119
#, c-format
msgid "Service is not activated. Please click on \"Online Website\""
msgstr ""
"サービスが有効になっていません。「Online ウェブサイト」を選択してください。"

#: ../mdkapplet:125
#, c-format
msgid "urpmi database locked"
msgstr "urpmi データベースがロックされています"

#: ../mdkapplet:132
#, c-format
msgid "Release not supported (too old release, or development release)"
msgstr "お使いのバージョンはサービスの対象外です (期限切れ/開発版)"

#: ../mdkapplet:138
#, c-format
msgid ""
"No medium found. You must add some media through 'Software Media Manager'."
msgstr ""
"メディアが見つかりません。RPM メディアマネージャでメディアを追加してくださ"
"い。"

#: ../mdkapplet:144
#, c-format
msgid ""
"You already have at least one update medium configured, but\n"
"all of them are currently disabled. You should run the Software\n"
"Media Manager to enable at least one (check it in the \"%s\"\n"
"column).\n"
"\n"
"Then, restart \"%s\"."
msgstr ""
"一つ以上の更新メディアが設定されていますが、すべて無効になっています。\n"
"RPM メディアマネージャを起動し、「%s」の欄にチェックを入れて\n"
"少なくとも一つの更新メディアを有効にしてください。\n"
"\n"
"その後、%s を再起動してください。"

#: ../mdkapplet:149
#, c-format
msgid "Enabled"
msgstr "有効"

#: ../mdkapplet:162
#, c-format
msgid "Error updating media"
msgstr "メディアの更新でエラー"

#: ../mdkapplet:197 ../mdkapplet:618
#, c-format
msgid "Install updates"
msgstr "システムを更新"

#: ../mdkapplet:198
#, c-format
msgid "Add additional package medium"
msgstr ""

#: ../mdkapplet:199
#, c-format
msgid "Check Updates"
msgstr "更新をチェック"

#: ../mdkapplet:200
#, c-format
msgid "Configure Network"
msgstr "ネットワークの設定"

#: ../mdkapplet:201
#, c-format
msgid "Upgrade the system"
msgstr "システムをアップグレード"

#: ../mdkapplet:356
#, c-format
msgid "Launching drakconnect\n"
msgstr "Drakconnect を起動\n"

#: ../mdkapplet:361 ../mdkapplet:382
#, c-format
msgid "New version of Mandriva Linux distribution"
msgstr ""

#: ../mdkapplet:365
#, fuzzy, c-format
msgid "A new version of Mandriva Linux distribution has been released."
msgstr "ディストリビューションの新しい安定バージョンがリリースされました。"

#: ../mdkapplet:367
#, c-format
msgid "More info about this new version"
msgstr "この新しいバージョンの詳細情報"

#: ../mdkapplet:369
#, c-format
msgid "Do you want to upgrade to the '%s' distribution?"
msgstr "ディストリビューション %s にアップグレードしますか?"

#: ../mdkapplet:371 ../mdkapplet-restricted-helper:67
#, c-format
msgid "Do not ask me next time"
msgstr "次回から尋ねない"

#: ../mdkapplet:372 ../mdkapplet:408 ../mdkapplet-restricted-helper:68
#: ../mdkapplet-restricted-helper:96
#, c-format
msgid "Next"
msgstr "次へ"

#: ../mdkapplet:372 ../mdkapplet:408 ../mdkapplet-restricted-helper:68
#: ../mdkapplet-restricted-helper:96 ../mdkapplet-upgrade-helper:126
#: ../mdkapplet-upgrade-helper:145
#, c-format
msgid "Cancel"
msgstr "キャンセル"

#: ../mdkapplet:399
#, c-format
msgid ""
"This upgrade requires high bandwidth network connection (cable, xDSL, ...)  "
"and may take several hours to complete."
msgstr ""

#: ../mdkapplet:401
#, c-format
msgid "Estimated download data will be %s"
msgstr ""

#: ../mdkapplet:402
#, c-format
msgid "You should close all other running applications before continuing."
msgstr ""

#: ../mdkapplet:405
#, c-format
msgid ""
"You should put your laptop on AC and favor ethernet connection over wifi, if "
"available."
msgstr ""

#: ../mdkapplet:432
#, c-format
msgid "Launching MandrivaUpdate\n"
msgstr "MandrivaUpdate を起動\n"

#: ../mdkapplet:453
#, c-format
msgid "Computing new updates...\n"
msgstr "新しい更新を計算中...\n"

#: ../mdkapplet:539
#, c-format
msgid "System is up-to-date\n"
msgstr "新しい更新はありません\n"

#: ../mdkapplet:567
#, c-format
msgid "Checking Network: seems disabled\n"
msgstr "ネットワーク確認: 無効になっているようです\n"

#: ../mdkapplet:609
#, c-format
msgid "Warning"
msgstr "警告"

#: ../mdkapplet:612 ../mdkapplet:620
#, c-format
msgid "More Information"
msgstr ""

#: ../mdkapplet:622
#, c-format
msgid "Add media"
msgstr "メディアを追加"

#: ../mdkapplet:637
#, c-format
msgid "About..."
msgstr "情報..."

#: ../mdkapplet:641
#, c-format
msgid "Mandriva Online %s"
msgstr "Mandriva Online %s"

#: ../mdkapplet:642
#, c-format
msgid "Copyright (C) %s by Mandriva"
msgstr "Copyright (C) %s by Mandriva"

#: ../mdkapplet:645
#, c-format
msgid "Mandriva Online gives access to Mandriva web services."
msgstr "Mandriva Online は Mandriva ウェブサービスへのアクセスを提供します。"

#: ../mdkapplet:647
#, c-format
msgid "Online WebSite"
msgstr "Online ウェブサイト"

#. -PO: put here name(s) and email(s) of translator(s) (eg: "John Smith <jsmith@nowhere.com>")
#: ../mdkapplet:652
#, c-format
msgid "_: Translator(s) name(s) & email(s)\n"
msgstr ""

#: ../mdkapplet:661
#, c-format
msgid "Always launch on startup"
msgstr "起動時に常に開始する"

#: ../mdkapplet:663
#, c-format
msgid "Quit"
msgstr "終了"

#: ../mdkapplet-restricted-helper:59
#, c-format
msgid "New medium available"
msgstr ""

#: ../mdkapplet-restricted-helper:65
#, fuzzy, c-format
msgid "You are using '%s' distribution."
msgstr "ディストリビューション %s にアップグレードしますか?"

#: ../mdkapplet-restricted-helper:65
#, c-format
msgid "Mandriva PowerPack"
msgstr ""

#: ../mdkapplet-restricted-helper:66
#, fuzzy, c-format
msgid "Do you want to add an additional package medium distribution?"
msgstr "ディストリビューション %s にアップグレードしますか?"

#: ../mdkapplet-restricted-helper:77
#, c-format
msgid "Adding an additional package medium"
msgstr ""

#: ../mdkapplet-restricted-helper:88
#, c-format
msgid "Please fill in your account ID to add an additional package medium"
msgstr ""

#: ../mdkapplet-restricted-helper:90
#, c-format
msgid "More information on your user account"
msgstr ""

#: ../mdkapplet-restricted-helper:92
#, c-format
msgid "Your email"
msgstr ""

#: ../mdkapplet-restricted-helper:93
#, c-format
msgid "Your password"
msgstr ""

#: ../mdkapplet-restricted-helper:95
#, c-format
msgid "Forgotten password"
msgstr ""

#: ../mdkapplet-restricted-helper:121 ../mdkapplet-upgrade-helper:79
#: ../mdkapplet-upgrade-helper:120 ../mdkapplet-upgrade-helper:172
#: ../mdkapplet-upgrade-helper:208
#, c-format
msgid "Error"
msgstr "エラー"

#: ../mdkapplet-restricted-helper:121
#, c-format
msgid "An error occurred"
msgstr ""

#: ../mdkapplet-upgrade-helper:76
#, c-format
msgid ""
"Your system does not have enough space left in %s for upgrade (%dMB < %dMB)"
msgstr ""

#: ../mdkapplet-upgrade-helper:124 ../mdkapplet-upgrade-helper:173
#: ../mdkapplet-upgrade-helper:209
#, c-format
msgid "Installation failed"
msgstr "インストール失敗"

#: ../mdkapplet-upgrade-helper:125
#, c-format
msgid "Installation logs can be found in '%s'"
msgstr "'%s' にインストールのログがあります"

#: ../mdkapplet-upgrade-helper:126
#, c-format
msgid "Retry"
msgstr "再試行"

#: ../mdkapplet-upgrade-helper:138
#, c-format
msgid "Congratulations"
msgstr "おめでとうございます"

#: ../mdkapplet-upgrade-helper:142
#, c-format
msgid "Upgrade to Mandriva %s release was successfull."
msgstr "Mandriva の %s リリースへのアップグレードに成功しました。"

#: ../mdkapplet-upgrade-helper:144
#, fuzzy, c-format
msgid "You must restart your system."
msgstr "システムを再起動してください。"

#: ../mdkapplet-upgrade-helper:145
#, c-format
msgid "Reboot"
msgstr "再起動"

#: ../mdkapplet-upgrade-helper:175
#, c-format
msgid ""
"Packages database is locked. Please close other applications\n"
"working with packages database (do you have another media\n"
"manager on another desktop, or are you currently installing\n"
"packages as well?)."
msgstr ""
"パッケージのデータベースがロックされています。パッケージの\n"
"データベースを使用しているアプリケーションを閉じてください。\n"
"(別のデスクトップでメディアマネージャを実行中、あるいはパッケージ\n"
"を現在インストール中ではありませんか?)"

#: ../mdkapplet-upgrade-helper:210
#, c-format
msgid "Failure when adding medium"
msgstr "メディアの追加に失敗しました"

#: ../mdkonline.pm:65
#, c-format
msgid "Distribution Upgrade"
msgstr "ディストリビューションのアップグレード"

#: ../mdkupdate:62
#, c-format
msgid ""
"mdkupdate version %s\n"
"Copyright (C) %s Mandriva.\n"
"This is free software and may be redistributed under the terms of the GNU "
"GPL.\n"
"\n"
"usage:\n"
msgstr ""
"mdkupdate バージョン %s\n"
"Copyright (C) %s Mandriva.\n"
"これはフリーソフトウェアであり、GNU GPL の下で再配布することができます。\n"
"\n"
"使用方法 :\n"

#: ../mdkupdate:67
#, c-format
msgid "  --help\t\t- print this help message.\n"
msgstr "  --help\t\t- このヘルプメッセージを出力\n"

#: ../mdkupdate:68
#, c-format
msgid "  --auto\t\t- Mandriva Update launched automatically.\n"
msgstr "  --auto\t\t- Mandriva Update を自動的に起動する。\n"

#: ../mdkupdate:69
#, c-format
msgid "  --mnf\t\t\t- launch mnf specific scripts.\n"
msgstr "  --mnf\t\t\t- MNF 固有のスクリプトを起動する。\n"

#: ../mdkupdate:70
#, c-format
msgid "  --noX\t\t\t- text mode version of Mandriva Update.\n"
msgstr "  --noX\t\t\t- テキストモードの Mandriva Update\n"

#: ../mdkupdate:71
#, c-format
msgid "  --debug\t\t\t- log what is done\n"
msgstr "  --debug\t\t\t- 記録を取る\n"

#: ../mdkupdate:102
#, c-format
msgid "Unable to update packages from update_source medium.\n"
msgstr "update_source メディアからパッケージを更新できません。\n"

#~ msgid "Do you want to upgrade?"
#~ msgstr "アップグレードしますか?"

#~ msgid "Yes"
#~ msgstr "はい"

#~ msgid "No"
#~ msgstr "いいえ"

#~ msgid "Mandriva Online seems to be reinstalled, reloading applet ...."
#~ msgstr ""
#~ "Mandriva Online が再インストールされたようです。アプレットを更新中 ..."

#~ msgid "Ok"
#~ msgstr "OK"

#~ msgid "Checking... Updates are available\n"
#~ msgstr "チェック中... 新しい更新があります\n"

#~ msgid "Packages are up to date"
#~ msgstr "パッケージは最新です"

#~ msgid "Failed to open urpmi database"
#~ msgstr "urpmi データベースを開けません"

#~ msgid "Connecting to"
#~ msgstr "接続しています"
s="hl kwc">or log::l("selecting new medium '$_[0]'"); $asked_medium = $_[0]; } sub changeMedium($$) { my ($method, $medium_name) = @_; log::l("change to medium $medium_name for method $method (refused by default)"); 0; } sub relGetFile($) { local $_ = $_[0]; if (my ($arch) = m|\.([^\.]*)\.rpm$|) { $_ = "$::o->{packages}{mediums}{$asked_medium}{rpmsdir}/$_"; s/%{ARCH}/$arch/g; } $_; } sub askChangeMedium($$) { my ($method, $medium_name) = @_; my $allow; do { local $::o->{method} = $method = 'cdrom' if $medium_name =~ /^\d+s$/; #- Suppl CD eval { $allow = changeMedium($method, $medium_name) }; } while $@; #- really it is not allowed to die in changeMedium!!! or install will cores with rpmlib!!! log::l($allow ? "accepting medium $medium_name" : "refusing medium $medium_name"); $allow; } sub method_is_from_ISO_images($) { my ($method) = @_; $method eq "disk-iso" || $method eq "nfs-iso"; } sub method_allows_medium_change($) { my ($method) = @_; $method eq "cdrom" || method_is_from_ISO_images($method); } sub look_for_ISO_images() { $iso_images{media} = []; ($iso_images{loopdev}, $iso_images{mountpoint}) = cat_("/proc/mounts") =~ m|(/dev/loop\d+)\s+(/tmp/image) iso9660| or return; my $get_iso_ids = sub { my ($F) = @_; my ($vol_id, $app_id) = c::get_iso_volume_ids(fileno $F); my ($cd_set) = $vol_id =~ /^(.*)-[0-9]+$/; $cd_set && { cd_set => $cd_set, app_id => $app_id }; }; sysopen(my $F, $iso_images{loopdev}, 0) or return; put_in_hash(\%iso_images, $get_iso_ids->($F)); my $iso_dir = $ENV{ISOPATH}; #- strip old root and remove iso file from path if present $iso_dir =~ s!^/sysroot!!; $iso_dir =~ s![^/]*.iso$!!; foreach my $iso_file (glob("$iso_dir/*.iso")) { my $iso_dev = devices::set_loop($iso_file) or return; if (sysopen($F, $iso_dev, 0)) { my $iso_ids = $get_iso_ids->($F); push @{$iso_images{media}}, { file => $iso_file, %$iso_ids } if $iso_ids; close($F); #- needed to delete loop device } devices::del_loop($iso_dev); } 1; } sub find_ISO_image_labelled($) { %iso_images or look_for_ISO_images() or return; my ($iso_label) = @_; find { $_->{app_id} eq $iso_label && $_->{cd_set} eq $iso_images{cd_set} } @{$iso_images{media}}; } sub changeIso($) { my ($iso_label) = @_; my $iso_info = find_ISO_image_labelled($iso_label) or return; eval { fs::umount($iso_images{mountpoint}) }; $@ and warnAboutFilesStillOpen(); devices::del_loop($iso_images{loopdev}); $iso_images{loopdev} = devices::set_loop($iso_info->{file}); eval { fs::mount($iso_images{loopdev}, $iso_images{mountpoint}, "iso9660", 'readonly'); log::l("using ISO image '$iso_label'"); 1; } } sub errorOpeningFile($) { my ($file) = @_; $file eq 'XXX' and return; #- special case to force closing file after rpmlib transaction. $current_medium eq $asked_medium and log::l("errorOpeningFile $file"), return; #- nothing to do in such case. $::o->{packages}{mediums}{$asked_medium}{selected} or return; #- not selected means no need for worying about. my $max = 32; #- always refuse after $max tries. if ($::o->{method} eq "cdrom") { cat_("/proc/mounts") =~ m,(/(?:dev|tmp)/\S+)\s+(?:/mnt/cdrom|/tmp/image), and $cdrom = $1; return unless $cdrom; ejectCdrom($cdrom); while ($max > 0 && askChangeMedium($::o->{method}, $asked_medium)) { $current_medium = $asked_medium; mountCdrom("/tmp/image"); my $getFile = getFile($file); $getFile && @advertising_images and copy_advertising($::o); $getFile and return $getFile; $current_medium = 'unknown'; #- don't know what CD is inserted now. ejectCdrom($cdrom); --$max; } } else { while ($max > 0 && askChangeMedium($::o->{method}, $asked_medium)) { $current_medium = $asked_medium; my $getFile = getFile($file); $getFile and return $getFile; $current_medium = 'unknown'; #- don't know what CD image has been copied. --$max; } } #- Don't unselect supplementary CDs. return if $asked_medium =~ /^\d+s$/; #- keep in mind the asked medium has been refused on this way. #- this means it is no more selected. $::o->{packages}{mediums}{$asked_medium}{selected} = undef; #- on cancel, we can expect the current medium to be undefined too, #- this enable remounting if selecting a package back. $current_medium = 'unknown'; return; } sub getFile { my ($f, $o_method, $o_altroot) = @_; log::l("getFile $f:$o_method"); my $rel = relGetFile($f); do { if ($f =~ m|^http://|) { require http; http::getFile($f); } elsif ($o_method =~ /crypto|update/i) { require crypto; crypto::getFile($f); } elsif ($::o->{method} eq "ftp") { require ftp; ftp::getFile($rel); } elsif ($::o->{method} eq "http") { require http; http::getFile("$ENV{URLPREFIX}/$rel"); } else { #- try to open the file, but examine if it is present in the repository, #- this allows handling changing a media when some of the files on the #- first CD have been copied to other to avoid media change... my $f2 = "$postinstall_rpms/$f"; $o_altroot ||= '/tmp/image'; $f2 = "$o_altroot/$rel" if !$postinstall_rpms || !-e $f2; $f2 = $rel if $rel =~ m!^/! && !-e $f2; #- not a relative path my $F; open($F, $f2) && $F; } } || errorOpeningFile($f); } sub getAndSaveFile { my ($file, $local) = @_ == 1 ? ("install/stage2/live$_[0]", $_[0]) : @_; local $/ = \ (16 * 1024); my $f = ref($file) ? $file : getFile($file) or return; open(my $F, ">$local") or log::l("getAndSaveFile(opening $local): $!"), return; local $_; while (<$f>) { syswrite($F, $_) or die("getAndSaveFile($local): $!") } 1; } #-###################################################################################### #- Post installation RPMS from cdrom only, functions #-###################################################################################### sub setup_postinstall_rpms($$) { my ($prefix, $packages) = @_; $postinstall_rpms and return; $postinstall_rpms = "$prefix/usr/postinstall-rpm"; require pkgs; log::l("postinstall rpms directory set to $postinstall_rpms"); clean_postinstall_rpms(); #- make sure in case of previous upgrade problem. mkdir_p($postinstall_rpms); my %toCopy; #- compute closure of package that may be copied, use INSTALL category #- in rpmsrate. $packages->{rpmdb} ||= pkgs::rpmDbOpen($prefix); foreach (@{$packages->{needToCopy} || []}) { my $p = pkgs::packageByName($packages, $_) or next; pkgs::selectPackage($packages, $p, 0, \%toCopy); } delete $packages->{rpmdb}; my @toCopy = grep { $_ && !$_->flag_selected } map { $packages->{depslist}[$_] } keys %toCopy; #- extract headers of package, this is necessary for getting #- the complete filename of each package. #- copy the package files in the postinstall RPMS directory. #- last arg is default medium '' known as the CD#1. #- cp_af doesn't handle correctly a missing file. eval { cp_af((grep { -r $_ } map { "/tmp/image/" . relGetFile($_->filename) } @toCopy), $postinstall_rpms) }; log::l("copying Auto Install Floppy"); getAndSaveInstallFloppies($::o, $postinstall_rpms, 'auto_install'); } sub clean_postinstall_rpms() { $postinstall_rpms and -d $postinstall_rpms and rm_rf($postinstall_rpms); } #-###################################################################################### #- Functions #-###################################################################################### sub getNextStep { my ($o) = @_; find { !$o->{steps}{$_}{done} && $o->{steps}{$_}{reachable} } @{$o->{orderedSteps}} } sub spawnShell() { return if $::o->{localInstall} || $::testing; if (my $shellpid = fork()) { output('/var/run/drakx_shell.pid', $shellpid); return; } $ENV{DISPLAY} ||= ":0"; #- why not :pp local *F; sysopen F, "/dev/tty2", 2 or log::l("cannot open /dev/tty2 -- no shell will be provided: $!"), goto cant_spawn; open STDIN, "<&F" or goto cant_spawn; open STDOUT, ">&F" or goto cant_spawn; open STDERR, ">&F" or goto cant_spawn; close F; print any::drakx_version(), "\n"; c::setsid(); ioctl(STDIN, c::TIOCSCTTY(), 0) or warn "could not set new controlling tty: $!"; my @args; -e '/etc/bashrc' and @args = qw(--rcfile /etc/bashrc); foreach (qw(/bin/bash /usr/bin/busybox /bin/sh)) { -x $_ or next; my $program_name = /busybox/ ? "/bin/sh" : $_; #- since perl_checker is too dumb exec { $_ } $program_name, @args or log::l("exec of $_ failed: $!"); } log::l("cannot open any shell"); cant_spawn: c::_exit(1); } sub getAvailableSpace { my ($o) = @_; #- make sure of this place to be available for installation, this could help a lot. #- currently doing a very small install use 36Mb of postinstall-rpm, but installing #- these packages may eat up to 90Mb (of course not all the server may be installed!). #- 65mb may be a good choice to avoid almost all problem of insuficient space left... my $minAvailableSize = 65 * sqr(1024); my $n = !$::testing && getAvailableSpace_mounted($o->{prefix}) || getAvailableSpace_raw($o->{fstab}) * 512 / 1.07; $n - max(0.1 * $n, $minAvailableSize); } sub getAvailableSpace_mounted { my ($prefix) = @_; my $dir = -d "$prefix/usr" ? "$prefix/usr" : $prefix; my (undef, $free) = MDK::Common::System::df($dir) or return; log::l("getAvailableSpace_mounted $free KB"); $free * 1024 || 1; } sub getAvailableSpace_raw { my ($fstab) = @_; do { $_->{mntpoint} eq '/usr' and return $_->{size} } foreach @$fstab; do { $_->{mntpoint} eq '/' and return $_->{size} } foreach @$fstab; if ($::testing) { my $nb = 450; log::l("taking ${nb}MB for testing"); return $nb << 11; } die "missing root partition"; } sub preConfigureTimezone { my ($o) = @_; require timezone; #- can't be done in install cuz' timeconfig %post creates funny things add2hash($o->{timezone}, timezone::read()) if $o->{isUpgrade}; $o->{timezone}{timezone} ||= timezone::bestTimezone($o->{locale}{country}); my $utc = every { !isFat_or_NTFS($_) } @{$o->{fstab}}; my $ntp = timezone::ntp_server(); add2hash_($o->{timezone}, { UTC => $utc, ntp => $ntp }); } sub setPackages { my ($o, $rebuild_needed) = @_; require pkgs; if (!$o->{packages} || is_empty_array_ref($o->{packages}{depslist})) { my $cdrom; ($o->{packages}, my $suppl_CDs) = pkgs::psUsingHdlists($o->{prefix}, $o->{method}); #- ask whether there are supplementary CDs SUPPL: { if ($suppl_CDs && !$o->{isUpgrade} && $o->ask_yesorno('', N("Do you have a supplementary CD to install?"), 0)) { #- by convention, the media names for suppl. CDs match /^\d+s$/ my $medium_name = '1s'; #- supplement 1 local $::isWizard = 0; local $o->{method} = 'cdrom'; (my $cdromdev) = detect_devices::cdroms(); last SUPPL if !$cdromdev; $cdrom = $cdromdev->{device}; devices::make($cdrom); ejectCdrom($cdrom); if ($o->ask_okcancel('', N("Insert the CD"), 1)) { mountCdrom("/mnt/cdrom", $cdrom); log::l($@) if $@; useMedium($medium_name); my $supplmedium = pkgs::psUsingHdlist( $o->{prefix}, # /mnt 'cdrom', $o->{packages}, "hdlist$medium_name.cz", $medium_name, 'media/main', "Supplementary CD $medium_name", 1, # selected "/mnt/cdrom/media/main/media_info/hdlist$medium_name.cz", ); if ($supplmedium) { log::l("read suppl hdlist"); $supplmedium->{prefix} = "removable://mnt/cdrom"; #- pour install_urpmi $supplmedium->{selected} = 1; $supplmedium->{method} = 'cdrom'; } else { log::l("no suppl hdlist"); } #- TODO loop if there are several supplementary CDs # ++$medium_name; $medium_name .= "s"; } } else { $suppl_CDs = 0; } } #- open rpm db according to right mode needed. $o->{packages}{rpmdb} ||= pkgs::rpmDbOpen($o->{prefix}, $rebuild_needed); #- always try to select basic kernel (else on upgrade, kernel will never be updated provided a kernel is already #- installed and provides what is necessary). pkgs::selectPackage($o->{packages}, pkgs::bestKernelPackage($o->{packages}) || die("missing kernel package"), 1); pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, 'basesystem') || die("missing basesystem package"), 1); #- must be done after getProvides #- if there is a supplementary CD, override the rpmsrate/compssUsers pkgs::read_rpmsrate( $o->{packages}, getFile($suppl_CDs ? "/mnt/cdrom/media/media_info/rpmsrate" : "media/media_info/rpmsrate") ); ($o->{compssUsers}, $o->{compssUsersSorted}) = pkgs::readCompssUsers( $o->{meta_class}, $suppl_CDs ? "/mnt/cdrom/media/media_info/compssUsers" : "", ); #- preselect default_packages and compssUsersChoices. setDefaultPackages($o); pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_) || next) foreach @{$o->{default_packages}}; #- umount supplementary CD. Will re-ask for it later if ($suppl_CDs) { getFile("XXX"); #- close still opened filehandles log::l("Umounting suppl. CD"); eval { fs::umount("/mnt/cdrom") }; #- re-mount CD 1 if this was a cdrom install if ($o->{method} eq 'cdrom') { eval { my $dev = detect_devices::tryOpen($cdrom); ioctl($dev, c::CDROMEJECT(), 1); }; $o->ask_warn('', N("Insert the CD 1 again")); mountCdrom("/tmp/image", $cdrom); $asked_medium = 1; } } } else { #- this has to be done to make sure necessary files for urpmi are #- present. pkgs::psUpdateHdlistsDeps($o->{prefix}, $o->{method}, $o->{packages}); #- open rpm db (always without rebuilding db, it should be false at this point). $o->{packages}{rpmdb} ||= pkgs::rpmDbOpen($o->{prefix}); } } sub setDefaultPackages { my ($o, $b_clean) = @_; if ($b_clean) { delete $o->{$_} foreach qw(default_packages compssUsersChoice); #- clean modified variables. } push @{$o->{default_packages}}, "brltty" if cat_("/proc/cmdline") =~ /brltty=/; push @{$o->{default_packages}}, "nfs-utils-clients" if $o->{method} eq "nfs"; push @{$o->{default_packages}}, "numlock" if $o->{miscellaneous}{numlock}; push @{$o->{default_packages}}, "raidtools" if !is_empty_array_ref($o->{all_hds}{raids}); push @{$o->{default_packages}}, "lvm2" if !is_empty_array_ref($o->{all_hds}{lvms}); push @{$o->{default_packages}}, "alsa", "alsa-utils" if any { $o->{modules_conf}->get_alias("sound-slot-$_") =~ /^snd-/ } 0 .. 4; push @{$o->{default_packages}}, "grub" if isLoopback(fs::get::root($o->{fstab})); push @{$o->{default_packages}}, uniq(grep { $_ } map { fs::format::package_needed_for_partition_type($_) } @{$o->{fstab}}); #- if no cleaning needed, populate by default, clean is used for second or more call to this function. unless ($b_clean) { if ($::auto_install && ($o->{compssUsersChoice} || {})->{ALL}) { $o->{compssUsersChoice}{$_} = 1 foreach map { @{$o->{compssUsers}{$_}{flags}} } @{$o->{compssUsersSorted}}; } if (!$o->{compssUsersChoice} && !$o->{isUpgrade}) { #- use default selection seen in compssUsers directly. foreach (keys %{$o->{compssUsers}}) { $o->{compssUsers}{$_}{selected} or next; log::l("looking for default selection on $_"); member($o->{meta_class} || 'default', @{$o->{compssUsers}{$_}{selected}}) || member('all', @{$o->{compssUsers}{$_}{selected}}) or next; log::l(" doing selection on $_"); $o->{compssUsersChoice}{$_} = 1 foreach @{$o->{compssUsers}{$_}{flags}}; } } } $o->{compssUsersChoice}{uc($_)} = 1 foreach grep { modules::probe_category("multimedia/$_") } modules::sub_categories('multimedia'); $o->{compssUsersChoice}{uc($_)} = 1 foreach map { $_->{driver} =~ /Flag:(.*)/ } detect_devices::probeall(); $o->{compssUsersChoice}{SYSTEM} = 1; $o->{compssUsersChoice}{DOCS} = !$o->{excludedocs}; $o->{compssUsersChoice}{UTF8} = $o->{locale}{utf8}; $o->{compssUsersChoice}{BURNER} = 1 if detect_devices::burners(); $o->{compssUsersChoice}{DVD} = 1 if detect_devices::dvdroms(); $o->{compssUsersChoice}{USB} = 1 if $o->{modules_conf}->get_probeall("usb-interface"); $o->{compssUsersChoice}{PCMCIA} = 1 if detect_devices::hasPCMCIA(); $o->{compssUsersChoice}{HIGH_SECURITY} = 1 if $o->{security} > 3; $o->{compssUsersChoice}{BIGMEM} = 1 if !$::oem && availableRamMB() > 800 && arch() !~ /ia64|x86_64/; $o->{compssUsersChoice}{SMP} = 1 if detect_devices::hasSMP(); $o->{compssUsersChoice}{CDCOM} = 1 if any { $_->{descr} =~ /commercial/i } values %{$o->{packages}{mediums}}; $o->{compssUsersChoice}{'3D'} = 1 if detect_devices::matching_desc('Matrox.* G[245][05]0') || detect_devices::matching_desc('Rage X[CL]') || detect_devices::matching_desc('3D Rage (?:LT|Pro)') || detect_devices::matching_desc('Voodoo [35]') || detect_devices::matching_desc('Voodoo Banshee') || detect_devices::matching_desc('8281[05].* CGC') || detect_devices::matching_desc('Rage 128') || detect_devices::matching_desc('Radeon ') || #- all Radeon card are now 3D with 4.3.0 detect_devices::matching_desc('[nN]Vidia.*T[nN]T2') || #- TNT2 cards detect_devices::matching_desc('[nN][vV]idia.*NV[56]') || detect_devices::matching_desc('[nN][vV]idia.*Vanta') || detect_devices::matching_desc('[nN][vV]idia.*[gG]e[fF]orce') || #- GeForce cards detect_devices::matching_desc('[nN][vV]idia.*NV1[15]') || detect_devices::matching_desc('[nN][vV]idia.*Quadro'); my @locale_pkgs = map { pkgs::packagesProviding($o->{packages}, 'locales-' . $_) } lang::langsLANGUAGE($o->{locale}{langs}); unshift @{$o->{default_packages}}, uniq(map { $_->name } @locale_pkgs); foreach (lang::langsLANGUAGE($o->{locale}{langs})) { $o->{compssUsersChoice}{qq(LOCALES"$_")} = 1; } $o->{compssUsersChoice}{'CHARSET"' . lang::l2charset($o->{locale}{lang}) . '"'} = 1; } sub unselectMostPackages { my ($o) = @_; pkgs::unselectAllPackages($o->{packages}); pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_) || next) foreach @{$o->{default_packages}}; } sub warnAboutNaughtyServers { my ($o) = @_; my @naughtyServers = pkgs::naughtyServers($o->{packages}) or return 1; my $r = $o->ask_from_list_('', formatAlaTeX(N("You have selected the following server(s): %s These servers are activated by default. They don't have any known security issues, but some new ones could be found. In that case, you must make sure to upgrade as soon as possible. Do you really want to install these servers? ", join(", ", @naughtyServers))), [ N_("Yes"), N_("No") ], 'Yes') or return; if ($r ne 'Yes') { log::l("unselecting naughty servers"); pkgs::unselectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_)) foreach @naughtyServers; } 1; } sub warnAboutRemovedPackages { my ($o, $packages) = @_; my @removedPackages = keys %{$packages->{state}{ask_remove} || {}} or return; if (!$o->ask_yesorno('', formatAlaTeX(N("The following packages will be removed to allow upgrading your system: %s Do you really want to remove these packages? ", join(", ", @removedPackages))), 1)) { $packages->{state}{ask_remove} = {}; } } sub addToBeDone(&$) { my ($f, $step) = @_; return &$f() if $::o->{steps}{$step}{done}; push @{$::o->{steps}{$step}{toBeDone}}, $f; } sub set_authentication { my ($o) = @_; my $when_network_is_up = sub { my ($f) = @_; #- defer running xxx - no network yet addToBeDone { require install_steps; install_steps::upNetwork($o, 'pppAvoided'); $f->(); } 'configureNetwork'; }; require authentication; authentication::set($o, $o->{netc}, $o->{authentication} ||= {}, $when_network_is_up); } sub killCardServices() { my $pid = chomp_(cat_("/tmp/cardmgr.pid")); $pid and kill(15, $pid); #- send SIGTERM } sub unlockCdrom(;$) { my ($cdrom) = @_; $cdrom or cat_("/proc/mounts") =~ m,(/(?:dev|tmp)/\S+)\s+(?:/mnt/cdrom|/tmp/image), and $cdrom = $1; eval { $cdrom and ioctl detect_devices::tryOpen($1), c::CDROM_LOCKDOOR(), 0 }; } sub ejectCdrom(;$) { my ($cdrom) = @_; getFile("XXX"); #- close still opened filehandle $cdrom ||= $1 if cat_("/proc/mounts") =~ m,(/(?:dev|tmp)/\S+)\s+(?:/mnt/cdrom|/tmp/image),; if ($cdrom) { #- umount BEFORE opening the cdrom device otherwise the umount will #- D state if the cdrom is already removed eval { fs::umount("/tmp/image") }; $@ and warnAboutFilesStillOpen(); eval { my $dev = detect_devices::tryOpen($cdrom); ioctl($dev, c::CDROMEJECT(), 1) if ioctl($dev, c::CDROM_DRIVE_STATUS(), 0) == c::CDS_DISC_OK(); }; } } sub warnAboutFilesStillOpen() { log::l("files still open: ", readlink($_)) foreach map { glob_("$_/fd/*") } glob_("/proc/*"); } sub setupFB { my ($o, $vga) = @_; $vga ||= 785; #- assume at least 640x480x16. require bootloader; foreach (@{$o->{bootloader}{entries}}) { $_->{vga} = $vga if $_->{vga}; #- replace existing vga= with } bootloader::install($o->{bootloader}, $o->{all_hds}{hds}); 1; } sub install_urpmi { my ($prefix, $method, $packages, $mediums) = @_; #- rare case where urpmi cannot be installed (no hd install path). $method eq 'disk' && !any::hdInstallPath() and return; #- clean to avoid opening twice the rpm db. delete $packages->{rpmdb}; #- import pubkey in rpmdb. my $db = pkgs::rpmDbOpenForInstall($prefix); $packages->parse_pubkeys(db => $db); foreach my $medium (values %$mediums) { $packages->import_needed_pubkeys($medium->{pubkey}, db => $db, callback => sub { my (undef, undef, $_k, $id, $imported) = @_; if ($id) { log::l(($imported ? "imported" : "found")." key=$id for medium $medium->{descr}"); $medium->{key_ids}{$id} = undef; } }); } my @cfg; foreach (sort { $a->{medium} <=> $b->{medium} } values %$mediums) { my $name = $_->{fakemedium}; if ($_->{ignored} || $_->{selected}) { my $dir = ($_->{prefix} || ${{ nfs => "file://mnt/nfs", disk => "file:/" . any::hdInstallPath(), ftp => $ENV{URLPREFIX}, http => $ENV{URLPREFIX}, cdrom => "removable://mnt/cdrom" }}{$method} || #- for live_update or live_install script. readlink("/tmp/image/media") =~ m,^(/.*)/media/*$, && "removable:/$1") . "/$_->{rpmsdir}"; #- use list file only if visible password or macro. my $need_list = $dir =~ m,^(?:[^:]*://[^/:\@]*:[^/:\@]+\@|.*%{),; #- } #- build a list file if needed. if ($need_list) { my $mask = umask 077; open(my $LIST, ">$prefix/var/lib/urpmi/list.$name") or log::l("failed to write list.$name"); umask $mask; #- build list file using internal data, synthesis file should exist. if ($_->{end} > $_->{start}) { #- WARNING this method of build only works because synthesis (or hdlist) #- has been read. foreach (@{$packages->{depslist}}[$_->{start} .. $_->{end}]) { my $arch = $_->arch; my $ldir = $dir; $ldir =~ s|/([^/]*)%{ARCH}|/./$1$arch|; $ldir =~ s|%{ARCH}|$arch|g; print $LIST "$ldir/".$_->filename."\n"; } } else { #- need to use another method here to build synthesis. open(my $F, "parsehdlist '$prefix/var/lib/urpmi/hdlist.$name.cz' |"); local $_; while (<$F>) { my ($arch) = /\.([^\.]+)\.rpm$/; my $ldir = $dir; $ldir =~ s|/([^/]*)%{ARCH}|/./$1$arch|; $ldir =~ s|%{ARCH}|$arch|g; print $LIST "$ldir/$_"; } close $F; } close $LIST; } #- build synthesis file if there are still not existing (ie not copied from mirror). if (-s "$prefix/var/lib/urpmi/synthesis.hdlist.$name.cz" <= 32) { unlink "$prefix/var/lib/urpmi/synthesis.hdlist.$name.cz"; run_program::rooted($prefix, "parsehdlist", ">", "/var/lib/urpmi/synthesis.hdlist.$name", "--synthesis", "/var/lib/urpmi/hdlist.$name.cz"); run_program::rooted($prefix, "gzip", "-S", ".cz", "/var/lib/urpmi/synthesis.hdlist.$name"); } my ($qname, $qdir) = ($name, $dir); $qname =~ s/(\s)/\\$1/g; $qdir =~ s/(\s)/\\$1/g; #- compute correctly reference to media/media_info my $with; if ($_->{update}) { #- an update medium always use "../base/hdlist.cz"; $with = "../base/hdlist.cz"; } else { $with = $_->{rpmsdir}; $with =~ s|/[^/]*%{ARCH}.*||; $with =~ s|/+|/|g; $with =~ s|/$||; $with =~ s|[^/]||g; $with =~ s!/!../!g; $with .= "../media/media_info/$_->{hdlist}"; } #- output new urpmi.cfg format here. push @cfg, "$qname " . ($need_list ? "" : $qdir) . " { hdlist: hdlist.$name.cz with_hdlist: $with" . ($need_list ? " list: list.$name" : "") . (keys(%{$_->{key_ids}}) ? " key-ids: " . join(',', keys(%{$_->{key_ids}})) : "") . ($dir =~ /removable:/ && " removable: /dev/cdrom") . ($_->{update} ? " update" : "") . " } "; } else { #- remove not selected media by removing hdlist and synthesis files copied. unlink "$prefix/var/lib/urpmi/hdlist.$name.cz"; unlink "$prefix/var/lib/urpmi/synthesis.hdlist.$name.cz"; } } eval { output "$prefix/etc/urpmi/urpmi.cfg", @cfg }; } #-############################################################################### #- kde stuff #-############################################################################### sub kderc_largedisplay { my ($prefix) = @_; update_gnomekderc($_, 'KDE', Contrast => 7, kfmIconStyle => "Large", kpanelIconStyle => "Normal", #- to change to Large when icons looks better KDEIconStyle => "Large") foreach list_skels($prefix, '.kderc'); substInFile { s/^(GridWidth)=85/$1=100/; s/^(GridHeight)=70/$1=75/; } $_ foreach list_skels($prefix, '.kde/share/config/kfmrc'); } sub kdemove_desktop_file { my ($prefix) = @_; my @toMove = qw(doc.kdelnk news.kdelnk updates.kdelnk home.kdelnk printer.kdelnk floppy.kdelnk cdrom.kdelnk FLOPPY.kdelnk CDROM.kdelnk); #- remove any existing save in Trash of each user and #- move appropriate file there after an upgrade. foreach my $dir (grep { -d $_ } list_skels($prefix, 'Desktop')) { renamef("$dir/$_", "$dir/Trash/$_") foreach grep { -e "$dir/$_" } @toMove, grep { /\.rpmorig$/ } all($dir) } } #-############################################################################### #- auto_install stuff #-############################################################################### sub auto_inst_file() { "$::prefix/root/drakx/auto_inst.cfg.pl" } sub report_bug { my ($prefix) = @_; any::report_bug($prefix, 'auto_inst' => g_auto_install('', 1)); } sub g_auto_install { my ($b_replay, $b_respect_privacy) = @_; my $o = {}; require pkgs; $o->{default_packages} = pkgs::selected_leaves($::o->{packages}); my @fields = qw(mntpoint fs_type size); $o->{partitions} = [ map { my %l; @l{@fields} = @$_{@fields}; \%l } grep { $_->{mntpoint} } @{$::o->{fstab}} ]; exists $::o->{$_} and $o->{$_} = $::o->{$_} foreach qw(locale authentication mouse netc timezone superuser intf keyboard users partitioning isUpgrade manualFstab nomouseprobe crypto security security_user libsafe netcnx useSupermount autoExitInstall X services); #- TODO modules bootloader if ($::o->{printer}) { $o->{printer}{$_} = $::o->{printer}{$_} foreach qw(SPOOLER DEFAULT BROWSEPOLLADDR BROWSEPOLLPORT MANUALCUPSCONFIG); $o->{printer}{configured} = {}; foreach my $queue (keys %{$::o->{printer}{configured}}) { my $val = $::o->{printer}{configured}{$queue}{queuedata}; exists $val->{$_} and $o->{printer}{configured}{$queue}{queuedata}{$_} = $val->{$_} foreach keys %{$val || {}}; } } local $o->{partitioning}{auto_allocate} = !$b_replay; $o->{autoExitInstall} = !$b_replay; $o->{interactiveSteps} = [ 'doPartitionDisks', 'formatPartitions' ] if $b_replay; #- deep copy because we're modifying it below $o->{users} = [ @{$o->{users} || []} ]; my @user_info_to_remove = ( if_($b_respect_privacy, qw(name realname home pw)), qw(oldu oldg password password2), ); $_ = { %{$_ || {}} }, delete @$_{@user_info_to_remove} foreach $o->{superuser}, @{$o->{users} || []}; if ($b_respect_privacy && $o->{netcnx}) { if (my $type = $o->{netcnx}{type}) { my @netcnx_type_to_remove = qw(passwd passwd2 login phone_in phone_out); $_ = { %{$_ || {}} }, delete @$_{@netcnx_type_to_remove} foreach $o->{netcnx}{$type}; } } require Data::Dumper; my $str = join('', "#!/usr/bin/perl -cw # # You should check the syntax of this file before using it in an auto-install. # You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file # (note the '#!/usr/bin/perl -cw' on the first line). ", Data::Dumper->Dump([$o], ['$o']), "\0"); $str =~ s/ {8}/\t/g; #- replace all 8 space char by only one tabulation, this reduces file size so much :-) $str; } sub getAndSaveInstallFloppies { my ($o, $dest_dir, $name) = @_; if ($postinstall_rpms && -d $postinstall_rpms && -r "$postinstall_rpms/auto_install.img") { log::l("getAndSaveInstallFloppies: using file saved as $postinstall_rpms/auto_install.img"); cp_af("$postinstall_rpms/auto_install.img", "$dest_dir/$name.img"); "$dest_dir/$name.img"; } else { my $image = cat_("/proc/cmdline") =~ /pcmcia/ ? "pcmcia" : arch() =~ /ia64|ppc/ ? "all" : #- we only use all.img there ${{ disk => 'hd_grub', 'disk-iso' => 'hd_grub', cdrom => 'cdrom', ftp => 'network', nfs => 'network', http => 'network' }}{$o->{method}}; my $have_drivers = $image eq 'network'; $image .= arch() =~ /sparc64/ && "64"; #- for sparc64 there are a specific set of image. if ($have_drivers) { getAndSaveFile("install/images/${image}_drivers.img", "$dest_dir/${name}_drivers.img") or log::l("failed to write Install Floppy (${image}_drivers.img) to $dest_dir/${name}_drivers.img"), return; } getAndSaveFile("install/images/$image.img", "$dest_dir/$name.img") or log::l("failed to write Install Floppy ($image.img) to $dest_dir/$name.img"), return; "$dest_dir/$name.img", if_($have_drivers, "$dest_dir/${name}_drivers.img"); } } sub getAndSaveAutoInstallFloppies { my ($o, $replay) = @_; my $name = ($replay ? 'replay' : 'auto') . '_install'; my $dest_dir = "$o->{prefix}/root/drakx"; eval { modules::load('loop') }; if (arch() =~ /ia64/) { #- nothing yet } else { my $mountdir = "$o->{prefix}/root/aif-mount"; -d $mountdir or mkdir $mountdir, 0755; my $param = 'kickstart=floppy ' . generate_automatic_stage1_params($o); my @imgs = getAndSaveInstallFloppies($o, $dest_dir, $name) or return; foreach my $img (@imgs) { my $dev = devices::set_loop($img) or log::l("couldn't set loopback device"), return; find { eval { fs::mount($dev, $mountdir, $_, 0); 1 } } qw(ext2 vfat) or return; if (@imgs == 1 || $img =~ /drivers/) { local $o->{partitioning}{clearall} = !$replay; eval { output("$mountdir/auto_inst.cfg", g_auto_install($replay)) }; $@ and log::l("Warning: <", formatError($@), ">"); } if (-e "$mountdir/menu.lst") { # hd_grub boot disk is different than others substInFile { s/^(\s*timeout.*)/timeout 1/; s/\bautomatic=method:disk/$param/; } "$mountdir/menu.lst"; } elsif (-e "$mountdir/syslinux.cfg") { substInFile { s/timeout.*/$replay ? 'timeout 1' : ''/e; s/^(\s*append)/$1 $param/ } "$mountdir/syslinux.cfg"; unlink "$mountdir/help.msg"; output "$mountdir/boot.msg", "\n0c", "!! If you press enter, an auto-install is going to start. All data on this computer is going to be lost, including any Windows partitions !! ", "07\n" if !$replay; } fs::umount($mountdir); devices::del_loop($dev); } rmdir $mountdir; @imgs; } } sub g_default_packages { my ($o, $b_quiet) = @_; my $floppy = detect_devices::floppy(); while (1) { $o->ask_okcancel('', N("Insert a FAT formatted floppy in drive %s", $floppy), 1) or return; eval { fs::mount(devices::make($floppy), "/floppy", "vfat", 0) }; last if !$@; $o->ask_warn('', N("This floppy is not FAT formatted")); } require Data::Dumper; my $str = Data::Dumper->Dump([ { default_packages => pkgs::selected_leaves($o->{packages}) } ], ['$o']); $str =~ s/ {8}/\t/g; output('/floppy/auto_inst.cfg', "# You should always check the syntax with 'perl -cw auto_inst.cfg.pl'\n", "# before testing. To use it, boot with ``linux defcfg=floppy''\n", $str, "\0"); fs::umount("/floppy"); $b_quiet or $o->ask_warn('', N("To use this saved packages selection, boot installation with ``linux defcfg=floppy''")); } sub loadO { my ($O, $f) = @_; $f ||= auto_inst_file(); my $o; if ($f =~ /^(floppy|patch)$/) { my $f = $f eq "floppy" ? 'auto_inst.cfg' : "patch"; unless ($::testing) { my $dev = devices::make(detect_devices::floppy()); foreach my $fs (arch() =~ /sparc/ ? 'romfs' : ('ext2', 'vfat')) { eval { fs::mount($dev, '/mnt', $fs, 'readonly'); 1 } and goto mount_ok; } die "Couldn't mount floppy [$dev]"; mount_ok: $f = "/mnt/$f"; } -e $f or $f .= '.pl'; my $_b = before_leaving { fs::umount("/mnt") unless $::testing; modules::unload(qw(vfat fat)); }; $o = loadO($O, $f); } else { -e "$f.pl" and $f .= ".pl" unless -e $f; my $fh; if (-e $f) { open $fh, $f } else { $fh = getFile($f) or die N("Error reading file %s", $f) } { local $/ = "\0"; no strict; eval <$fh>; close $fh; $@ and die; } $O and add2hash_($o ||= {}, $O); } $O and bless $o, ref $O; #- handle backward compatibility for things that changed foreach (@{$o->{partitions} || []}, @{$o->{manualFstab} || []}) { if (my $pt_type = delete $_->{type}) { fs::type::set_pt_type($_, $pt_type); } } $o; } sub generate_automatic_stage1_params { my ($o) = @_; my $method = $o->{method}; my @ks; if ($o->{method} eq 'http') { $ENV{URLPREFIX} =~ m!(http|ftp)://([^/:]+)(/.*)! or die; $method = $1; #- in stage1, FTP via HTTP proxy is available through FTP config, not HTTP @ks = (server => $2, directory => $3); } elsif ($o->{method} eq 'ftp') { @ks = (server => $ENV{HOST}, directory => $ENV{PREFIX}, user => $ENV{LOGIN}, pass => $ENV{PASSWORD}); } elsif ($o->{method} eq 'nfs') { cat_("/proc/mounts") =~ m|(\S+):(\S+)\s+/tmp/nfsimage| or internal_error("can't find nfsimage"); @ks = (server => $1, directory => $2); } @ks = (method => $method, @ks); if (member($o->{method}, qw(http ftp nfs))) { if ($ENV{PROXY}) { push @ks, proxy_host => $ENV{PROXY}, proxy_port => $ENV{PROXYPORT}; } my ($intf) = values %{$o->{intf}}; push @ks, interface => $intf->{DEVICE}; if ($intf->{BOOTPROTO} eq 'dhcp') { push @ks, network => 'dhcp'; } else { push @ks, network => 'static', ip => $intf->{IPADDR}, netmask => $intf->{NETMASK}, gateway => $o->{netc}{GATEWAY}; require network::network; if (my @dnss = network::network::dnsServers($o->{netc})) { push @ks, dns => $dnss[0]; } } } #- sync it with ../mdk-stage1/automatic.c my %aliases = (method => 'met', network => 'netw', interface => 'int', gateway => 'gat', netmask => 'netm', adsluser => 'adslu', adslpass => 'adslp', hostname => 'hos', domain => 'dom', server => 'ser', directory => 'dir', user => 'use', pass => 'pas', disk => 'dis', partition => 'par'); 'automatic=' . join(',', map { ($aliases{$_->[0]} || $_->[0]) . ':' . $_->[1] } group_by2(@ks)); } sub guess_mount_point {