slitaz-tools rev 738

Moved all mountbox, burnbox, bootfloppybox to oldstuff/gtkdialog
author Christophe Lincoln <pankso@slitaz.org>
date Sat Apr 28 20:16:24 2012 +0200 (2012-04-28)
parents b4c3846a03c1
children ae6279a453a6
files doc/burnbox.en.html doc/burnbox.fr.html doc/burnbox.html doc/burnbox.pt_BR.html lib/libmountbox oldstuff/gtkdialog/bootfloppybox oldstuff/gtkdialog/bootfloppybox.desktop oldstuff/gtkdialog/burnbox oldstuff/gtkdialog/burnbox-doc.desktop oldstuff/gtkdialog/burnbox.desktop oldstuff/gtkdialog/burnbox.en.html oldstuff/gtkdialog/burnbox.fr.html oldstuff/gtkdialog/burnbox.html oldstuff/gtkdialog/burnbox.pt_BR.html oldstuff/gtkdialog/libmountbox oldstuff/gtkdialog/mountbox oldstuff/gtkdialog/mountbox.desktop rootfs/usr/share/applications/bootfloppybox.desktop rootfs/usr/share/applications/burnbox-doc.desktop rootfs/usr/share/applications/burnbox.desktop rootfs/usr/share/applications/mountbox.desktop tinyutils/bootfloppybox tinyutils/burnbox tinyutils/mountbox
line diff
     1.1 --- a/doc/burnbox.en.html	Sat Apr 28 20:13:13 2012 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,119 +0,0 @@
     1.4 -<!DOCTYPE html>
     1.5 -<html xmlns="http://www.w3.org/1999/xhtml">
     1.6 -<head>
     1.7 -	<title>Burnbox Manual</title>
     1.8 -	<meta charset="utf-8" />
     1.9 -	<link rel="stylesheet" type="text/css" href="style.css" />
    1.10 -</head>
    1.11 -<body>
    1.12 -
    1.13 -<div id="header">
    1.14 -	<h1>SliTaz Burnbox Manual</h1>
    1.15 -</div>
    1.16 -
    1.17 -<!-- Start content -->
    1.18 -<div id="content">
    1.19 -
    1.20 -<h3>About</h3>
    1.21 -<p>
    1.22 -Burnbox supports:
    1.23 -</p>
    1.24 -<ul>
    1.25 -	<li>ISO burning</li>
    1.26 -	<li>Backup of data and audio CDs</li>
    1.27 -	<li>Data CD/DVD burning (DVD burning requires an optional package <em>dvd+rw-tools</em>)</li>
    1.28 -	<li>Audio CD burning (MP3 requires an optional package <em>mpg123</em>)</li>
    1.29 -	<li>Video CD (VCD/SVCD) burning (requires packages <em>vcdimager</em> and <em>ffmpeg</em>)</li>
    1.30 -</ul>
    1.31 -
    1.32 -<h3>General Device Settings</h3>
    1.33 -<p>
    1.34 -In the last tab, make sure the cdrom settings are correct (Device:/dev/cdrom; Speed (auto-detected): 48; Options: ). 
    1.35 -Input is taken from the DEVICE settings.
    1.36 -</p>
    1.37 -
    1.38 -<h3>Blank CD/DVD-RW</h3>
    1.39 -<p>
    1.40 -Use <code>Blank disk</code> to erase contents and prepare for burning.
    1.41 -</p>
    1.42 -
    1.43 -<h3>Iso Burning</h3>
    1.44 -<p>
    1.45 -This is supported in the third tab.
    1.46 -</p>
    1.47 -<ul>
    1.48 -	<li>Press button <code>Browse</code> to specify the iso file path</li>
    1.49 -	<li>Press button <code>Burn ISO</code></li>
    1.50 -</ul>
    1.51 -<p>
    1.52 -You can also create or manipulate ISO images with the ISO Master utility.
    1.53 -</p>
    1.54 -
    1.55 -<h3>Backup of data and audio CD</h3>
    1.56 -<p>
    1.57 -This is supported in the second tab. Optional package <em>cdrkit-isoinfo</em> may help to improve the burn speed. 
    1.58 -</p>
    1.59 -<ul>
    1.60 -	<li>Insert CD</li>
    1.61 -	<li>Select backup option: "Save backup on Hard Disk Folder" (default) or "Backup on CD disc"</li>
    1.62 -	<li>If backup option is "Save backup on Hard Disk Folder" (default), then specify the folder to do a "CD/DVD backup"</li>
    1.63 -	<li>Press button <code>Backup DataCD</code></li>
    1.64 -</ul>
    1.65 -<p>
    1.66 -Audio CD ripping is supported using the asunder package. 
    1.67 -</p>
    1.68 -
    1.69 -<h3>Data CD/DVD burning</h3>
    1.70 -<p>
    1.71 -This is supported in the First tab. One can specify the burn type before adding files. 
    1.72 -Depending upon the burn type, the files are decoded on the fly. 
    1.73 -One can remove the added files by simply double-clicking on the file in the tree view. 
    1.74 -Total track size shows the CD/DVD space occupied.
    1.75 -</p>
    1.76 -
    1.77 -<ul>
    1.78 -	<li>Select data-cd in Burn Type</li>
    1.79 -	<li>Specify file/folder or <code>Browse</code></li>
    1.80 -	<li>Press button <code>Add</code></li>
    1.81 -	<li>Press button <code>Burn Disc</code></li>
    1.82 -</ul>
    1.83 -
    1.84 -<h3>Audio CD burning</h3>
    1.85 -<p>
    1.86 -This is supported in the first tab. WAV, OGG, MP3 files are supported. 
    1.87 -OGG and MP3 are automatically converted into an uncompressed WAV format for burning.
    1.88 -</p>
    1.89 -<ul>
    1.90 -	<li>Select audio-cd in Burn Type</li>
    1.91 -	<li>Specify file/folder or <code> Browse</code></li>
    1.92 -	<li>Press button <code> Add</code> to auto-decode to uncompressed WAV (OGG, MP3 are decoded)</li>
    1.93 -	<li>Press button <code> Burn Disc</code></li>
    1.94 -</ul>
    1.95 -
    1.96 -<h3>Video CD (VCD/SVCD) burning</h3>
    1.97 -<p>
    1.98 -This is supported in the first tab. Only burning mpg video format is supported directly: MPEG-1 video for vcd and MPEG-2 for svcd and dvd. 
    1.99 -AVI, MOV, FLV, WMV videos are automatically converted into a VCD/SVCD/DVD compatible mpg video format.
   1.100 -</p>
   1.101 -<ul>
   1.102 -	<li>Select video-dvd, vcd or svcd in Burn Type</li>
   1.103 -	<li>Specify file/folder or <code>Browse</code></li>
   1.104 -	<li>Press button <code>Add</code> and select Enable decoding video for MPG files (AVI, FLV, MOV, WMV are decoded)</li>
   1.105 -	<li>Press button <code>Burn Disc</code></li>
   1.106 -</ul>
   1.107 -
   1.108 -<h3>Common Problems</h3>
   1.109 -<ul>
   1.110 -	<li>Burnbox works as root but not for a user: This happens when the user is not added to the "cdrom" group <pre>addgroup tux cdrom</pre></li>
   1.111 -	<li>Cdrom not readable / writable: Make sure the user has proper permissions and is added to the "cdrom" group</li>	
   1.112 -	<li>MP3 audio burn does not work: Check if you have installed <em>mpg123</em></li>
   1.113 -	<li>VCD option does not work: Check if you have installed <em>vcdimager</em></li>
   1.114 -	<li>AVI, FLV, WMV files are not decoded to MPG: Check if you have installed <em>ffmpeg</em></li>
   1.115 -	<li>DVD burn does not work: Check if you have installed <em>dvd+rw-tools</em></li>
   1.116 -</ul>
   1.117 -
   1.118 -<!-- End content -->
   1.119 -</div>
   1.120 -
   1.121 -</body>
   1.122 -</html>
     2.1 --- a/doc/burnbox.fr.html	Sat Apr 28 20:13:13 2012 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,120 +0,0 @@
     2.4 -<!DOCTYPE html>
     2.5 -<html xmlns="http://www.w3.org/1999/xhtml">
     2.6 -<head>
     2.7 -	<title>Documentation de Burnbox</title>
     2.8 -	<meta charset="utf-8" />
     2.9 -	<link rel="stylesheet" type="text/css" href="style.css" />
    2.10 -</head>
    2.11 -<body>
    2.12 -
    2.13 -<div id="header">
    2.14 -	<h1>Documentation de SliTaz Burnbox</h1>
    2.15 -</div>
    2.16 -
    2.17 -<!-- Start content -->
    2.18 -<div id="content">
    2.19 -
    2.20 -<h3>A propos</h3>
    2.21 -<p>
    2.22 -Possibilités de Burnbox:
    2.23 -</p>
    2.24 -<ul>
    2.25 -	<li>Gravure d'image ISO</li>
    2.26 -	<li>Sauvegarde de données et des CDs audio</li>
    2.27 -	<li>Enregistrement de données sur CD/DVD (la gravure sur DVD burning nécessite un paquet suplémentaire <em>dvd+rw-tools</em>)</li>
    2.28 -	<li>Enregistrement de CD Audio (pour les MP3 il faut installer <em>mpg123</em>)</li>
    2.29 -	<li>Enregistrement de CD Video (VCD/SVCD) (paquets requis: <em>vcdimager</em> et <em>ffmpeg</em>)</li>
    2.30 -</ul>
    2.31 -
    2.32 -<h3>Configuration générale des périphériques</h3>
    2.33 -<p>
    2.34 -Dans le dernier onglet, assurez-vous que les paramètres sont correctes (Pilote:/dev/cdrom; Vitess (auto-detected): 48; Options: ).
    2.35 -Les informations sont récupérées depuis la variable DEVICE.
    2.36 -</p>
    2.37 -
    2.38 -<h3>Effacer CD/DVD-RW</h3>
    2.39 -<p>
    2.40 -Utilisez <code>Blank disk</code> pour effacer un média.
    2.41 -</p>
    2.42 -
    2.43 -<h3>Graver une ISO</h3>
    2.44 -<p>
    2.45 -Cliquez sur le troisième onglet.
    2.46 -</p>
    2.47 -<ul>
    2.48 -	<li>Cliquez sur le bouton <code>Browse</code> pour rechercher l'image ISO'</li>
    2.49 -	<li>Cliquez sur le bouton <code>Burn ISO</code></li>
    2.50 -</ul>
    2.51 -<p>
    2.52 -Vous pouvez créér ou modifier des images ISO avec l'outil ISO Master.
    2.53 -</p>
    2.54 -
    2.55 -<h3>Sauvegarde de données et de CD audio</h3>
    2.56 -<p>
    2.57 -Ceci est pris en charge dans le deuxième onglet. Le paquet <em>cdrkit-isoinfo</em> (optionnel) peut vous aider à améliorer la vitesse d'enregistrement. 
    2.58 -</p>
    2.59 -<ul>
    2.60 -	<li>Insérez un CD</li>
    2.61 -	<li>Choisisse l'option: "Save backup on Hard disk" (par défaut) où "Backup on CD disc"</li>
    2.62 -	<li>Si l'option sélectionnée est "Save backup on Hard disk" (défaut), préciser le dossier à utiliser pour "CD/DVD backup"</li>
    2.63 -	<li>Cliquez sur le bouton <code>Backup DataCD</code></li>
    2.64 -</ul>
    2.65 -<p>
    2.66 -
    2.67 -l'extraction de CD audio est prise en charge en utilisant le paquet Asunder.
    2.68 -</p>
    2.69 -
    2.70 -<h3>Enregistrement des données sur CD/DVD</h3>
    2.71 -<p>
    2.72 -Ceci est pris en charge dans le premier onglet. On peut spécifier le type de gravure avant d'ajouter des fichiers.
    2.73 -Selon le type de gravure, les fichiers sont déchiffrés à la volée.
    2.74 -On peut supprimer les fichiers ajoutés simplement en double-cliquant sur le fichier dans l'arborescence.
    2.75 -La taille de la piste Total indique l'espace occupé sur le CD / DVD.
    2.76 -</p>
    2.77 -
    2.78 -<ul>
    2.79 -	<li>Choisissez data-cd dans Burn Type</li>
    2.80 -	<li>Indiquez le fichiers/dossier ou cliquez sur <code>Browse</code></li>
    2.81 -	<li>Cliquez sur le bouton <code>Add</code></li>
    2.82 -	<li>Cliquez sur le bouton <code>Burn Disc</code></li>
    2.83 -</ul>
    2.84 -
    2.85 -<h3>Enregistrement de CD audio</h3>
    2.86 -<p>
    2.87 -Ceci est pris en charge dans le premier onglet. les formats WAV, OGG, MP3 sont supportés.
    2.88 -Les fichiers OGG et MP3 sont automatiquement convertis et décompressé au format WAV pour la gravure.
    2.89 -</p>
    2.90 -<ul>
    2.91 -	<li>Choisissez audio-cd dans "Burn Type"</li>
    2.92 -	<li>Indiquez le fichiers/dossier ou cliquez sur <code>Browse</code></li>
    2.93 -	<li>Cliquez sur <code> Add</code> to auto-decode to uncompressed WAV (les fichiers OGG, MP3 sont décodés)</li>
    2.94 -	<li>Cliquez sur le bouton <code>Burn Disc</code></li>
    2.95 -</ul>
    2.96 -
    2.97 -<h3>Enregistrement de video sur CD (VCD/SVCD)</h3>
    2.98 -<p>
    2.99 -Ceci est pris en charge dans le premier onglet. Seul le format MPG est directement pris en charge: vidéo MPEG-1 pour VCD et MPEG-2 pour SVCD et DVD. 
   2.100 -Les formats AVI, MOV, FLV, WMV vidéos sont automatiquement converties en un VCD/SVCD/DVD compatible avec le format vidéo mpg.
   2.101 -</p>
   2.102 -<ul>
   2.103 -	<li>Sélectionnez ideo-dvd, vcd ou svcd dans Burn Type</li>
   2.104 -	<li>Indiquez le fichier/répertoire ou cliquez sur <code>Browse</code></li>
   2.105 -	<li>Cliquez sur le bouton <code>Add</code> et cochez "Enable decoding video" pour les fichiers MPG (AVI, FLV, MOV, WMV sont décodés)</li>
   2.106 -	<li>Cliquez sur le bouton <code>Burn Disc</code></li>
   2.107 -</ul>
   2.108 -
   2.109 -<h3>Problèmes fréquents</h3>
   2.110 -<ul>
   2.111 -	<li>Burnbox fonctionne uniquement avec le compte root: Cela arrive si l'utilisateur ne fait pas parti du group "cdrom"<pre>addgroup tux cdrom</pre></li>
   2.112 -	<li>Le cdrom n'est pas accessible en lecture ou écriture: Assurez-vous nque l'utilisateur à les bonnes permissions et qu'il edt bien membre du groupe "cdrom"</li>	
   2.113 -	<li>La gravure des fichiers MP3 ne fonctionne pas: Vérifiez si <em>mpg123</em> est installé</li>
   2.114 -	<li>Les options VCD ne fonctionnes pas: Installez <em>vcdimager</em></li>
   2.115 -	<li>Les fichiers AVI, FLV, WMV ne sont pas transcodés au format MPG: Vérifiez l'installation de <em>ffmpeg</em></li>
   2.116 -	<li>La gravure de DVD ne fonctionne pas: Vérifiez si vous avez installé <em>dvd+rw-tools</em></li>
   2.117 -</ul>
   2.118 -
   2.119 -<!-- End content -->
   2.120 -</div>
   2.121 -
   2.122 -</body>
   2.123 -</html>
     3.1 --- a/doc/burnbox.html	Sat Apr 28 20:13:13 2012 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,1 +0,0 @@
     3.4 -burnbox.en.html
     3.5 \ No newline at end of file
     4.1 --- a/doc/burnbox.pt_BR.html	Sat Apr 28 20:13:13 2012 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,133 +0,0 @@
     4.4 -<!DOCTYPE html>
     4.5 -<html xmlns="http://www.w3.org/1999/xhtml">
     4.6 -<head>
     4.7 -	<title>Manual do Burnbox</title>
     4.8 -	<meta charset="utf-8" />
     4.9 -	<link rel="stylesheet" type="text/css" href="style.css" />
    4.10 -</head>
    4.11 -<body>
    4.12 -
    4.13 -<div id="header">
    4.14 -	<h1>Manual do Burnbox (Aplicativo de Gravação de CD/DVD)</h1>
    4.15 -</div>
    4.16 -
    4.17 -<!-- Start content -->
    4.18 -<div id="content">
    4.19 -
    4.20 -<h3>Sobre</h3>
    4.21 -<p>
    4.22 -	O Burnbox suporta:
    4.23 -</p>
    4.24 -<ul>
    4.25 -	<li>Gravação de imagens ISO</li>
    4.26 -	<li>Backup de dados e CDs de áudio</li>
    4.27 -	<li>Gravação de dados em CD/DVD (A gravação em DVD requer o pacote opcional <em>dvd+rw-tools</em>)</li>
    4.28 -	<li>Gravação de CD de áudio (Para áudio MP3 é necessário o pacote <em>mpg123</em>)</li>
    4.29 -	<li>Gravação de Video CD (VCD/SVCD) (Requer os pacotes <em>vcdimager</em> e <em>ffmpeg</em>)</li>
    4.30 -</ul>
    4.31 -
    4.32 -<h3>Configurações de Dispositivo</h3>
    4.33 -<p>
    4.34 -Assegure-se de que o drive de cdrom está configurado corretamente 
    4.35 -na primeira aba do programa (device: /dev/cdrom, speed (auto-detected): 48;
    4.36 -Options: ). A entrada é definida a partir da configuração do DEVICE (dispositivo).
    4.37 -</p>
    4.38 -
    4.39 -<h3>Apagar CD/DVD-RW</h3>
    4.40 -<p>
    4.41 -Use a opção <code>Blank disk</code> para apagar o conteúdo de um cd ou
    4.42 -dvd regravável e prepará-lo para gravação.</p>
    4.43 -
    4.44 -<h3>Gravação de Imagens ISO</h3>
    4.45 -<p>
    4.46 -Utilize a segunda aba para gravações de imagem ISO.
    4.47 -</p>
    4.48 -<ul>
    4.49 -	<li>Clique no botão <code>Browse</code> para especificar a imagem iso</li>
    4.50 -	<li>Clique no botão <code>Burn ISO</code> para iniciar a gravação</li>
    4.51 -</ul>
    4.52 -<p>
    4.53 -Você pode criar ou manipular imagens ISO com o aplicativo ISO Master.
    4.54 -</p>
    4.55 -
    4.56 -<h3>Backup de dados e CD de áudio</h3>
    4.57 -<p>
    4.58 -Utilize a segunda aba. O pacote opcional <em>cdrkit-isoinfo</em> 
    4.59 -pode ajudar a aumentar as velocidades de gravação. 
    4.60 -</p>
    4.61 -<ul>
    4.62 -	<li>Coloque o  CD no drive</li>
    4.63 -	<li>Selecione a opção de backup: "Save backup on Hard disk" (default) ou "Backup on CD disc"</li>
    4.64 -	<li>Se você selecionar a opção "Save backup on Hard disk" (default), selecione a pasta para gravar o "CD/DVD backup"</li>
    4.65 -	<li>Clique no botão <code>Backup DataCD</code></li>
    4.66 -</ul>
    4.67 -<p>
    4.68 -A extração de faixas de áudio de CDs é possível com o aplicativo Asunder. 
    4.69 -</p>
    4.70 -
    4.71 -<h3>Gravação de CD/DVD de dados</h3>
    4.72 -<p>
    4.73 -Você encontra esta opção na terceira aba. Pode-se especificar o tipo de 
    4.74 -gravação antes de adiciona os arquivos. Dependendo do tipo de gravação
    4.75 -escolhido, os arquivos são decodificados durante a execução do programa.
    4.76 -Pode-se remover arquivos simplesmente clicando no nome do arquivo na
    4.77 -visão de pastas em árvore. A informação "total track size" mostra o
    4.78 -quanto o CD/DVD está ocupado.
    4.79 -</p>
    4.80 -
    4.81 -<ul>
    4.82 -	<li>Selecione "data-cd" em "Burn Type"</li>
    4.83 -	<li>Especifique "file/folder" ou <code>Browse</code></li>
    4.84 -	<li>Clique em <code>Add</code></li>
    4.85 -	<li>Clique em <code>Burn Disc</code></li>
    4.86 -</ul>
    4.87 -
    4.88 -<h3>Gravação de CDs de áudio</h3>
    4.89 -<p>
    4.90 -Você encontra esta opção na terceira aba. São suportados arquivos WAV, OGG
    4.91 -e MP3. OGG e MP3 são convertidos automaticamente em arquivos WAV sem
    4.92 -compressão para a gravação.
    4.93 -</p>
    4.94 -<ul>
    4.95 -	<li>Selecione "audio-cd" in "Burn Type"</li>
    4.96 -	<li>Especifique "file/folder" ou <code> Browse</code></li>
    4.97 -	<li>Clique em <code> Add</code> para decodificar arquivos OGG e MP3 em WAV</li>
    4.98 -	<li>Clique em <code> Burn Disc</code></li>
    4.99 -</ul>
   4.100 -
   4.101 -<h3>Gravação de Video CD (VCD/SVCD)</h3>
   4.102 -<p>
   4.103 -Você encontra esta opção na terceira aba. Somente a gravação de vídeos
   4.104 -no formato mpg são suportados diretamente: MPEG-1 para VCD e MPEG-2
   4.105 -para SVCD e DVD. Arquivos AVI, MOV, FLV e WMV são automaticamente 
   4.106 -convertidos para mpg compatível com VCD/SVCD/DVD.
   4.107 -</p>
   4.108 -<ul>
   4.109 -	<li>Selecione "data-cd" em "Burn Type"</li>
   4.110 -	<li>Especifique "file/folder" ou <code>Browse</code></li>
   4.111 -	<li>Clique em <code>Add</code> para decodificar AVI, FLV, MOV, WVM em MPG</li>
   4.112 -	<li>Clique em <code>Burn Disc</code></li>
   4.113 -</ul>
   4.114 -
   4.115 -<h3>Problemas comuns</h3>
   4.116 -<ul>
   4.117 -	<li>O Burnbox funciona com o usuário root mas não com um usuário comum:
   4.118 -        isto ocorre quando o usuário não se encontra no grupo "cdrom".
   4.119 -        Para resolver execute <code>addgroup usuário cdrom</code></li>
   4.120 -	<li>Mensagens "cdrom not readable / writable": Certifique-se de que
   4.121 -        o usuário possui as permissões necessárias e está no grupo "cdrom"</li>	
   4.122 -	<li>Gravação de áudio MP3 não funciona: verifique se o pacote 
   4.123 -        <em>mpg123</em> está instalado</li>
   4.124 -	<li>Opção VCD não funciona: verifique se o pacote <em>vcdimager</em>
   4.125 -        está instalado</li>
   4.126 -	<li>Arquivos AVI, FLV, WMV não são convertidos para MPG: verifique se
   4.127 -        o pacote <em>ffmpeg</em> está instalado</li>
   4.128 -	<li>Gravação de DVD não funciona: Verifique se o pacote <em>dvd+rw-tools</em>
   4.129 -        está instalado</li>
   4.130 -</ul>
   4.131 -
   4.132 -<!-- End content -->
   4.133 -</div>
   4.134 -
   4.135 -</body>
   4.136 -</html>
     5.1 --- a/lib/libmountbox	Sat Apr 28 20:13:13 2012 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,675 +0,0 @@
     5.4 -#!/bin/sh
     5.5 -#
     5.6 -# Libmountbox provides devices list in suitable format for GTK tree
     5.7 -# and various dialog boxes to mount, umount, etc.
     5.8 -#
     5.9 -# (C) 2009 - SliTaz GNU/Linux project.
    5.10 -#
    5.11 -
    5.12 -# Short usage.
    5.13 -usage()
    5.14 -{
    5.15 -	echo -e "\nUsage: $0 command\n
    5.16 -Output commands:
    5.17 -  list-mounted      List all mounted devices in a suitable GTK tree format.
    5.18 -  list-umounted     List all umounted in a suitable GTK tree format.
    5.19 -  create-file       Create an empty file with predefined size.
    5.20 -  add-old-crypto    Create loop-eas device.
    5.21 -  remove-crypto     Delete a crypto device.
    5.22 -  
    5.23 -GTKdialog boxes
    5.24 -  mounted-fs-infos  Display mounted devices info with actions.
    5.25 -  umounted-fs-infos Display umounted devices info with actions.
    5.26 -  remove-loop       Confirmation box.
    5.27 -  new-file          Parameter box for file creation.
    5.28 -  cryptomgr         Manage crypto device with devmapper.
    5.29 -  add-crypto        Pass phrase dialog.\n"
    5.30 -}
    5.31 -
    5.32 -# Format df -h output for GTK tree.
    5.33 -mounted_fs_data()
    5.34 -{
    5.35 -	SIZE=`echo $RES | cut -d " " -f 2`
    5.36 -	USED=`echo $RES | cut -d " " -f 3`
    5.37 -	AVAILABLE=`echo $RES | cut -d " " -f 4`
    5.38 -	PCT=`echo $RES | cut -d " " -f 5`
    5.39 -	MOUNTED_ON=`echo $RES | cut -d " " -f 6`
    5.40 -}
    5.41 -
    5.42 -# Update BLOCKS SIZE UUID TYPE LABEL variables
    5.43 -getdevinfo()
    5.44 -{
    5.45 -	local dev
    5.46 -	dev=${1#/dev/}
    5.47 -	BLOCKS=0
    5.48 -	if [ -f /sys/block/$dev/size ]; then
    5.49 -		BLOCKS=`cat /sys/block/$dev/size`
    5.50 -	elif [ -f /sys/block/*/$dev/size ]; then
    5.51 -		BLOCKS=`cat /sys/block/*/$dev/size`
    5.52 -	fi
    5.53 -	if [ $BLOCKS -gt 2097152 ]; then
    5.54 -		unit=G
    5.55 -		n=$(($BLOCKS * 10 / 2097152))
    5.56 -	elif [ $BLOCKS -gt 2048 ]; then
    5.57 -		unit=M
    5.58 -		n=$(($BLOCKS * 10 / 2048))
    5.59 -	else
    5.60 -		unit=K
    5.61 -		n=$(($BLOCKS * 5))
    5.62 -	fi
    5.63 -	SIZE=$(($n/10)).$(($n%10))$unit
    5.64 -	UUID=`blkid | grep ^/dev/$dev: | grep UUID= | sed 's/.*UUID=\"\([^\"]*\)\".*/\1/'`
    5.65 -	TYPE=`blkid | grep ^/dev/$dev: | grep TYPE= | sed 's/.*TYPE=\"\([^\"]*\)\".*/\1/'`
    5.66 -	LABEL=`blkid | grep ^/dev/$dev: | grep LABEL= | sed 's/.*LABEL=\"\([^\"]*\)\".*/\1/'`
    5.67 -}
    5.68 -
    5.69 -# Generate label for device manager
    5.70 -dmlabel()
    5.71 -{
    5.72 -	echo crypto-$(basename $1)
    5.73 -}
    5.74 -
    5.75 -unwrap()
    5.76 -{
    5.77 -awk '{
    5.78 -  if ($2 == "") last=$1;
    5.79 -  else {
    5.80 -    print last $0
    5.81 -    last=""
    5.82 -  }
    5.83 -}'
    5.84 -}
    5.85 -
    5.86 -case $1 in
    5.87 -	list-mounted)
    5.88 -		# List all fs found by: df -h
    5.89 -		#
    5.90 -		for dev in `df -h | grep ^/dev/ | cut -d " " -f 1`
    5.91 -		do
    5.92 -			RO='read-only'
    5.93 -			mount | grep $dev | grep -q '(rw' && RO=''
    5.94 -			RES=`df -h $dev | unwrap | grep ^$dev`
    5.95 -			mounted_fs_data
    5.96 -			echo "$dev | $SIZE | $USED | $AVAILABLE | $PCT | $MOUNTED_ON | $RO"
    5.97 -		done ;;
    5.98 -	list-umounted)
    5.99 -		# List all umounted fs found by: fdisk -l
   5.100 -		#
   5.101 -		for dev in `fdisk -l | grep ^/dev | cut -d " " -f 1`
   5.102 -		do
   5.103 -			RES=`fdisk -l | grep $dev | sed s/*//g`
   5.104 -			START=`echo $RES | cut -d " " -f 2`
   5.105 -			END=`echo $RES | cut -d " " -f 3`
   5.106 -			BLOCKS=`echo $RES | cut -d " " -f 4`
   5.107 -			ID=`echo $RES | cut -d " " -f 5`
   5.108 -			SYSTEM=`echo $RES | cut -d " " -f 6-`
   5.109 -			# Bootable...
   5.110 -			if fdisk -l | grep $dev | grep -q "*"; then
   5.111 -				BOOT="yes"
   5.112 -			else
   5.113 -				BOOT="-"
   5.114 -			fi
   5.115 -			# Skip swap, extended, and mounted partitions.
   5.116 -			if echo $RES | grep -q "swap" || echo $RES | grep -q "Extended" ; then
   5.117 -				continue
   5.118 -			elif mount | grep -q "^$dev "; then
   5.119 -				continue
   5.120 -			else
   5.121 -				getdevinfo $dev
   5.122 -				echo "$dev | $SIZE | $SYSTEM | $TYPE | $LABEL | $BOOT | $START | $END | $BLOCKS | $ID | $UUID"
   5.123 -			fi
   5.124 -		done
   5.125 -		for dev in /dev/mapper/* ; do
   5.126 -			[ -b $dev ] || continue
   5.127 -			mount | grep -q "^$dev " && continue
   5.128 -			mdev=dm-$(ls -l $dev | awk '{ print $6 }')
   5.129 -			mount | grep -q "^/dev/$mdev " && continue
   5.130 -			getdevinfo /dev/$mdev
   5.131 -			echo "$dev | $SIZE | - | $TYPE | $LABEL | - | - | - | $BLOCKS | - | $UUID"
   5.132 -		done
   5.133 -		for dev in $(losetup | cut -d: -f1); do
   5.134 -			[ -b $dev ] || continue
   5.135 -			mount | grep -q "^$dev " && continue
   5.136 -			getdevinfo $dev
   5.137 -			echo "$dev | $SIZE | - | $TYPE | $LABEL | - | - | - | $BLOCKS | - | $UUID"
   5.138 -		done
   5.139 -		[ -e /dev/cdrom ] &&
   5.140 -		echo "/dev/cdrom | - | CD/DVD | iso9660 | - | - | - | - | - | - | -"
   5.141 -		for i in /sys/devices/platform/floppy.*/block:*; do 
   5.142 -			[ -e $i ] && echo "/dev/${i#*block:} | - | - | - | floppy | - | - | - | - | -"
   5.143 -		done
   5.144 -		;;
   5.145 -	mounted-fs-infos)
   5.146 -		# Mounted fs info and actions, rootfs or other fs.
   5.147 -		#
   5.148 -		if [ "$MOUNTED" == "/dev/root" ]; then
   5.149 -			export MOUNTED_DEVICE="
   5.150 -<window title=\"Device: rootfs\" icon-name=\"media-flash\">
   5.151 -<vbox>
   5.152 -	<text use-markup=\"true\" width-chars=\"56\">
   5.153 -		<label>\"
   5.154 -<b>/dev/root</b>
   5.155 -\"
   5.156 -		</label>
   5.157 -	</text>
   5.158 -	<text use-markup=\"true\" width-chars=\"56\">
   5.159 -		<input>df -h / | grep ^rootfs</input>
   5.160 -	</text>
   5.161 -	<hbox>
   5.162 -		<button>
   5.163 -			<label>Browse</label>
   5.164 -			<input file icon=\"folder-open\"></input>
   5.165 -			<action>pcmanfm / &</action>
   5.166 -			<action type=\"closewindow\">MOUNTED_DEVICE</action>
   5.167 -		</button>
   5.168 -		<button>
   5.169 -			<input file icon=\"gtk-close\"></input>
   5.170 -			<action type=\"closewindow\">MOUNTED_DEVICE</action>
   5.171 -		</button>
   5.172 -	</hbox>
   5.173 -</vbox>
   5.174 -</window>"
   5.175 -		gtkdialog --center --program=MOUNTED_DEVICE
   5.176 -		else
   5.177 -			getdevinfo $MOUNTED
   5.178 -			RES=`df -h $MOUNTED | grep ^$MOUNTED`
   5.179 -			mounted_fs_data
   5.180 -			export MOUNTED_DEVICE="
   5.181 -<window title=\"Device: $MOUNTED\" icon-name=\"media-flash\">
   5.182 -<vbox>
   5.183 -	<text use-markup=\"true\" width-chars=\"56\">
   5.184 -		<label>\"
   5.185 -Device <b>$MOUNTED</b> is mounted on <b>$MOUNTED_ON</b>
   5.186 -
   5.187 -Size: $SIZE
   5.188 -UUID: $UUID
   5.189 -Type: $TYPE
   5.190 -Label: $LABEL
   5.191 -\"
   5.192 -		</label>
   5.193 -	</text>
   5.194 -	<hbox>
   5.195 -		<button>
   5.196 -			<label>Browse</label>
   5.197 -			<input file icon=\"folder-open\"></input>
   5.198 -			<action>pcmanfm $MOUNTED_ON &</action>
   5.199 -			<action type=\"closewindow\">MOUNTED_DEVICE</action>
   5.200 -		</button>"
   5.201 -if mount | grep $MOUNTED_ON | grep -q '(rw'; then
   5.202 -	MOUNTED_DEVICE="$MOUNTED_DEVICE
   5.203 -		<button>
   5.204 -			<label>Remount read-only</label>
   5.205 -			<input file icon=\"redo\"></input>
   5.206 -			<action>mount -o remount,ro $MOUNTED_ON</action>
   5.207 -			<action type=\"closewindow\">MOUNTED_DEVICE</action>
   5.208 -		</button>"
   5.209 -else
   5.210 -	MOUNTED_DEVICE="$MOUNTED_DEVICE
   5.211 -		<button>
   5.212 -			<label>Remount read-write</label>
   5.213 -			<input file icon=\"redo\"></input>
   5.214 -			<action>mount -o remount,rw $MOUNTED_ON</action>
   5.215 -			<action type=\"closewindow\">MOUNTED_DEVICE</action>
   5.216 -		</button>"
   5.217 -fi
   5.218 -MOUNTED_DEVICE="$MOUNTED_DEVICE
   5.219 -		<button>
   5.220 -			<label>Umount</label>
   5.221 -			<input file icon=\"undo\"></input>
   5.222 -			<action>umount $MOUNTED_ON</action>
   5.223 -			<action type=\"closewindow\">MOUNTED_DEVICE</action>
   5.224 -		</button>
   5.225 -		<button>
   5.226 -			<input file icon=\"gtk-close\"></input>
   5.227 -			<action type=\"closewindow\">MOUNTED_DEVICE</action>
   5.228 -		</button>
   5.229 -	</hbox>
   5.230 -</vbox>
   5.231 -</window>"
   5.232 -		gtkdialog --center --program=MOUNTED_DEVICE
   5.233 -		fi ;;
   5.234 -	umounted-fs-infos)
   5.235 -		# Mounted fs info and actions, rootfs or other fs.
   5.236 -		#
   5.237 -		case "$DEVICE" in
   5.238 -		/dev/mapper/*) mdev=/dev/dm-$(ls -l $DEVICE | awk '{ print $6 }');;
   5.239 -		*) mdev=$DEVICE;;
   5.240 -		esac
   5.241 -		getdevinfo $mdev
   5.242 -		export UMOUNTED_DEVICE="
   5.243 -<window title=\"Device: $DEVICE\" icon-name=\"media-flash\">
   5.244 -<vbox>
   5.245 -	<text use-markup=\"true\" width-chars=\"56\">
   5.246 -		<label>\"
   5.247 -Mount <b>$DEVICE</b> on <b>$MOUNT_POINT</b>
   5.248 -
   5.249 -Size: $SIZE
   5.250 -UUID: $UUID
   5.251 -Type: $TYPE
   5.252 -Label: $LABEL
   5.253 -\"
   5.254 -		</label>
   5.255 -	</text>
   5.256 -	
   5.257 -	<hbox>
   5.258 -		<button>
   5.259 -			<label>Mount read-only</label>
   5.260 -			<input file icon=\"edit-redo\"></input>
   5.261 -			<action>mkdir -p $MOUNT_POINT</action>
   5.262 -			<action>mount -r $DEVICE $MOUNT_POINT</action>
   5.263 -			<action type=\"closewindow\">MOUNTED_DEVICE</action>
   5.264 -		</button>
   5.265 -		<button>
   5.266 -			<label>Mount read-write</label>
   5.267 -			<input file icon=\"edit-redo\"></input>
   5.268 -			<action>mkdir -p $MOUNT_POINT</action>
   5.269 -			<action>mount $DEVICE $MOUNT_POINT</action>
   5.270 -			<action type=\"closewindow\">MOUNTED_DEVICE</action>
   5.271 -		</button>"
   5.272 -while read type fsck args; do
   5.273 -	[ "$TYPE" == "$type" ] || continue
   5.274 -	which $fsck > /dev/null || continue
   5.275 -UMOUNTED_DEVICE="$UMOUNTED_DEVICE		
   5.276 -		<button>
   5.277 -			<label>$fsck check</label>
   5.278 -			<input file icon=\"drive-harddisk\"></input>
   5.279 -			<action>xterm -T \"$fsck $args $DEVICE\" \
   5.280 -				-geometry 80x12 \
   5.281 -				-e \"echo; $fsck $args $DEVICE; \
   5.282 -				echo -e '----\\nENTER to close Terminal'; \
   5.283 -				read i\" &</action>
   5.284 -			<action type=\"closewindow\">MOUNTED_DEVICE</action>
   5.285 -		</button>"
   5.286 -done <<EOT
   5.287 -ext3 e2fsck -p
   5.288 -ext2 e2fsck -p
   5.289 -vfat dosfsck -a
   5.290 -msdos dosfsck -a
   5.291 -xfs fsck.xfs -s
   5.292 -reiserfs reiserfsck --fix-fixable
   5.293 -jfs jfs_fsck -a
   5.294 -EOT
   5.295 -UMOUNTED_DEVICE="$UMOUNTED_DEVICE		
   5.296 -		<button>
   5.297 -			<input file icon=\"gtk-close\"></input>
   5.298 -			<action type=\"closewindow\">UMOUNTED_DEVICE</action>
   5.299 -		</button>
   5.300 -	</hbox>
   5.301 -</vbox>
   5.302 -</window>"
   5.303 -		gtkdialog --center --program=UMOUNTED_DEVICE ;;
   5.304 -	loopmgr)
   5.305 -		export LOOP_MANAGER="
   5.306 -<window title=\"Loop manager\" icon-name=\"media-flash\">
   5.307 -<vbox>
   5.308 -	<tree>
   5.309 -		<width>420</width><height>120</height>
   5.310 -		<variable>LOOP_DEV</variable>
   5.311 -		<label>Device|File|Size|Type|Label|Mounted on|Offset|UUID</label>"
   5.312 -		while read dev offset file; do
   5.313 -			DEV=$(echo $dev | cut -d: -f1)
   5.314 -			[ -b "$DEV" ] || continue
   5.315 -			MOUNT=$(mount | grep ^$DEV | awk '{ print $3 }')
   5.316 -			getdevinfo $DEV
   5.317 -			LOOP_MANAGER="$LOOP_MANAGER
   5.318 -		<item>$DEV | $file | $SIZE | $TYPE | $LABEL | $MOUNT | $offset | $UUID</item>
   5.319 -"
   5.320 -		done <<EOT
   5.321 -$(losetup)
   5.322 -EOT
   5.323 -		LOOP_MANAGER="$LOOP_MANAGER
   5.324 -		<action>/usr/lib/slitaz/libmountbox remove-loop</action>
   5.325 -		<action>/usr/lib/slitaz/libmountbox loopmgr &</action>
   5.326 -		<action type=\"closewindow\">LOOP_MANAGER</action>
   5.327 -	</tree>
   5.328 -	<hbox>
   5.329 -		<text use-markup=\"true\">
   5.330 -			<label>\"<b>File</b>\"</label>
   5.331 -		</text>
   5.332 -		<entry accept=\"filename\">
   5.333 -			<variable>FILE</variable>
   5.334 -		</entry>
   5.335 -		<button>
   5.336 -			<input file icon=\"folder-open\"></input>
   5.337 -			<action type=\"fileselect\">FILE</action>
   5.338 -		</button>
   5.339 -	</hbox>
   5.340 -	<hbox>
   5.341 -		<text use-markup=\"true\">
   5.342 -			<label>\"<b>Offset</b>\"</label>
   5.343 -		</text>
   5.344 -		<entry>
   5.345 -			<default>0</default>
   5.346 -			<variable>OFFSET</variable>
   5.347 -		</entry>
   5.348 -		<button>
   5.349 -			<label>Disable</label>
   5.350 -			<input file icon=\"remove\"></input>
   5.351 -			<action>/usr/lib/slitaz/libmountbox remove-loop</action>
   5.352 -			<action>/usr/lib/slitaz/libmountbox loopmgr &</action>
   5.353 -			<action type=\"closewindow\">LOOP_MANAGER</action>
   5.354 -		</button>
   5.355 -		<button>
   5.356 -			<label>Enable</label>
   5.357 -			<input file icon=\"add\"></input>
   5.358 -			<action>losetup -o \$OFFSET \$(losetup -f) \$FILE</action>
   5.359 -			<action>/usr/lib/slitaz/libmountbox loopmgr &</action>
   5.360 -			<action type=\"closewindow\">LOOP_MANAGER</action>
   5.361 -		</button>
   5.362 -		<button>
   5.363 -			<label>Create</label>
   5.364 -			<input file icon=\"filenew\"></input>
   5.365 -			<action>/usr/lib/slitaz/libmountbox new-file</action>
   5.366 -			<action>/usr/lib/slitaz/libmountbox loopmgr &</action>
   5.367 -			<action type=\"closewindow\">LOOP_MANAGER</action>
   5.368 -		</button>
   5.369 -		<button>
   5.370 -			<input file icon=\"gtk-close\"></input>
   5.371 -			<action type=\"closewindow\">LOOP_MANAGER</action>
   5.372 -		</button>
   5.373 -	</hbox>
   5.374 -</vbox>
   5.375 -</window>"
   5.376 -		gtkdialog --center --program=LOOP_MANAGER ;;
   5.377 -	remove-loop)
   5.378 -		getdevinfo $LOOP_DEV
   5.379 -		export REMOVE_DEVICE="
   5.380 -<window title=\"Device: $LOOP_DEV\" icon-name=\"media-flash\">
   5.381 -<vbox>
   5.382 -	<text use-markup=\"true\" width-chars=\"56\">
   5.383 -		<label>\"
   5.384 -Disable <b>$LOOP_DEV</b> ?
   5.385 -
   5.386 -Size: $SIZE
   5.387 -UUID: $UUID
   5.388 -Type: $TYPE
   5.389 -Label: $LABEL
   5.390 -\"
   5.391 -		</label>
   5.392 -	</text>
   5.393 -	<hbox>
   5.394 -		<button yes>
   5.395 -			<action>umount $LOOP_DEV</action>
   5.396 -			<action>losetup -d $LOOP_DEV</action>
   5.397 -			<action type=\"closewindow\">LOOP_MANAGER</action>
   5.398 -			<action>/usr/lib/slitaz/libmountbox loopmgr &</action>
   5.399 -			<action type=\"closewindow\">REMOVE_DEVICE</action>
   5.400 -		</button>
   5.401 -		<button no>
   5.402 -			<action type=\"closewindow\">REMOVE_DEVICE</action>
   5.403 -		</button>
   5.404 -	</hbox>
   5.405 -</vbox>
   5.406 -</window>"
   5.407 -		gtkdialog --center --program=REMOVE_DEVICE ;;
   5.408 -	create-file)
   5.409 -		file=$2
   5.410 -		size=$3
   5.411 -		[ -n "$file" -a -n "$size" ] || exit
   5.412 -		[ "$4" == "true" ] && bs="1K"
   5.413 -		[ "$5" == "true" ] && bs="1M"
   5.414 -		[ "$6" == "true" ] && bs="1024M"
   5.415 -		[ "$8" == "true" ] && dev="/dev/zero count=$size"
   5.416 -		[ "$9" == "true" ] && dev="/dev/urandom count=$size"
   5.417 -		[ "$10" == "true" ] && dev="/dev/zero seek=$size count=0"
   5.418 -		if [ "$7" != "true" -a -e "$file" ]; then
   5.419 -			export FILE_EXIST="
   5.420 -<window title=\"File exist\" icon-name=\"media-flash\">
   5.421 -<vbox>
   5.422 -	<hbox>
   5.423 -		<text use-markup=\"true\">
   5.424 -			<label> \"The file <b>$file</b> already exists\" </label>
   5.425 -		</text>
   5.426 -	</hbox>
   5.427 -	<hbox>
   5.428 -		<button>
   5.429 -			<input file icon=\"gtk-close\"></input>
   5.430 -			<action type=\"closewindow\">FILE_EXIST</action>
   5.431 -		</button>
   5.432 -	</hbox>
   5.433 -</vbox>
   5.434 -</window>"
   5.435 -			gtkdialog --center --program=FILE_EXIST
   5.436 -			exit
   5.437 -		fi
   5.438 -		dd if=$dev of=$file bs=$bs
   5.439 -		;;
   5.440 -	new-file)
   5.441 -		export CREATE_FILE="
   5.442 -<window title=\"Create file\" icon-name=\"media-flash\">
   5.443 -<vbox>
   5.444 -	<hbox>
   5.445 -		<text use-markup=\"true\">
   5.446 -			<label>\"<b>File:</b>\"</label>
   5.447 -		</text>
   5.448 -		<entry>
   5.449 -			<variable>FILE</variable>
   5.450 -$( [ -n "$FILE" ] && echo "<default>$FILE</default>" )
   5.451 -		</entry>
   5.452 -		<button>
   5.453 -			<input file icon=\"folder-open\"></input>
   5.454 -			<action type=\"fileselect\">FILE</action>
   5.455 -		</button>
   5.456 -	</hbox>
   5.457 -	<hbox>
   5.458 -		<text use-markup=\"true\">
   5.459 -			<label>\"<b>Size:</b>\"</label>
   5.460 -		</text>
   5.461 -		<entry>
   5.462 -			<variable>NEW_SIZE</variable>
   5.463 -			<default>0</default>
   5.464 -		</entry>
   5.465 -		<radiobutton>
   5.466 -			<label>Kb</label>
   5.467 -			<variable>KB</variable>
   5.468 -		</radiobutton>
   5.469 -		<radiobutton>
   5.470 -			<label>Mb</label>
   5.471 -			<variable>MB</variable>
   5.472 -		</radiobutton>
   5.473 -		<radiobutton>
   5.474 -			<label>Gb</label>
   5.475 -			<variable>GB</variable>
   5.476 -		</radiobutton>
   5.477 -	</hbox>
   5.478 -	<hbox>
   5.479 -		<text use-markup=\"true\">
   5.480 -			<label>\"<b>Fill</b>\"</label>
   5.481 -		</text>
   5.482 -		<radiobutton>
   5.483 -			<label>random</label>
   5.484 -			<variable>RANDOM</variable>
   5.485 -		</radiobutton>
   5.486 -		<radiobutton>
   5.487 -			<label>zero</label>
   5.488 -			<variable>ZERO</variable>
   5.489 -		</radiobutton>
   5.490 -		<radiobutton>
   5.491 -			<label>sparse</label>
   5.492 -			<variable>SPARSE</variable>
   5.493 -		</radiobutton>
   5.494 -		<checkbox>
   5.495 -			<label>Override</label>
   5.496 -			<variable>OVERRIDE</variable>
   5.497 -			<default>false</default>
   5.498 -		</checkbox>
   5.499 -		<button>
   5.500 -			<label>Create</label>
   5.501 -			<input file icon=\"filenew\"></input>
   5.502 -			<action>/usr/lib/slitaz/libmountbox create-file \"\$FILE\" \"\$NEW_SIZE\" \$KB \$MB \$GB \$OVERRIDE \$ZERO \$RANDOM \$SPARSE</action>
   5.503 -			<action type=\"closewindow\">CREATE_FILE</action>
   5.504 -		</button>
   5.505 -		<button>
   5.506 -			<input file icon=\"gtk-close\"></input>
   5.507 -			<action type=\"closewindow\">CREATE_FILE</action>
   5.508 -		</button>
   5.509 -	</hbox>
   5.510 -</vbox>
   5.511 -</window>"
   5.512 -		gtkdialog --center --program=CREATE_FILE ;;
   5.513 -	cryptomgr)
   5.514 -		missing=""
   5.515 -		for i in libdevmapper dmsetup linux-md hashalot cryptsetup ; do
   5.516 -			[ -d /var/lib/tazpkg/installed/$i ] || missing="$missing $i"
   5.517 -		done
   5.518 -		if [ -n "$missing" ]; then
   5.519 -			export CRYPTO_MANAGER="
   5.520 -<window title=\"Crypto manager\" icon-name=\"media-flash\">
   5.521 -<vbox>
   5.522 -	<hbox>
   5.523 -		<text use-markup=\"true\">
   5.524 -		<label>\"
   5.525 -<b>Packages needed :</b>
   5.526 -
   5.527 -$(for i in $missing ; do echo $i; done)
   5.528 -\" </label>
   5.529 -		</text>
   5.530 -	</hbox>
   5.531 -	<hbox>
   5.532 -		<button>
   5.533 -			<label>Install</label>
   5.534 -			<input file icon=\"go-jump\"></input>
   5.535 -			<action>xterm -T \"Install packages\" \
   5.536 -			-geometry 80x16+120+120 -e \"for i in $missing ; do \
   5.537 -			yes y | tazpkg get-install \\\$i ; done; sleep 2\" \
   5.538 -			</action>
   5.539 -			<action>/usr/lib/slitaz/libmountbox cryptomgr &</action>
   5.540 -			<action type=\"closewindow\">CRYPTO_MANAGER</action>
   5.541 -		</button>
   5.542 -		<button>
   5.543 -			<input file icon=\"gtk-close\"></input>
   5.544 -			<action type=\"closewindow\">CRYPTO_MANAGER</action>
   5.545 -		</button>
   5.546 -	</hbox>
   5.547 -</vbox>
   5.548 -</window>"
   5.549 -			gtkdialog --center --program=CRYPTO_MANAGER
   5.550 -			exit
   5.551 -		fi
   5.552 -		for i in dm-mod dm-crypt aes-i586 ; do
   5.553 -			lsmod | grep -q $i || modprobe $i
   5.554 -		done
   5.555 -		export CRYPTO_MANAGER="
   5.556 -<window title=\"Crypto manager\" icon-name=\"media-flash\">
   5.557 -<vbox>
   5.558 -	<tree>
   5.559 -		<width>420</width><height>120</height>
   5.560 -		<variable>CRYTO_DEV</variable>
   5.561 -		<label>Name|Device|Size|Type|Label|Mounted on|UUID</label>"
   5.562 -		while read name ; do
   5.563 -			[ -b /dev/mapper/$name ] || continue
   5.564 -			DEV=/dev/dm-$(ls -l /dev/mapper/$name | awk '{ print $6 }')
   5.565 -			MOUNT=$(mount | egrep "^$DEV|/dev/mapper/$name" | awk '{ print $3 }')
   5.566 -			getdevinfo $DEV
   5.567 -			case "$name" in 
   5.568 -			*crypto*) item="item icon=\"passwd\"";;
   5.569 -			*)        item="item icon=\"drive-harddisk\"";;
   5.570 -			esac
   5.571 -			CRYPTO_MANAGER="$CRYPTO_MANAGER
   5.572 -		<$item>$name|$DEV | $SIZE | $TYPE | $LABEL | $MOUNT | $UUID</item>
   5.573 -"
   5.574 -		done <<EOT
   5.575 -$(ls /dev/mapper 2> /dev/null)
   5.576 -EOT
   5.577 -		CRYPTO_MANAGER="$CRYPTO_MANAGER
   5.578 -	</tree>
   5.579 -	<hbox>
   5.580 -		<text use-markup=\"true\">
   5.581 -			<label>\"<b>Device :</b>\"</label>
   5.582 -		</text>
   5.583 -		<combobox>
   5.584 -			<label>Device</label>
   5.585 -$( (losetup ; blkid | grep -v /dev/loop ) | cut -d: -f1 | awk '{ printf "<item>%s</item>\n",$1}')
   5.586 -			<variable>DEVICE</variable>
   5.587 -		</combobox>
   5.588 -		<text use-markup=\"true\">
   5.589 -			<label>\"<b>Cipher :</b>\"</label>
   5.590 -		</text>
   5.591 -		<combobox>
   5.592 -			<variable>CRYPTO</variable>
   5.593 -			<item>aes-256</item>
   5.594 -			<item>aes-192</item>
   5.595 -			<item>aes-128</item>
   5.596 -		</combobox>
   5.597 -	</hbox>
   5.598 -	<hbox>
   5.599 -		<button>
   5.600 -			<label>Remove</label>
   5.601 -			<input file icon=\"remove\"></input>
   5.602 -			<action>/usr/lib/slitaz/libmountbox remove-crypto</action>
   5.603 -			<action>/usr/lib/slitaz/libmountbox cryptomgr &</action>
   5.604 -			<action type=\"closewindow\">CRYPTO_MANAGER</action>
   5.605 -		</button>
   5.606 -		<button>
   5.607 -			<label>Create</label>
   5.608 -			<input file icon=\"add\"></input>
   5.609 -			<action>/usr/lib/slitaz/libmountbox add-crypto</action>
   5.610 -			<action>/usr/lib/slitaz/libmountbox cryptomgr &</action>
   5.611 -			<action type=\"closewindow\">CRYPTO_MANAGER</action>
   5.612 -		</button>
   5.613 -		<button>
   5.614 -			<label>Format</label>
   5.615 -			<input file icon=\"gtk-clear\"></input>
   5.616 -			<action>/usr/lib/slitaz/libmountbox format-crypto</action>
   5.617 -			<action>xterm -T \"Format LUKS\" \
   5.618 -			-geometry 80x16+120+120 -e \"\
   5.619 -			cryptsetup luksFormat -c aes -h sha\${CRYPTO#aes-} \$DEVICE \" \
   5.620 -			</action>
   5.621 -			<action>/usr/lib/slitaz/libmountbox cryptomgr &</action>
   5.622 -			<action type=\"closewindow\">CRYPTO_MANAGER</action>
   5.623 -		</button>
   5.624 -		<button>
   5.625 -			<input file icon=\"gtk-close\"></input>
   5.626 -			<action type=\"closewindow\">CRYPTO_MANAGER</action>
   5.627 -		</button>
   5.628 -	</hbox>
   5.629 -</vbox>
   5.630 -</window>"
   5.631 -		gtkdialog --center --program=CRYPTO_MANAGER ;;
   5.632 -	add-old-crypto)
   5.633 -		# Not luks format
   5.634 -		# Try old loop-eas
   5.635 -		case "$CRYPTO" in
   5.636 -		*128)	key="16 sha256";;
   5.637 -		*192)	key="24 sha384";;
   5.638 -		*)	key="32 sha512";;
   5.639 -		esac
   5.640 -		getdevinfo $DEVICE
   5.641 -		key=$(echo $PASS_PHRASE | hashalot -x -n $key)
   5.642 -		echo 0 $BLOCKS crypt aes-plain $key 0 $DEVICE 0 | \
   5.643 -				dmsetup create $(dmlabel $DEVICE)
   5.644 -		;;
   5.645 -	add-crypto)
   5.646 -		if cryptsetup isLuks $DEVICE 2> /dev/null; then
   5.647 -			xterm -T "Open LUKS" -e \
   5.648 -			  "cryptsetup luksOpen $DEVICE $(dmlabel $DEVICE)"
   5.649 -		else
   5.650 -			export GET_PASS_PHRASE="
   5.651 -<window title=\"Crypto manager\" icon-name=\"media-flash\">
   5.652 -<vbox>
   5.653 -	<hbox>
   5.654 -		<text use-markup=\"true\">
   5.655 -			<label>\"<b>Pass phrase :</b>\"</label>
   5.656 -		</text>
   5.657 -		<entry>
   5.658 -			<variable>PASS_PHRASE</variable>
   5.659 -		</entry>
   5.660 -		<button ok>
   5.661 -			<action>/usr/lib/slitaz/libmountbox add-old-crypto</action>
   5.662 -			<action type=\"closewindow\">GET_PASS_PHRASE</action>
   5.663 -		</button>
   5.664 -	</hbox>
   5.665 -</vbox>
   5.666 -</window>"
   5.667 -			gtkdialog --center --program=GET_PASS_PHRASE
   5.668 -		fi
   5.669 -		;;
   5.670 -	remove-crypto)
   5.671 -		cryptsetup luksClose $CRYTO_DEV
   5.672 -		[ -e /dev/mapper/$CRYTO_DEV ] && dmsetup remove $CRYTO_DEV
   5.673 -		;;
   5.674 -	*)
   5.675 -		usage ;;
   5.676 -esac
   5.677 -
   5.678 -exit 0
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/oldstuff/gtkdialog/bootfloppybox	Sat Apr 28 20:16:24 2012 +0200
     6.3 @@ -0,0 +1,1477 @@
     6.4 +#! /bin/sh
     6.5 +# 
     6.6 +# Gtkdialog box for the mount command. Part of SliTaz tools.
     6.7 +#
     6.8 +VERSION=20120412
     6.9 +
    6.10 +# Check if user is root.
    6.11 +check_root()
    6.12 +{
    6.13 +	if test $(id -u) != 0 ; then
    6.14 +		echo -e "
    6.15 +You must be root to run `basename $0`. Please type 'su' and 
    6.16 +root password to become super-user.\n"
    6.17 +		exit 0
    6.18 +	fi
    6.19 +}
    6.20 +
    6.21 +# This function is used after each screen to continue or abort install.
    6.22 +check_retval()
    6.23 +{
    6.24 +	case $retval in
    6.25 +		1)
    6.26 +			rm -f /tmp/floppybox.grub.menu
    6.27 +			echo -e "\nVoluntary exit.\n" && exit 0 ;;
    6.28 +		255)
    6.29 +			rm -f /tmp/floppybox.grub.menu
    6.30 +			echo -e "ESC pressed.\n" && exit 0 ;;
    6.31 +	esac
    6.32 +}
    6.33 +
    6.34 +# Trigger floppy driver to update /sys/devices/platform/
    6.35 +dd if=/dev/fd0 bs=1k count=1 > /dev/null 2>&1
    6.36 +
    6.37 +# check or list floppy devices.
    6.38 +list_floppy()
    6.39 +{
    6.40 +	local list
    6.41 +	list=""
    6.42 +	for i in /sys/devices/platform/floppy.*/block/*; do
    6.43 +		[ -d $i ] || continue
    6.44 +		list="$list $(basename $i)"
    6.45 +	done
    6.46 +	[ -n "$1" ] || echo $list
    6.47 +	[ -n "$list" ]
    6.48 +}
    6.49 +
    6.50 +# dialog to select the floppy device
    6.51 +select_floppy()
    6.52 +{
    6.53 +	DEVICE="$DIALOG --title \" Floppy device \" --backtitle \"Boot Floppy Creation\" --clear --extra-button --extra-label \"Format\" --colors --radiolist \"
    6.54 +Select boot device
    6.55 +\" 18 70 50"
    6.56 +	on=on
    6.57 +	for i in $(list_floppy); do
    6.58 +		DEVICE="$DEVICE /dev/$i 'Floppy in $i' $on"
    6.59 +		on=off
    6.60 +	done
    6.61 +	DEVICE="$DEVICE floppy \"floppy image file boot.fd\" $on"
    6.62 +	DEVICE="$DEVICE cdrom \"cdrom image file boot.iso\" off 2>&1 1>&3"
    6.63 +	exec 3>&1
    6.64 +	DEVICE=`eval $DEVICE`
    6.65 +	retval=$?
    6.66 +	exec 3>&-
    6.67 +	check_retval
    6.68 +	if [ "$retval" = "3" ]; then
    6.69 +		case "$DEVICE" in
    6.70 +		/dev/*) fdformat -n $DEVICE;;
    6.71 +		esac
    6.72 +    	fi
    6.73 +}
    6.74 +
    6.75 +# Build menu for grub or grub4dos
    6.76 +mkmenu()
    6.77 +{
    6.78 +if [ "$1" = "grub4dos" ]; then
    6.79 +	SAVEDEFAULT="save default"
    6.80 +	cat > /tmp/floppybox.grub.menu <<EOT
    6.81 +# grub4dos menu
    6.82 +default /default
    6.83 +EOT
    6.84 +else
    6.85 +	SAVEDEFAULT="savedefault"
    6.86 +	cat > /tmp/floppybox.grub.menu <<EOT
    6.87 +# grub menu
    6.88 +default saved
    6.89 +EOT
    6.90 +fi
    6.91 +cat >> /tmp/floppybox.grub.menu <<EOT
    6.92 +timeout 8
    6.93 +color yellow/brown light-green/black
    6.94 +
    6.95 +EOT
    6.96 +entry=0
    6.97 +[ -f /boot/gpxe ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
    6.98 +title gPXE (Boot from the Web, PXE/iSCSI/AoE support)
    6.99 +	kernel /boot/gpxe $(dd if=/boot/gpxe bs=1 skip=519 count=255 2>/dev/null | strings)
   6.100 +
   6.101 +EOT
   6.102 +[ -f /usr/share/boot/btmgr -a -f /usr/share/boot/memdisk.lzma ] \
   6.103 +	&& entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
   6.104 +title Smart Boot Manager (text - boot floppy, hard disk or CD/DVD)
   6.105 +	kernel /boot/memdisk floppy c=80 h=2 s=18
   6.106 +	initrd /boot/btmgr.gz
   6.107 +
   6.108 +EOT
   6.109 +http://mirror.slitaz.org/boot/plpbt.bin
   6.110 +[ -f /usr/share/boot/plpbt.bin ] \
   6.111 +	&& entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
   6.112 +title Plop Boot Manager (graphic - boot floppy, hard disk, CD/DVD or USB)
   6.113 +	kernel /boot/plpbt.bin
   6.114 +
   6.115 +EOT
   6.116 +[ -f /usr/share/boot/etherboot ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
   6.117 +title Etherboot (LAN boot, PXE or NBI)
   6.118 +	kernel /boot/etherboot
   6.119 +
   6.120 +EOT
   6.121 +[ -f /usr/share/boot/memtest.lzma -a -f /usr/share/boot/memdisk.lzma ] \
   6.122 +&& entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
   6.123 +title Memtest86+ (Test system memory)
   6.124 +	kernel /boot/memdisk floppy c=80 h=2 s=18
   6.125 +	initrd /boot/memtest.gz
   6.126 +
   6.127 +EOT
   6.128 +[ "$1" = "grub4dos" ] && entry=$(($entry + 3)) && cat >> /tmp/floppybox.grub.menu <<EOT
   6.129 +title Windows (scan ntldr)
   6.130 +	fallback $(($entry -3 + 1))
   6.131 +        find --set-root /ntldr
   6.132 +	chainloader /ntldr
   6.133 +	$SAVEDEFAULT --wait=2
   6.134 +
   6.135 +title Windows (scan cmldr)
   6.136 +	fallback $(($entry -3 + 2))
   6.137 +        find --set-root /cmldr
   6.138 +        chainloader /cmldr
   6.139 +	$SAVEDEFAULT --wait=2
   6.140 +
   6.141 +title Windows (scan io.sys)
   6.142 +	fallback $(($entry -3 + 3))
   6.143 +        find --set-root /io.sys
   6.144 +        chainloader /io.sys
   6.145 +	$SAVEDEFAULT --wait=2
   6.146 +
   6.147 +EOT
   6.148 +entry=$(($entry + 3)) && cat >> /tmp/floppybox.grub.menu <<EOT
   6.149 +title Windows (example on /dev/hda1)
   6.150 +	rootnoverify (hd0,0)
   6.151 +	chainloader +1
   6.152 +	$SAVEDEFAULT
   6.153 +
   6.154 +title Slitaz Frugal (example on /dev/hda1)
   6.155 +	root (hd0,0)
   6.156 +	kernel /boot/bzImage rw root=/dev/null vga=normal
   6.157 +	initrd /boot/rootfs.gz
   6.158 +	$SAVEDEFAULT
   6.159 +
   6.160 +title Slitaz Installed (example on /dev/hda2)
   6.161 +	root (hd0,1)
   6.162 +	kernel /boot/bzImage ro root=/dev/hda2 vga=normal
   6.163 +	$SAVEDEFAULT
   6.164 +
   6.165 +EOT
   6.166 +[ "$1" = "grub4dos" ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
   6.167 +title Slitaz cdrom image (example on /dev/hda1, DEFRAGMENTED)
   6.168 +        map (hd0,0)/boot/slitaz-cooking.iso (hd1)
   6.169 +        map --hook
   6.170 +        kernel (hd1)/boot/bzImage rw root=/dev/null vga=normal
   6.171 +        initrd (hd1)/boot/rootfs.gz
   6.172 +	$SAVEDEFAULT
   6.173 +
   6.174 +EOT
   6.175 +false && [ -f /usr/share/boot/grub.exe.lzma ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
   6.176 +title Grub4Dos
   6.177 +	kernel /boot/grub/grub.exe --config-file="configfile (fd0)/boot/grub/menu4dos.lst"
   6.178 +
   6.179 +EOT
   6.180 +}
   6.181 +
   6.182 +# Install grub or grub4dos on floppy
   6.183 +install_grub()
   6.184 +{
   6.185 +	LOOP=""
   6.186 +	GRUB_DEV=${DEVICE#/dev/}
   6.187 +	GRUB_DEV=${GRUB_DEV%% *}
   6.188 +	case "$DEVICE" in
   6.189 +	floppy*)
   6.190 +		LOOP="-o loop"
   6.191 +		GRUB_DEV=fd0
   6.192 +		DEVICE=boot.fd
   6.193 +		dd if=/dev/zero of=$DEVICE bs=18k count=80;;
   6.194 +	esac
   6.195 +	grep -qs "^# $2 menu" /tmp/floppybox.grub.menu || mkmenu $2
   6.196 +	case "$DEVICE" in
   6.197 +	/dev/*|boot.fd)
   6.198 +		yes y | mke2fs $DEVICE
   6.199 +		mkdir /media/floppy
   6.200 +		mount $LOOP $DEVICE /media/floppy
   6.201 +		if [ "$2" = "grub4dos" ]; then
   6.202 +			mkdir -p /media/floppy/boot
   6.203 +			unlzma -c /usr/share/boot/grldr.lzma > /media/floppy/grldr
   6.204 +			cp $1/boot/* /media/floppy/boot 2> /dev/null
   6.205 +			cp /tmp/floppybox.grub.menu /media/floppy/menu.lst
   6.206 +			umount -d /media/floppy
   6.207 +			bootlace --floppy --sectors-per-track=18 --heads=2 \
   6.208 +				 --chs --ext2 $DEVICE
   6.209 +		else
   6.210 +			mkdir -p /media/floppy/boot/grub
   6.211 +			cp /usr/lib/grub/i386-pc/stage? /media/floppy/boot/grub
   6.212 +			cp -a $1/boot /media/floppy
   6.213 +			cp /tmp/floppybox.grub.menu /media/floppy/boot/grub/menu.lst
   6.214 +			grub-set-default --root-directory=/media/floppy 0
   6.215 +			echo "($GRUB_DEV) $(losetup | grep $DEVICE | cut -d: -f1)" > $1/device.map
   6.216 +			[ -n "$LOOP" ] && LOOP="--device-map=$1/device.map"
   6.217 +			grub $LOOP --batch <<EOT
   6.218 +root ($GRUB_DEV)
   6.219 +setup ($GRUB_DEV)
   6.220 +quit
   6.221 +EOT
   6.222 +			umount -d /media/floppy
   6.223 +		fi ;;
   6.224 +	cdrom*)
   6.225 +		mkdir -p $1/boot/grub 2> /dev/null
   6.226 +		cp /tmp/floppybox.grub.menu $1/boot/grub/menu.lst
   6.227 +		if [ "$2" = "grub4dos" ]; then
   6.228 +			unlzma -c /usr/share/boot/grldr.lzma > $1/boot/grub/grldr
   6.229 +			genisoimage -R -o boot.iso -b boot/grub/grldr \
   6.230 +				-c boot/boot.cat -no-emul-boot -boot-load-seg 0x1000 \
   6.231 +				-hide boot/boot.cat -input-charset iso8859-1 $1
   6.232 +		else
   6.233 +			cp /usr/lib/grub/i386-pc/stage2_eltorito $1/boot/grub
   6.234 +			genisoimage -R -o boot.iso -b boot/grub/stage2_eltorito \
   6.235 +				-c boot/boot.cat -no-emul-boot -boot-load-size 4 \
   6.236 +				-hide boot/boot.cat -input-charset iso8859-1 \
   6.237 +				-boot-info-table $1
   6.238 +		fi ;;
   6.239 +	esac
   6.240 +}
   6.241 +
   6.242 +# Build /init for floppies from iso image
   6.243 +buildinit()
   6.244 +{
   6.245 +	mv $1/init $1/init.org
   6.246 +	for i in /dev/tty0 /dev/[sh]d[ab]? ; do
   6.247 +		[ -e $1$i ] || cp -a $i $1/dev
   6.248 +	done
   6.249 +	cat > $1/init <<EOTEOT
   6.250 +#!/bin/sh
   6.251 +
   6.252 +cat_floppy()
   6.253 +{
   6.254 +	tmp="\$(dd if=/dev/fd0 count=1 2> /dev/null | md5sum)"
   6.255 +	echo -n "Insert floppy \$num for \$name and press Enter or Q to skip"
   6.256 +	while true; do
   6.257 +		echo -n ":"
   6.258 +		read -t 10 answer < /dev/tty0
   6.259 +		case "\$answer" in
   6.260 +		Q*|q*|A*|a*) break 3;;
   6.261 +		esac
   6.262 +		dd if=/dev/fd0 count=1 > /tmp/bs.\$\$ 2> /dev/null
   6.263 +		[ -s /tmp/bs.\$\$ ] || continue
   6.264 +		[ "\$(md5sum < /tmp/bs.\$\$)" != "\$tmp" ] || continue
   6.265 +		rm -f /tmp/bs.\$\$
   6.266 +		break
   6.267 +	done
   6.268 +	dd if=/dev/fd0 of=/tmp/rootfs.\$num 2> /dev/null || continue
   6.269 +	cat /tmp/rootfs.\$num >> \$1
   6.270 +	rm -f /tmp/rootfs.\$num
   6.271 +	num=\$((\$num+1))
   6.272 +}
   6.273 +
   6.274 +mount -t proc proc /proc
   6.275 +total=\$(grep MemTotal /proc/meminfo | sed 's/[^0-9]//g')
   6.276 +# the floppy driver may not be included in kernel
   6.277 +insmod /lib/modules/*/kernel/drivers/block/floppy.ko.gz 2> /dev/null
   6.278 +# loram may put floppy.ko.gz module in /lib
   6.279 +insmod /lib/floppy.ko.gz 2> /dev/null
   6.280 +case "\$(/sbin/blkid 2>&1)" in
   6.281 +*not\ found*)
   6.282 +	cat <<EOT
   6.283 +
   6.284 +You can preinstall SliTaz in an ext3 partition with this floppy set.
   6.285 +
   6.286 +Simply enter the device name (/dev/XXXX) to create the slitaz/install.sh or
   6.287 +leave it blank to skip :
   6.288 +EOT
   6.289 +	read -t 60 device < /dev/tty0
   6.290 +	[ -n "\$device" ] && mount \$device /mnt && mkdir /mnt/slitaz ;;
   6.291 +*TYPE=\"ext*)
   6.292 +	cat <<EOT
   6.293 +
   6.294 +You can preinstall SliTaz in one of these ext3 partitions:
   6.295 +\$(blkid | grep 'TYPE="ext')
   6.296 +
   6.297 +Simply enter the device name (/dev/XXXX) to create the slitaz/install.sh or
   6.298 +leave it blank to skip :
   6.299 +EOT
   6.300 +	read -t 60 device < /dev/tty0
   6.301 +	[ -n "\$device" ] && mount \$device /mnt && mkdir /mnt/slitaz ;;
   6.302 +*)
   6.303 +	cat <<EOT
   6.304 +
   6.305 +You can preinstall SliTaz in an ext3 partition with this floppy set.
   6.306 +After the boot process is completed, create a partition with 'fdisk',
   6.307 +format it with 'mke2fs -j' and reboot from the floppies again.
   6.308 +
   6.309 +EOT
   6.310 +esac
   6.311 +umount /proc
   6.312 +while read name min num count file md5; do
   6.313 +	[ -e \$file ] && continue
   6.314 +	[ \$total -lt \$min ] && break
   6.315 +	while [ \$count -ne 0 ]; do
   6.316 +		cat_floppy /tmp/rootfs
   6.317 +		count=\$((\$count-1))
   6.318 +	done
   6.319 +	echo "\$md5  /tmp/rootfs" | md5sum -c || break
   6.320 +	cpio -idmu < /tmp/rootfs > /dev/null 2>&1 ||
   6.321 +	( zcat /tmp/rootfs 2> /dev/null || unlzma -c /tmp/rootfs ) | cpio -idmu
   6.322 +	if [ -d /mnt/slitaz ]; then
   6.323 +		cp /tmp/rootfs /mnt/slitaz/rootfs.\$num ||
   6.324 +		mv -f /mnt/slitaz /mnt/slitaz-aborted
   6.325 +	fi
   6.326 +	rootfslist="\$rootfslist \$num"
   6.327 +	rm -f /tmp/rootfs*
   6.328 +	mkdir /sbin 2> /dev/null
   6.329 +done <<EOT
   6.330 +$(while read line; do echo $line; done)
   6.331 +EOT
   6.332 +if [ -d /mnt/slitaz ]; then
   6.333 +	cat > /mnt/slitaz/install.sh <<EOT
   6.334 +#!/bin/sh
   6.335 +
   6.336 +if [ -z "\\\$1" ]; then
   6.337 +	echo "Usage: \\\$0 target-directory"
   6.338 +	exit 1
   6.339 +fi
   6.340 +dir=\\\$(cd \\\$(dirname \\\$0); pwd)
   6.341 +cd \\\$1
   6.342 +for i in 0 \$rootfslist ; do
   6.343 +	[ -s \\\$dir/rootfs.\\\$i ] || continue
   6.344 +	cpio -idmu < \\\$dir/rootfs.\\\$i > /dev/null 2>&1 ||
   6.345 +	( zcat \\\$dir/rootfs.\\\$i 2> /dev/null || unlzma -c \\\$dir/rootfs.\\\$i ) | cpio -idmu
   6.346 +done
   6.347 +if ! mv -f init.org init 2> /dev/null; then
   6.348 +	for i in \\\$(ls rootfs*gz | sed '1!G;h;\\\$!d'); do
   6.349 +		mount -o loop,ro \\\$i /media/cdrom && rm -f \\\$i
   6.350 +		cp -a /media/cdrom/. .
   6.351 +		umount -d /media/cdrom
   6.352 +	done
   6.353 +fi
   6.354 +mkdir boot && cp \\\$dir/bzImage boot 
   6.355 +cp -a /usr/lib/grub/i386-pc boot/grub
   6.356 +cat > boot/grub/menu.lst<<EOF
   6.357 +# /boot/grub/menu.lst: GRUB boot loader configuration.
   6.358 +#
   6.359 +
   6.360 +# By default, boot the first entry.
   6.361 +default 0
   6.362 +
   6.363 +# Boot automatically after 8 secs.
   6.364 +timeout 8
   6.365 +
   6.366 +# Change the colors.
   6.367 +color yellow/brown light-green/black
   6.368 +
   6.369 +title	SliTaz GNU/Linux
   6.370 +	kernel /boot/bzImage root=\$device
   6.371 +                
   6.372 +EOF
   6.373 +grub-install --no-floppy --root-directory=\\\$PWD \${device%[1-9]*}
   6.374 +cd -
   6.375 +EOT
   6.376 +	chmod +x /mnt/slitaz/install.sh
   6.377 +	num=1
   6.378 +	name="the Linux kernel"
   6.379 +	dd count=0 of=/mnt/slitaz/bzImage.fd > /dev/null 2>&1
   6.380 +	fullsize=1
   6.381 +	while [ \$(stat -c %s /mnt/slitaz/bzImage.fd) -lt \$fullsize ]; do
   6.382 +		cat_floppy /mnt/slitaz/bzImage.fd
   6.383 +		setup=\$(dd if=/mnt/slitaz/bzImage.fd skip=497 bs=1 count=1 2> /dev/null | hexdump -e '"" 1/1 "%d" "\n"')
   6.384 +		syssize=\$(dd if=/mnt/slitaz/bzImage.fd skip=500 bs=1 count=4 2> /dev/null | hexdump -e '"" 1/4 "%d" "\n"')
   6.385 +		cmdline=\$(dd if=/mnt/slitaz/bzImage.fd skip=552 bs=1 count=4 2> /dev/null | hexdump -e '"" 1/4 "%d" "\n"')
   6.386 +		initrd=\$(dd if=/mnt/slitaz/bzImage.fd skip=540 bs=1 count=4 2> /dev/null | hexdump -e '"" 1/4 "%d" "\n"')
   6.387 +		[ \$cmdline -eq 0 ] || cmdline=512
   6.388 +		size=\$((512 + \$setup * 512 + \$cmdline + \$syssize * 16))
   6.389 +		[ -s /etc/slitaz-release ] || initrd=0
   6.390 +		fullsize=\$((\$size + \$initrd + 512))
   6.391 +		[ \$(stat -c %s /mnt/slitaz/bzImage.fd) -lt \$size ] ||
   6.392 +			name="the first initramfs"
   6.393 +	done
   6.394 +	[ -s /etc/slitaz-release ] &&
   6.395 +	dd if=/mnt/slitaz/bzImage.fd bs=512 skip=\$((\$setup+1+\$cmdline/512+(31+\$syssize)/32)) > /mnt/slitaz/rootfs.0 &&
   6.396 +	dd bs=1 seek=\$initrd count=0 of=/mnt/slitaz/rootfs.0
   6.397 +	dd if=/dev/zero of=/mnt/slitaz/bzImage.fd conv=notrunc bs=1 count=4 seek=552
   6.398 +	dd if=/dev/zero of=/mnt/slitaz/bzImage.fd conv=notrunc bs=1 count=8 seek=536
   6.399 +	dd if=/mnt/slitaz/bzImage.fd bs=512 count=\$((\$setup+1)) > /mnt/slitaz/bzImage
   6.400 +	dd if=/mnt/slitaz/bzImage.fd bs=512 skip=\$((\$setup+1+\$cmdline/512)) >> /mnt/slitaz/bzImage
   6.401 +	rm -f /mnt/slitaz/bzImage.fd
   6.402 +	size=\$((512 + \$setup * 512 + \$syssize * 16))
   6.403 +	dd bs=1 seek=\$size count=0 of=/mnt/slitaz/bzImage > /dev/null 2>&1
   6.404 +	[ \$(stat -c %s /mnt/slitaz/bzImage) -eq \$size ] ||
   6.405 +	mv -f /mnt/slitaz /mnt/slitaz-aborted
   6.406 +fi
   6.407 +[ -d /sbin ] && mv -f /init.org /init && exec /init
   6.408 +exec /bin/ash < /dev/tty0 > /dev/tty0 2>&1
   6.409 +EOTEOT
   6.410 +	chmod +x $1/init
   6.411 +}
   6.412 +
   6.413 +# write a 32 bits data
   6.414 +# usage: storelong offset data32 file
   6.415 +storelong()
   6.416 +{
   6.417 +	printf "00000  %02X %02X %02X %02X \n" \
   6.418 +		$(( $2 & 255 )) $(( ($2>>8) & 255 )) \
   6.419 +		$(( ($2>>16) & 255 )) $(( ($2>>24) & 255 )) | \
   6.420 +	hexdump -R | dd bs=1 conv=notrunc of=$3 seek=$(( $1 )) 2> /dev/null
   6.421 +}
   6.422 +
   6.423 +# read a 32 bits data
   6.424 +# usage: getlong offset file
   6.425 +getlong()
   6.426 +{
   6.427 +	dd if=$2 bs=1 skip=$(( $1 )) count=4 2> /dev/null | \
   6.428 +		hexdump -e '"" 1/4 "%d" "\n"'
   6.429 +}
   6.430 +
   6.431 +# output floppy images set
   6.432 +floppysetcat()
   6.433 +{
   6.434 +	KERNEL="$1"
   6.435 +	INITRD="$2"
   6.436 +	shift 2
   6.437 +	CMDLINE="$@"
   6.438 +
   6.439 +	# bzImage offsets
   6.440 +	SetupSzOfs=497
   6.441 +	SyssizeOfs=500
   6.442 +	CodeAdrOfs=0x214
   6.443 +	RamfsAdrOfs=0x218
   6.444 +	RamfsLenOfs=0x21C
   6.445 +	ArgPtrOfs=0x228
   6.446 +
   6.447 +	# boot+setup address
   6.448 +	SetupBase=0x90000
   6.449 +
   6.450 +	stacktop=0x9E00
   6.451 +
   6.452 +	bs=/tmp/bs$$
   6.453 +
   6.454 +	# Get and patch boot sector
   6.455 +	dd if=$KERNEL bs=512 count=1 of=$bs 2> /dev/null
   6.456 +	uudecode <<EOT | dd of=$bs conv=notrunc 2> /dev/null
   6.457 +begin-base64 644 -
   6.458 +/L+6nWgAkAcGF4n8McC5HQDzq1sfD6mg8X1ABlfFd3ixBvOlZWaPR3gGH8ZF
   6.459 ++D/6l1hB6DQBvgACA3QO6HYBWwseKAJ0LFNH6AoBXuhmAbAgzRCwCM0QTuhl
   6.460 +ATwIdAOIBK05NigCdPDoPgE8CnXgiHz+ieb/TBD/TBi/9AGBTRz/gMdFMACc
   6.461 +sBCxBUi0k4lEHLABiUQUmGaY0+BIZgMFZtPoaAAQB7+AACn4nHMCAccx21BW
   6.462 +6J4AXrkAgLSH/kQczRVYnXfcoRoCvxwCsQk4RBxyuJPNE+oAACCQsEYoyL7b
   6.463 +AejSAF3rI4D5E3IEOMF3a4D+AnIEOOZ3bGCB/QAGdCoGUlFTlrQCULEGtQTB
   6.464 +xQSwDyHoBJAnFEAn6IwA/s117LAgzRDitOiWAJjNE2FSUCjIdwKwAZg5+HIC
   6.465 +ifhQtALNE5VeWFpyoJVBjuGAxwJPdFFOdfSM4ZU4wXVFiMj+xrEBOOZ1O4j0
   6.466 +/sW2AID9UHIwOi7wAXIqtQBgvt4B/kQMU+gxAFvoOAB1FlKYzRO4AQLNE1rQ
   6.467 +1Dpk/nXqRgjkdeVh64sWB7AxLAO0DrsHAM0QPA1088OwDejv/6wIwHX4w79s
   6.468 +BLFbZQINuA0BZToNdArNFnT0mM0Wju9Hw1g6AEluc2VydCBkaXNrIDEuBw0A
   6.469 +AA==
   6.470 +====
   6.471 +EOT
   6.472 +
   6.473 +	# Get setup
   6.474 +	setupsz=$(getlong $SetupSzOfs $bs)
   6.475 +	setupszb=$(( $setupsz & 255 ))
   6.476 +	dd if=$KERNEL bs=512 skip=1 count=$setupszb 2> /dev/null >> $bs
   6.477 +
   6.478 +	# Store cmdline after setup
   6.479 +	if [ -n "$CMDLINE" ]; then
   6.480 +		echo -n "$CMDLINE" | dd bs=512 count=1 conv=sync 2> /dev/null >> $bs
   6.481 +		storelong ArgPtrOfs $(( $SetupBase + $stacktop )) $bs
   6.482 +	fi
   6.483 +
   6.484 +	# Compute initramfs size
   6.485 +	initrdlen=0
   6.486 +	padding=0
   6.487 +	for i in $( echo $INITRD | sed 's/,/ /' ); do
   6.488 +		[ -s "$i" ] || continue
   6.489 +		initrdlen=$(( $initrdlen + $padding ))
   6.490 +		padding=$(stat -c %s $i)
   6.491 +		initrdlen=$(( $initrdlen + $padding ))
   6.492 +		padding=$(( 4096 - ($padding & 4095) ))
   6.493 +		[ $padding -eq 4096 ] && padding=0
   6.494 +	done
   6.495 +	Ksize=$(( $(getlong $SyssizeOfs $bs)*16 ))
   6.496 +	Kpad=$(( (($Ksize+4095)/4096)*4096 - Ksize ))
   6.497 +	if [ $initrdlen -ne 0 ]; then
   6.498 +		Kbase=$(getlong $CodeAdrOfs $bs)
   6.499 +		storelong $RamfsAdrOfs \
   6.500 +			$(( (0x1000000 - $initrdlen) & 0xFFFF0000 )) $bs
   6.501 +		storelong $RamfsLenOfs $initrdlen $bs
   6.502 +	fi
   6.503 +
   6.504 +	# Output boot sector + setup + cmdline
   6.505 +	dd if=$bs 2> /dev/null
   6.506 +
   6.507 +	# Output kernel code
   6.508 +	dd if=$KERNEL bs=512 skip=$(( $setupszb + 1 )) 2> /dev/null
   6.509 +
   6.510 +	# Pad to next sector
   6.511 +	Kpad=$(( 512 - ($(stat -c %s $KERNEL) & 511) ))
   6.512 +	[ $Kpad -eq 512 ] || dd if=/dev/zero bs=1 count=$Kpad 2> /dev/null
   6.513 +
   6.514 +	# Output initramfs
   6.515 +	padding=0
   6.516 +	for i in $( echo $INITRD | sed 's/,/ /' ); do
   6.517 +		[ -s "$i" ] || continue
   6.518 +		[ $padding -ne 0 ] && dd if=/dev/zero bs=1 count=$padding
   6.519 +		dd if=$i 2> /dev/null
   6.520 +		padding=$(( 4096 - ($(stat -c %s $i) & 4095) ))
   6.521 +		[ $padding -eq 4096 ] && padding=0
   6.522 +	done
   6.523 +
   6.524 +	# Cleanup
   6.525 +	rm -f $bs
   6.526 +}
   6.527 +
   6.528 +# Create boot floppy set from kernel, initrd & cmdline
   6.529 +floppyset()
   6.530 +{
   6.531 +	floppysetcat "$@" | split -b 1440k /dev/stdin floppy$$
   6.532 +	i=1
   6.533 +	ls floppy$$* | while read file ; do
   6.534 +		output=$(printf "fd%03d.img" $i)
   6.535 +		cat $file /dev/zero | dd bs=1k count=1440 of=$output conv=sync 2> /dev/null
   6.536 +		rm -f $file
   6.537 +		i=$(( $i + 1 ))
   6.538 +	done
   6.539 +}
   6.540 +
   6.541 +# Create boot floppy set from a SliTaz ISO image
   6.542 +floppysetfromiso()
   6.543 +{
   6.544 +	mkdir /tmp/iso$$
   6.545 +	mount -o loop,ro $1 /tmp/iso$$
   6.546 +	rootfs="$(ls /tmp/iso$$/boot/rootfs*z 2> /dev/null | tail -1)"
   6.547 +	bzimage=/tmp/iso$$/boot/bzImage
   6.548 +	if [ -z "$rootfs" -o ! -s $bzimage ]; then
   6.549 +		umount -d /tmp/iso$$
   6.550 +		rm -rf /tmp/iso$$
   6.551 +		echo "Not a SliTaz ISO image !"
   6.552 +		return 1
   6.553 +	fi
   6.554 +	mkdir -p /tmp/rootfs$$/fs
   6.555 +	n=1
   6.556 +	for i in $(ls /tmp/iso$$/boot/rootfs*z | sort -r); do
   6.557 +		mkdir /tmp/rootfs$$/$n
   6.558 +		ln -s $i /tmp/rootfs$$/$n
   6.559 +		n=$(($n + 1))
   6.560 +	done
   6.561 +	echo "Unpacking rootfs..."
   6.562 +	( zcat $rootfs 2> /dev/null | unlzma -c $rootfs ) | \
   6.563 +		( cd /tmp/rootfs$$/fs ; cpio -idm > /dev/null )
   6.564 +	if [ $(unlzma -c $rootfs 2> /dev/null| wc -c) -gt $(stat -c %s $rootfs) ]; then
   6.565 +		if [ $(du -ck $rootfs $bzimage | awk 'END { print $1 }') -gt 15296 ]; then
   6.566 +	# The rootfs.gz file is too big, extract a minimum bootfs with busybox stuff
   6.567 +			echo "Extracting bootfs..."
   6.568 +			mv /tmp/rootfs$$/fs /tmp/rootfs$$/fs0
   6.569 +			for i in lib bin sbin usr/bin usr/sbin ; do
   6.570 +				mkdir -p /tmp/rootfs$$/fs/$i
   6.571 +			done
   6.572 +			cd /tmp/rootfs$$/fs0
   6.573 +			dir=$(echo lib/modules/*/kernel/drivers/block)
   6.574 +			[ -d $dir ] && mkdir -p ../fs/$dir
   6.575 +			[ -f $dir/floppy.ko.gz ] && mv $dir/floppy.ko.gz ../fs/$dir
   6.576 +			for i in dev init mnt proc sys tmp ; do
   6.577 +				mv $i ../fs
   6.578 +			done
   6.579 +			mv lib/ld-* ../fs/lib
   6.580 +			LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so bin/busybox | \
   6.581 +			awk '/\/lib\/lib/ { print $3 }' | while read lib ; do
   6.582 +				while [ -L .$lib ]; do
   6.583 +					local target
   6.584 +					target="$(readlink ".$lib")"
   6.585 +					case "$target" in
   6.586 +					/*)	;;
   6.587 +					*)	target="$(dirname $lib)/$target" ;;
   6.588 +					esac
   6.589 +					mv ".$lib" ../fs/lib
   6.590 +					lib="$target"
   6.591 +				done
   6.592 +				mv ".$lib" ../fs/lib
   6.593 +			done
   6.594 +			for i in $(bin/busybox | awk '{ if (s) printf "%s",$0 }
   6.595 +				   /Currently/ { s=1 }' | sed 's/,//g'); do
   6.596 +				for j in bin sbin usr/bin usr/sbin ; do
   6.597 +					[ -e $j/$i ] && mv $j/$i ../fs/$j/$i
   6.598 +				done
   6.599 +			done
   6.600 +			mv bin/busybox ../fs/bin
   6.601 +			[ -e ../fs/bin/cpio ] || mv bin/cpio ../fs/bin
   6.602 +			rm -f ../1/*
   6.603 +			find | cpio -o -H newc | lzma e ../1/rootfs.gz -si
   6.604 +			cd - > /dev/null
   6.605 +			rm -rf /tmp/rootfs$$/fs0
   6.606 +		else
   6.607 +	# The rootfs.gz file fits in 15MB, no need to split it.
   6.608 +			rm -rf /tmp/rootfs$$/1
   6.609 +		fi
   6.610 +	else
   6.611 +	# This is a loram rootfs.gz, extract loram bootstrap
   6.612 +		echo "Splitting loram rootfs..."
   6.613 +		offset=$(awk '/07070100/ { o+=index($0,"07070100"); print int(o/4) ; exit } { o+=1+length() }' < $rootfs)
   6.614 +		dd if=$rootfs skip=$(($offset / 1024)) bs=4k count=1 2> /dev/null | \
   6.615 +		dd skip=$(($offset % 1024)) bs=4 of=/tmp/rootfs$$/1/root 2> /dev/null
   6.616 +		dd if=$rootfs skip=$((1 + ($offset / 1024) )) bs=4k \
   6.617 +			>> /tmp/rootfs$$/1/root 2> /dev/null
   6.618 +		rm -f /tmp/rootfs$$/1/rootfs*
   6.619 +	fi
   6.620 +	# Create extra rootfs floppies
   6.621 +	for i in /tmp/rootfs$$/[1-9]*/root* ; do
   6.622 +		[ -f $i ] || continue
   6.623 +		echo "Creating floppies for rootfs $(basename $(dirname $i) )..."
   6.624 +		case "$(dd if=$i bs=1 count=4 2> /dev/null)" in
   6.625 +		0707) cat $i ;;
   6.626 +		*)    zcat $i 2> /dev/null || unlzma -c $i ;;
   6.627 +		esac | cpio -t > $(dirname $i)/files.list
   6.628 +		sed -i '/ blocks$/d' $(dirname $i)/files.list
   6.629 +		x=$(readlink $i)
   6.630 +		[ -n "$x" ] || x=$i
   6.631 +		pad=$(( $(stat -c %s $x ) % 1474560 ))
   6.632 +		[ $pad -ne 0 ] && pad=$(( 1474560 - $pad ))
   6.633 +		dd if=/dev/zero bs=1 count=$pad 2> /dev/null | cat $i - | \
   6.634 +		split -b 1440k /dev/stdin $(dirname $i)/floppy
   6.635 +	done
   6.636 +	selection="$(grep -s append /tmp/iso$$/boot/isolinux/common.cfg | sed 's/.*append //')"
   6.637 +	[ -n "$selection" ] || selection="0 slitaz"
   6.638 +	set -- $selection
   6.639 +	selection=""
   6.640 +	while [ -n "$2" ]; do
   6.641 +		[ ! -d /tmp/rootfs$$/1 -a -z "$4" ] && break
   6.642 +		case "$1" in
   6.643 +		*G)	selection="$2 $(( ${1%G} * 1024 * 1024 )) $selection" ;;
   6.644 +		*M)	selection="$2 $(( ${1%M} * 1024 )) $selection" ;;
   6.645 +		*)	selection="$2 $1 $selection" ;;
   6.646 +		esac
   6.647 +		shift 2
   6.648 +	done
   6.649 +	echo "Creating /init ..."
   6.650 +	base=100
   6.651 +	set -- $selection
   6.652 +	for i in /tmp/rootfs$$/[1-9]* ; do
   6.653 +		[ -d $i ] || continue
   6.654 +		while read file; do
   6.655 +			[ -e $i/../fs/$file ] && continue
   6.656 +			[ $(grep -- "$file" $i/../*/files.list | wc -l) -eq 1 ] &&
   6.657 +			break
   6.658 +		done < $i/files.list
   6.659 +		printf "%s %s %03d %d %s %s\n" \
   6.660 +			$1 $2 $base $(ls $i/floppy* | wc -l) $file \
   6.661 +			$(cat $i/floppy* | md5sum - | awk '{print $1}')
   6.662 +		base=$(($base + 100))
   6.663 +		shift 2
   6.664 +	done | buildinit /tmp/rootfs$$/fs
   6.665 +	cmdline="$(grep 'append *initrd' /tmp/iso$$/boot/isolinux/isolinux.cfg | tail -n 1 | sed 's/.*gz //')"
   6.666 +	( cd /tmp/rootfs$$/fs ; find | cpio -o -H newc ) | lzma e /tmp/rootfs$$/rootfs -si
   6.667 +	echo "Creating first stage boot floppies..."
   6.668 +	floppyset $bzimage /tmp/rootfs$$/rootfs "$cmdline"
   6.669 +	base=100
   6.670 +	for i in /tmp/rootfs$$/[1-9]* ; do
   6.671 +		[ -d $i ] || continue
   6.672 +		j=0
   6.673 +		for f in $i/floppy* ; do
   6.674 +			mv $f $(printf "fd%03d.img" $(( $base + $j )) )
   6.675 +			j=$(($j + 1))
   6.676 +		done
   6.677 +		base=$(($base + 100))
   6.678 +	done
   6.679 +	rm -rf /tmp/rootfs$$
   6.680 +	umount -d /tmp/iso$$
   6.681 +	rm -rf /tmp/iso$$
   6.682 +}
   6.683 +
   6.684 +# Show new boot floppy set
   6.685 +dialogwritefloppyset()
   6.686 +{
   6.687 +	if ! list_floppy check; then
   6.688 +		du -h fd???.img
   6.689 +		return
   6.690 +	fi
   6.691 +	while true; do
   6.692 +	exec 3>&1
   6.693 +	IMAGE=`$DIALOG --title " Write floppy image " \
   6.694 +		--backtitle "Boot floppy set creation on $DEVICE" --clear \
   6.695 +		--colors --radiolist "
   6.696 +    Insert a blank floppy in drive and
   6.697 +select the floppy image you want to write.
   6.698 +" 18 46 46 \
   6.699 +		$(on="on"; for i in fd???.img; do echo "$i $(du -h $i | cut -f1) $on "; on="off"; done) 2>&1 1>&3`
   6.700 +	retval=$?
   6.701 +	exec 3>&-
   6.702 +	check_retval
   6.703 +	dd if=$IMAGE of=$DEVICE
   6.704 +	done
   6.705 +}
   6.706 +
   6.707 +dialognofloppyset()
   6.708 +{
   6.709 +	cat << EOT
   6.710 +The boot loader can't load the kernel and the initramfs in the first 16MB
   6.711 +of RAM. The total size exceeds 15MB. No floppy image is created.
   6.712 +EOT
   6.713 +}
   6.714 +
   6.715 +# Check for iso 9660 image
   6.716 +isiso()
   6.717 +{
   6.718 +	mkdir /tmp/iso$$
   6.719 +	mount -o loop,ro $1 /tmp/iso$$ 2> /dev/null
   6.720 +	status=$?
   6.721 +	umount -d /tmp/iso$$ 2> /dev/null
   6.722 +	rm -rf /tmp/iso$$
   6.723 +	return $status
   6.724 +}
   6.725 +
   6.726 +dialogfloppyset()
   6.727 +{
   6.728 +	: ${DIALOG=dialog}
   6.729 +	while true; do
   6.730 +	exec 3>&1
   6.731 +	KERNEL=`$DIALOG --title " Select a Linux kernel or a SliTaz iso " \
   6.732 +		--backtitle "Boot floppy set creation on $DEVICE" --clear \
   6.733 +		--colors --fselect "$PWD" 10 70 \
   6.734 +		2>&1 1>&3`
   6.735 +	retval=$?
   6.736 +	exec 3>&-
   6.737 +	check_retval
   6.738 +	[ -f $KERNEL ] && break
   6.739 +	done
   6.740 +	if isiso $KERNEL ; then
   6.741 +		bootfloppybox call mkisofloppies $KERNEL
   6.742 +		dialogwritefloppyset
   6.743 +		return
   6.744 +	fi
   6.745 +	exec 3>&1
   6.746 +	INITRD=`$DIALOG --title " Select an Initramfs " \
   6.747 +		--backtitle "Boot floppy set creation on $DEVICE" --clear \
   6.748 +		--colors --fselect "$PWD" 10 70 \
   6.749 +		2>&1 1>&3`
   6.750 +	retval=$?
   6.751 +	exec 3>&-
   6.752 +	check_retval
   6.753 +	[ -f "$INITRD" ] || INITRD=""
   6.754 +	exec 3>&1
   6.755 +	CMDLINE=`$DIALOG --title " Enter boot command line " \
   6.756 +		--backtitle "Boot floppy set creation on $DEVICE" --clear \
   6.757 +		--colors --inputbox "Kernel command line" 10 70 "rw root=/dev/null autologin" \
   6.758 +		2>&1 1>&3`
   6.759 +	retval=$?
   6.760 +	exec 3>&-
   6.761 +	check_retval
   6.762 +	bootfloppybox call mkfloppies "$KERNEL" "$INITRD" "$CMDLINE" &&
   6.763 +	dialogwritefloppyset ||
   6.764 +	dialognofloppyset
   6.765 +}
   6.766 +
   6.767 +#
   6.768 +# Create floppy image set
   6.769 +#
   6.770 +export IMAGE_SET='
   6.771 +<window title="Image set generator" icon-name="gtk-floppy">
   6.772 +  <vbox>
   6.773 +    <text use-markup="true">
   6.774 +      <label>
   6.775 +"
   6.776 +<b>Create a boot floppy set</b>
   6.777 +"
   6.778 +      </label>
   6.779 +    </text>
   6.780 +    <notebook labels="Slitaz only|Any Linux">
   6.781 +    <frame Slitaz only (no size limit)>
   6.782 +    <vbox>
   6.783 +    <text wrap="false" width-chars="44" use-markup="true">
   6.784 +      <label>
   6.785 +"
   6.786 +Slitaz uses a floppy boot flavor as a first
   6.787 +stage boot to break the tiny loader 15MB limit.
   6.788 +"
   6.789 +      </label>
   6.790 +    </text>
   6.791 +    <hbox>
   6.792 +      <text use-markup="true">
   6.793 +        <label>"<b>Slitaz ISO : </b>"</label>
   6.794 +      </text>
   6.795 +      <entry accept="filename">
   6.796 +        <label>Select a Slitaz ISO image</label>
   6.797 +        <variable>ISO</variable>
   6.798 +      </entry>
   6.799 +      <button>
   6.800 +        <input file stock="gtk-open"></input>
   6.801 +        <action type="fileselect">ISO</action>
   6.802 +      </button>
   6.803 +    </hbox>
   6.804 +    <hbox>
   6.805 +      <text use-markup="true">
   6.806 +        <label>"<b>Output directory : </b>"</label>
   6.807 +      </text>
   6.808 +      <entry accept="directory">
   6.809 +        <label>Select output directory</label>
   6.810 +        <variable>FILE_DIRECTORY</variable>
   6.811 +        <default>/tmp</default>
   6.812 +      </entry>
   6.813 +      <button>
   6.814 +        <input file stock="gtk-open"></input>
   6.815 +        <action type="fileselect">FILE_DIRECTORY</action>
   6.816 +      </button>
   6.817 +    </hbox>
   6.818 +    <hbox>
   6.819 +      <button>
   6.820 +        <input file icon="forward"></input>
   6.821 +        <label>Create image set from ISO boot</label>
   6.822 +	<action>cd $FILE_DIRECTORY; bootfloppybox call mkisofloppiesxterm $ISO</action>
   6.823 +        <action type="closewindow">IMAGE_SET</action>
   6.824 +      </button>
   6.825 +    </hbox>
   6.826 +    </vbox>
   6.827 +    </frame>
   6.828 +    <frame Any Linux distribution (max total size 14-15MB)>
   6.829 +    <vbox>
   6.830 +    <text wrap="false" width-chars="44" use-markup="true">
   6.831 +      <label>
   6.832 +"
   6.833 +The total size of the kernel and the initramfs must be
   6.834 +lower than 14-15MB due to the tiny boot loader design.
   6.835 +"
   6.836 +      </label>
   6.837 +    </text>
   6.838 +    <hbox>
   6.839 +      <text use-markup="true">
   6.840 +        <label>"<b>Kernel      : </b>"</label>
   6.841 +      </text>
   6.842 +      <entry accept="filename">
   6.843 +        <label>Select a linux kernel</label>
   6.844 +        <variable>KERNEL</variable>
   6.845 +      </entry>
   6.846 +      <button>
   6.847 +        <input file stock="gtk-open"></input>
   6.848 +        <action type="fileselect">KERNEL</action>
   6.849 +      </button>
   6.850 +    </hbox>
   6.851 +    <hbox>
   6.852 +      <text use-markup="true">
   6.853 +        <label>"<b>Initramfs : </b>"</label>
   6.854 +      </text>
   6.855 +      <entry accept="filename">
   6.856 +        <label>Select an initramfs/initrd file</label>
   6.857 +        <variable>INITRD</variable>
   6.858 +      </entry>
   6.859 +      <button>
   6.860 +        <input file stock="gtk-open"></input>
   6.861 +        <action type="fileselect">INITRD</action>
   6.862 +      </button>
   6.863 +    </hbox>
   6.864 +    <hbox>
   6.865 +      <text use-markup="true">
   6.866 +        <label>"<b>Cmdline   : </b>"</label>
   6.867 +      </text>
   6.868 +      <entry>
   6.869 +        <label>Enter kernel arguments</label>
   6.870 +        <variable>CMDLINE</variable>
   6.871 +        <default>rw root=/dev/null autologin</default>
   6.872 +      </entry>
   6.873 +    </hbox>
   6.874 +    <hbox>
   6.875 +      <text use-markup="true">
   6.876 +        <label>"<b>Output directory : </b>"</label>
   6.877 +      </text>
   6.878 +      <entry accept="directory">
   6.879 +        <label>Select output directory</label>
   6.880 +        <variable>OUTPUT_DIRECTORY</variable>
   6.881 +        <default>/tmp</default>
   6.882 +      </entry>
   6.883 +      <button>
   6.884 +        <input file stock="gtk-open"></input>
   6.885 +        <action type="fileselect">OUTPUT_DIRECTORY</action>
   6.886 +      </button>
   6.887 +    </hbox>
   6.888 +    <hbox>
   6.889 +      <button>
   6.890 +        <input file icon="forward"></input>
   6.891 +        <label>Create image set</label>
   6.892 +	<action>cd $OUTPUT_DIRECTORY; bootfloppybox call mkfloppies "$KERNEL" "$INITRD" "$CMDLINE"</action>
   6.893 +        <action type="closewindow">IMAGE_SET</action>
   6.894 +      </button>
   6.895 +    </hbox>
   6.896 +    </vbox>
   6.897 +    </frame>
   6.898 +    </notebook>
   6.899 +    <hbox>
   6.900 +      <button>
   6.901 +        <input file icon="gtk-close"></input>
   6.902 +        <action type="closewindow">IMAGE_SET</action>
   6.903 +      </button>
   6.904 +    </hbox>
   6.905 +  </vbox>
   6.906 +</window>
   6.907 +'
   6.908 +
   6.909 +#
   6.910 +# Read/write floppy images
   6.911 +#
   6.912 +export FLOPPY_IMAGE='
   6.913 +<window title="Floppy image manager" icon-name="gtk-floppy">
   6.914 +  <vbox>
   6.915 +    <frame Floppy disk drive>
   6.916 +      <hbox>
   6.917 +        <text use-markup="true">
   6.918 +          <label>"<b>Device : </b>"</label>
   6.919 +        </text>
   6.920 +	<combobox>
   6.921 +          <variable>DEVICE</variable>'
   6.922 +FLOPPY_DEV=""
   6.923 +for i in $(list_floppy); do
   6.924 +	FLOPPY_DEV="$FLOPPY_DEV
   6.925 +	  <item>/dev/$i</item>"
   6.926 +done
   6.927 +	FLOPPY_IMAGE="$FLOPPY_IMAGE$FLOPPY_DEV
   6.928 +	</combobox>
   6.929 +        <button>
   6.930 +          <label>Format floppy</label>
   6.931 +          <input file icon=\"media-floppy\"></input>
   6.932 +	  <action>fdformat -n $DEVICE</action>
   6.933 +        </button>
   6.934 +      </hbox>
   6.935 +    </frame>
   6.936 +    <frame Floppy image file>
   6.937 +      <hbox>
   6.938 +        <text use-markup=\"true\">
   6.939 +          <label>\"<b>File : </b>\"</label>
   6.940 +        </text>
   6.941 +        <entry accept=\"filename\">
   6.942 +          <label>Select a floppy image</label>
   6.943 +          <variable>IMAGE</variable>
   6.944 +        </entry>
   6.945 +        <button>
   6.946 +          <input file stock=\"gtk-open\"></input>
   6.947 +          <action type=\"fileselect\">IMAGE</action>
   6.948 +        </button>
   6.949 +      </hbox>
   6.950 +    </frame>
   6.951 +    <hbox>
   6.952 +      <button>
   6.953 +        <input file icon=\"reload\"></input>
   6.954 +        <label>Create image set</label>
   6.955 +	<action type=\"launch\">IMAGE_SET</action>
   6.956 +      </button>
   6.957 +      <button>
   6.958 +        <input file icon=\"go-jump\"></input>
   6.959 +        <label>Write image to floppy</label>
   6.960 +        <action>dd if=\$IMAGE of=\$DEVICE</action>
   6.961 +      </button>
   6.962 +      <button>
   6.963 +        <input file icon=\"undo\"></input>
   6.964 +        <label>Get floppy image</label>
   6.965 +        <action>dd if=\$DEVICE of=\$IMAGE</action>
   6.966 +      </button>
   6.967 +      <button>
   6.968 +        <input file icon=\"gtk-close\"></input>
   6.969 +        <action type=\"closewindow\">FLOPPY_IMAGE</action>
   6.970 +      </button>
   6.971 +    </hbox>
   6.972 +  </vbox>
   6.973 +</window>
   6.974 +"
   6.975 +
   6.976 +gtkdialogshowfloppyset()
   6.977 +{
   6.978 +#
   6.979 +# Show floppy image set
   6.980 +#
   6.981 +IMAGE_SHOW='
   6.982 +<window title="Image set" icon-name="gtk-floppy">
   6.983 +  <vbox>
   6.984 +    <text use-markup="true">
   6.985 +      <label>
   6.986 +"
   6.987 +<b>Boot floppy images</b>
   6.988 +"
   6.989 +      </label>
   6.990 +    </text>
   6.991 +    <tree>
   6.992 +        <width>50</width><height>140</height>
   6.993 +    	<label>Size|File</label>
   6.994 +    	<input>du -h fd???.img | sed "s/\t/|/" </input>
   6.995 +    </tree>
   6.996 +    <hbox>
   6.997 +'
   6.998 +	[ 0$1 -gt $((15 * 1024 * 1024)) ] &&  IMAGE_SHOW="$IMAGE_SHOW
   6.999 +    <frame WARNING>
  6.1000 +    <text>
  6.1001 +      <label>
  6.1002 +\"This floppy set breaks the 15MB limit ($1 bytes).
  6.1003 +It may not be able to complete the boot process.\"
  6.1004 +      </label>
  6.1005 +    </text>
  6.1006 +    </frame>
  6.1007 +    </hbox>
  6.1008 +    <hbox>
  6.1009 +"
  6.1010 +	list_floppy check && IMAGE_SHOW="$IMAGE_SHOW
  6.1011 +      <button>
  6.1012 +        <input file icon=\"media-floppy\"></input>
  6.1013 +	<label>Manage images</label>
  6.1014 +	<action type=\"launch\">FLOPPY_IMAGE</action>
  6.1015 +      </button>
  6.1016 +"
  6.1017 +	IMAGE_SHOW="$IMAGE_SHOW
  6.1018 +      <button>
  6.1019 +        <input file icon=\"gtk-close\"></input>
  6.1020 +        <action type=\"closewindow\">IMAGE_SET</action>
  6.1021 +      </button>
  6.1022 +    </hbox>
  6.1023 +  </vbox>
  6.1024 +</window>
  6.1025 +"
  6.1026 +	export IMAGE_SHOW
  6.1027 +	gtkdialog --program=IMAGE_SHOW
  6.1028 +}
  6.1029 +
  6.1030 +while true; do
  6.1031 +
  6.1032 +if [ "$1" == "call" ]; then
  6.1033 +	case "$2" in
  6.1034 +	mkmenu) mkmenu $3;;
  6.1035 +	mkisofloppiesxterm)
  6.1036 +		shift 2
  6.1037 +		xterm -geometry 80x16 -title "Build boot floppies from ISO" \
  6.1038 +			-e "$0 call mkisofloppies $@ ; echo -e \"----\nENTER to continue...\" && read close"
  6.1039 +		gtkdialogshowfloppyset
  6.1040 +		;;
  6.1041 +	mkisofloppies)
  6.1042 +		shift 2
  6.1043 +		floppysetfromiso $@
  6.1044 +		;;
  6.1045 +	mkfloppies)
  6.1046 +		shift 2
  6.1047 +		floppyset "$@"
  6.1048 +		sz=$(cat fd???.img | wc -c)
  6.1049 +		if [ -n "$XAUTHORITY" ]; then
  6.1050 +			gtkdialogshowfloppyset $sz
  6.1051 +		else
  6.1052 +			if [ $sz -gt $((15 * 1024 * 1024)) ]; then
  6.1053 +				cat <<EOT
  6.1054 +This floppy set breaks the 15MB limit ($sz bytes).
  6.1055 +It may not be able to complete the boot process.
  6.1056 +EOT
  6.1057 +			fi
  6.1058 +		fi
  6.1059 +		;;
  6.1060 +	install)
  6.1061 +		DIR=/tmp/mkbootfloppy$$
  6.1062 +		mkdir -p $DIR
  6.1063 +		DEVICE=$4
  6.1064 +		file=$5
  6.1065 +		case "$3" in
  6.1066 +		dialog*)
  6.1067 +			shift 2
  6.1068 +			$@
  6.1069 +			;;
  6.1070 +		grub*)
  6.1071 +			mkdir -p $DIR/boot/grub
  6.1072 +			[ -f /usr/share/boot/btmgr -a -f /usr/share/boot/memdisk.lzma ] \
  6.1073 +				&& cat /usr/share/boot/btmgr /dev/zero | \
  6.1074 +				   dd bs=18k count=80 | gzip -9 > \
  6.1075 +				   $DIR/boot/btmgr.gz \
  6.1076 +				&& unlzma -c /usr/share/boot/memdisk.lzma > \
  6.1077 +					$DIR/boot/memdisk
  6.1078 +			[ -f /usr/share/boot/plpbt.bin ] \
  6.1079 +			  	&& cp /usr/share/boot/plpbt.bin $DIR/boot
  6.1080 +			[ -f /usr/share/boot/etherboot ] \
  6.1081 +				&& cp /usr/share/boot/etherboot $DIR/boot
  6.1082 +			[ -f /boot/gpxe ]\
  6.1083 +				&& cp /boot/gpxe $DIR/boot
  6.1084 +			[ -f /usr/share/boot/memtest.lzma -a \
  6.1085 +			  -f /usr/share/boot/memdisk.lzma ] \
  6.1086 +				&& unlzma -c /usr/share/boot/memtest.lzma | \
  6.1087 +				   cat - /dev/zero | dd bs=18k count=80 | \
  6.1088 +				   gzip -9 > $DIR/boot/memtest.gz \
  6.1089 +				&& unlzma -c /usr/share/boot/memdisk.lzma > \
  6.1090 +					$DIR/boot/memdisk
  6.1091 +			install_grub $DIR $3
  6.1092 +			;;
  6.1093 +		*)
  6.1094 +    			case "$file" in
  6.1095 +    			*.lzma) action="unlzma -c";;
  6.1096 +    			*.gz)   action="zcat";;
  6.1097 +    			*)      action="cat";;
  6.1098 +    			esac
  6.1099 +			case "$DEVICE" in
  6.1100 +			/dev/*) $action $file > $DEVICE;;
  6.1101 +			flopp*) $action $file | cat - /dev/zero | \
  6.1102 +						dd bs=18k count=80 > boot.fd;;
  6.1103 +			cdrom*)
  6.1104 +				mkdir -p $DIR/boot/grub
  6.1105 +				case "$3" in
  6.1106 +				btmgr|memtest)
  6.1107 +					$action $file | cat - /dev/zero | \
  6.1108 +						dd bs=18k count=80 | \
  6.1109 +						gzip -9 > $DIR/boot/$3.gz
  6.1110 +					unlzma -c /usr/share/boot/memdisk.lzma \
  6.1111 +						> $DIR/boot/memdisk
  6.1112 +					cat > /tmp/floppybox.grub.menu << EOT
  6.1113 +# grub menu
  6.1114 +timeout 0
  6.1115 +title $3
  6.1116 +kernel /boot/memdisk floppy c=80 h=2 s=18
  6.1117 +initrd /boot/$3.gz
  6.1118 +EOT
  6.1119 +					;;
  6.1120 +				*)	$action $file > $DIR/boot/$3
  6.1121 +					cat > /tmp/floppybox.grub.menu << EOT
  6.1122 +# grub menu
  6.1123 +timeout 0
  6.1124 +title $3
  6.1125 +kernel /boot/$3
  6.1126 +EOT
  6.1127 +					;;
  6.1128 +				esac
  6.1129 +				install_grub $DIR grub
  6.1130 +				;;
  6.1131 +			esac
  6.1132 +			;;
  6.1133 +		esac
  6.1134 +		rm -rf $DIR
  6.1135 +		;;
  6.1136 +	get-plop)
  6.1137 +		mkdir -p /tmp/get-plop$$
  6.1138 +		PLOP_URL=http://mirror.slitaz.org/boot/plpbt.bin
  6.1139 +		wget -O - $PLOP_URL  > /tmp/get-plop$$/plpbt.bin
  6.1140 +		VERSION="$(strings /tmp/get-plop$$/plpbt.bin \
  6.1141 +		  | grep 'Boot Manager v' | sed 's/.* v\([0-9\.]*\) .*/\1/')"
  6.1142 +		mkdir -p $(dirname /tmp/get-plop$$/plop-$VERSION/fs/$3)
  6.1143 +		mv /tmp/get-plop$$/plpbt.bin \
  6.1144 +		   /tmp/get-plop$$/plop-$VERSION/fs/$3
  6.1145 +		if [ -s /tmp/get-plop$$/plop-$VERSION/fs/$3 ]; then 
  6.1146 +			cat > /tmp/get-plop$$/plop-$VERSION/receipt <<EOT
  6.1147 +PACKAGE="plop"
  6.1148 +VERSION="$VERSION"
  6.1149 +CATEGORY="non-free"
  6.1150 +SHORT_DESC="Plop boot manager."
  6.1151 +WEB_SITE="http://www.plop.at/en/bootmanager.html"
  6.1152 +EOT
  6.1153 +			( cd /tmp/get-plop$$ ; tazpkg pack plop-$VERSION )
  6.1154 +			tazpkg install /tmp/get-plop$$/plop-$VERSION.tazpkg
  6.1155 +		fi
  6.1156 +		rm -rf /tmp/get-plop$$
  6.1157 +		;;
  6.1158 +	*)	echo "Invalid command $0 $@" 1>&2
  6.1159 +		exit 1;;
  6.1160 +	esac
  6.1161 +	exit 0
  6.1162 +fi
  6.1163 +
  6.1164 +if [ -z "$XAUTHORITY" ]; then
  6.1165 +
  6.1166 +    : ${DIALOG=dialog}
  6.1167 +    
  6.1168 +    DEVICE=/dev/fd0
  6.1169 +    list_floppy check || DEVICE="floppy"
  6.1170 +    while true; do
  6.1171 +	exec 3>&1
  6.1172 +	ID_SOURCE=`$DIALOG --title " Choose a boot floppy " \
  6.1173 +		--backtitle "Boot Floppy Creation on $DEVICE" --clear \
  6.1174 +		--extra-button --extra-label "Change floppy" \
  6.1175 +		--colors --radiolist "
  6.1176 +Create a floppy or a cdrom to boot a LiveCD in a PXE network...
  6.1177 +May need a floppy disk in drive. Erase the whole floppy disk.
  6.1178 +		" 18 70 50\
  6.1179 +		FloppySet	"Boot Slitaz with floppies only." on \
  6.1180 +		SmartBtmgr	"Boot any partition or ATAPI CD-ROM." off \
  6.1181 +		Plop		"Boot USB harddisk floppy or CD/DVD." off \
  6.1182 +		Etherboot	"Replacement for proprietary PXE ROMs." off \
  6.1183 +		gPXE		"Boot from http://boot.slitaz.org/" off \
  6.1184 +		Memtest86+	"Memory failures detection tool." off \
  6.1185 +		Grub4DOS	"Enhanced grub version supporting NTFS." off \
  6.1186 +		Grub		"Boot loader with command shell." off \
  6.1187 +		2>&1 1>&3`
  6.1188 +	retval=$?
  6.1189 +	exec 3>&-
  6.1190 +	check_retval
  6.1191 +	if [ "$retval" = "3" ]; then
  6.1192 +		select_floppy
  6.1193 +		continue;
  6.1194 +	fi
  6.1195 +	while read key file pkg; do
  6.1196 +		[ "$key" = "$ID_SOURCE" ] || continue
  6.1197 +		if [ ! -f "$file" ]; then
  6.1198 +			$DIALOG --title " Install package " --colors \
  6.1199 +				--backtitle "Boot Floppy Creation" --clear \
  6.1200 +				--yes-label "Install" \
  6.1201 +				--no-label "Quit" \
  6.1202 +				--yesno "The package $pkg is not yet installed. Install it ?" 18 70
  6.1203 +			retval=$?
  6.1204 +			if [ "$pkg" = "plop" ]; then
  6.1205 +				bootfloppybox call get-plop $file
  6.1206 +			else
  6.1207 +				tazpkg get-install $pkg
  6.1208 +			fi
  6.1209 +		fi
  6.1210 +		bootfloppybox call install "$pkg" "$DEVICE" "$file"
  6.1211 +		exit 0
  6.1212 +	done <<EOT
  6.1213 +FloppySet /bin/dd dialogfloppyset
  6.1214 +SmartBtmgr /usr/share/boot/btmgr btmgr
  6.1215 +Plop /usr/share/boot/plpbt.bin plop
  6.1216 +Etherboot /usr/share/boot/etherboot etherboot
  6.1217 +gPXE /boot/gpxe gpxe
  6.1218 +Memtest86+ /usr/share/boot/memtest.lzma memtest
  6.1219 +Grub4DOS /usr/share/boot/grldr.lzma grub4dos
  6.1220 +Grub /usr/sbin/grub grub
  6.1221 +EOT
  6.1222 +    done
  6.1223 +fi
  6.1224 +#
  6.1225 +# Describe gPXE arguments.
  6.1226 +#
  6.1227 +export HELP='
  6.1228 +<window title="gPXE forced url" icon-name="gtk-floppy">
  6.1229 +<vbox>
  6.1230 +  <text use-markup="true">
  6.1231 +    <label>"
  6.1232 +<b>Web boot parameters</b>"
  6.1233 +    </label>
  6.1234 +  </text>
  6.1235 +  <frame>
  6.1236 +    <text wrap="true" width-chars="58" use-markup="true">
  6.1237 +      <label>
  6.1238 +"Without parameters (i.e. with an empty Boot URL) gPXE will perform a normal PXE boot: IP configuration with DHCP and download the DHCP bootfile with TFTP.
  6.1239 +
  6.1240 +You can override the DHCP bootfile with a Boot URL such as <i>tftp://192.168.0.1/pxe/pxeloader</i>, <i>http://mirror.slitaz.org/pxe/pxelinux.0</i>, or <i>x-tftm://192.168.0.201//lts/vmlinuz.ltsp</i>.
  6.1241 +
  6.1242 +You can override the IP configuration too (useful without a DHCP server), example: <i>ip=192.168.0.10/24 gw=192.168.0.1 dns=192.168.0.1 nodhcp url=http://mirror.slitaz.org/pxe/pxelinux.0</i>
  6.1243 +
  6.1244 +The <i>nodhcp</i> keyword avoids dhcp timeouts and the <i>url=</i> keyword is optional when the url is the only one argument.
  6.1245 +
  6.1246 +Comma separated URL lists are supported. The PXE client will try to load the first URL. If the load fails, it will try the next URL, and so on. 
  6.1247 +"
  6.1248 +      </label>
  6.1249 +    </text>
  6.1250 +  </frame>
  6.1251 +</vbox>
  6.1252 +</window>
  6.1253 +'
  6.1254 +#
  6.1255 +# Write bootfloppy image to floppy device.
  6.1256 +#
  6.1257 +BOOT_DIALOG='
  6.1258 +<window title="bootfloppybox" icon-name="gtk-floppy">
  6.1259 +  <vbox>
  6.1260 + 
  6.1261 +    <text use-markup="true">
  6.1262 +      <label>
  6.1263 +"
  6.1264 +<b>SliTaz - Bootfloppybox</b>"
  6.1265 +      </label>
  6.1266 +    </text>
  6.1267 +    <text wrap="false" width-chars="44" use-markup="true">
  6.1268 +      <label>
  6.1269 +"
  6.1270 +Create a floppy or a cdrom to boot a LiveCD in a PXE network or the WEB...
  6.1271 +May need a floppy disk in drive. Erase the whole floppy disk.
  6.1272 +"
  6.1273 +      </label>
  6.1274 +    </text>
  6.1275 +  
  6.1276 +    <frame Floppy disk drive>
  6.1277 +      <hbox>
  6.1278 +        <text use-markup="true">
  6.1279 +          <label>"<b>Device : </b>"</label>
  6.1280 +        </text>
  6.1281 +	<combobox>
  6.1282 +          <variable>DEVICE</variable>'
  6.1283 +FLOPPY_DEV=""
  6.1284 +for i in $(list_floppy); do
  6.1285 +	FLOPPY_DEV="$FLOPPY_DEV
  6.1286 +	  <item>/dev/$i</item>"
  6.1287 +done
  6.1288 +	BOOT_DIALOG="$BOOT_DIALOG$FLOPPY_DEV
  6.1289 +	  <item>floppy image (boot.fd)</item>
  6.1290 +	  <item>cdrom image (boot.iso)</item>
  6.1291 +	</combobox>"
  6.1292 +if [ -n "$FLOPPY_DEV" ]; then
  6.1293 +	tmp='
  6.1294 +        <button>
  6.1295 +          <label>Format floppy</label>
  6.1296 +          <input file icon="media-floppy"></input>
  6.1297 +	  <action>case "$DEVICE" in /dev/*) fdformat -n $DEVICE;; esac</action>
  6.1298 +        </button>'
  6.1299 +	BOOT_DIALOG="$BOOT_DIALOG$tmp"
  6.1300 +fi
  6.1301 +tmp='
  6.1302 +      </hbox>
  6.1303 +    </frame>
  6.1304 +    <notebook labels="Set|LiveCD|USB|PXE Network|WEB Network|Memory Test|Windows|Expert">
  6.1305 +    <frame Boot floppy set (many floppies)>
  6.1306 +      <vbox>
  6.1307 +      <hbox>
  6.1308 +        <text wrap="true" width-chars="58" use-markup="true">
  6.1309 +          <label>
  6.1310 +"
  6.1311 +Only people without a CD-ROM, USB and Network should use a floppy set. 
  6.1312 +The images are built from an ISO boot or from a Linux kernel, an initramfs
  6.1313 +and a boot command line. Non Slitaz boot floppy sets are limited to 15MB.
  6.1314 +"
  6.1315 +          </label>
  6.1316 +        </text>
  6.1317 +      </hbox>
  6.1318 +      <hbox>
  6.1319 +      <button>
  6.1320 +        <label>Create image set</label>
  6.1321 +        <input file icon="forward"></input>
  6.1322 +	<action type="launch">IMAGE_SET</action>
  6.1323 +      </button>
  6.1324 +      </hbox>
  6.1325 +      </vbox>
  6.1326 +    </frame>
  6.1327 +'  
  6.1328 +BOOT_DIALOG="$BOOT_DIALOG$tmp"
  6.1329 +while read name file pkg desc; do
  6.1330 +    tmp="<frame $name (single floppy)>
  6.1331 +      <hbox>
  6.1332 +    <text wrap=\"true\" width-chars=\"58\" use-markup=\"true\">
  6.1333 +      <label>
  6.1334 +\"
  6.1335 +$(echo -e $desc)
  6.1336 +\"
  6.1337 +      </label>
  6.1338 +    </text>
  6.1339 +      </hbox>
  6.1340 +      <hbox>
  6.1341 +"
  6.1342 +  if [ -f $file ]; then
  6.1343 +    if [ "$pkg" = "grub" -o "$pkg" = "grub4dos" ]; then
  6.1344 +      tmp="$tmp
  6.1345 +      <button>
  6.1346 +        <label>Grub menu</label>
  6.1347 +        <input file icon=\"accessories-text-editor\"></input>
  6.1348 +	<action>bootfloppybox call mkmenu $pkg</action>
  6.1349 +        <action type=\"lauch\">leafpad /tmp/floppybox.grub.menu</action>
  6.1350 +      </button>
  6.1351 +"
  6.1352 +    elif [ "$pkg" = "etherboot" ]; then
  6.1353 +      tmp="$tmp
  6.1354 +      <button>
  6.1355 +        <input file icon=\"browser\"></input>
  6.1356 +	<label>Wiki</label>
  6.1357 +	<action>browser http://doc.slitaz.org/en:guides:pxe &</action>
  6.1358 +      </button>
  6.1359 +"
  6.1360 +    elif [ "$pkg" = "gpxe" ]; then
  6.1361 +      tmp="$tmp
  6.1362 +      <text wrap=\"true\" use-markup=\"true\">
  6.1363 +        <label> \"<b>Boot URL:</b>\" </label>
  6.1364 +      </text>
  6.1365 +      <entry>
  6.1366 +	<default>$(dd if=$file bs=1 skip=519 count=255 2>/dev/null | strings)</default>
  6.1367 +        <variable>URL</variable>
  6.1368 +      </entry>
  6.1369 +      </hbox>
  6.1370 +      <hbox>
  6.1371 +      <button>
  6.1372 +        <input file icon=\"browser\"></input>
  6.1373 +	<label>Wiki</label>
  6.1374 +	<action>browser http://doc.slitaz.org/en:guides:pxe &</action>
  6.1375 +      </button>
  6.1376 +      <button help>
  6.1377 +	<action type=\"launch\">HELP</action>
  6.1378 +      </button>
  6.1379 +      <button>
  6.1380 +        <label>Update</label>
  6.1381 +        <input file icon=\"reload\"></input>
  6.1382 +	<action>echo -n \"\$URL\" | cat - /dev/zero | dd conv=notrunc bs=1 count=255 seek=519 of=$file 2>/dev/null</action>
  6.1383 +      </button>
  6.1384 +"
  6.1385 +    fi
  6.1386 +    receipt=/var/lib/tazpkg/installed/$pkg/receipt
  6.1387 +    if [ -f $receipt ]; then
  6.1388 +      . $receipt
  6.1389 +      tmp="$tmp
  6.1390 +      <button>
  6.1391 +        <input file icon=\"browser\"></input>
  6.1392 +	<label>Web</label>
  6.1393 +	<action>browser $WEB_SITE &</action>
  6.1394 +      </button>
  6.1395 +"
  6.1396 +    fi
  6.1397 +    tmp="$tmp
  6.1398 +      <button>
  6.1399 +        <label>Write floppy</label>
  6.1400 +        <input file icon=\"forward\"></input>
  6.1401 +	<action>bootfloppybox call install \"$pkg\" \"\$DEVICE\" \"$file\"</action>
  6.1402 +      </button>
  6.1403 +      </hbox>
  6.1404 +    </frame>
  6.1405 +"
  6.1406 +  else
  6.1407 +    tmp2="tazpkg get-install $pkg --forced"
  6.1408 +    [ "$pkg" = "plop" ] && tmp2="bootfloppybox call get-plop $file"
  6.1409 +    tmp="$tmp
  6.1410 +      <text wrap=\"true\" width-chars=\"34\" use-markup=\"true\">
  6.1411 +        <label>
  6.1412 +\"<i>The package <b>$pkg</b> is not yet installed</i>\"
  6.1413 +        </label>
  6.1414 +      </text>
  6.1415 +      <button>
  6.1416 +        <input file icon=\"go-jump\"></input>
  6.1417 +	<label>Install</label>
  6.1418 +	<action>[ -f /var/lib/tazpkg/packages.list ] || tazpkg recharge</action>
  6.1419 +	<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x17 -title \"$pkg install\" -e \"$tmp2 ; sleep 2\"</action>
  6.1420 +        <action type=\"exit\">restart</action>
  6.1421 +      </button>
  6.1422 +      </hbox>
  6.1423 +    </frame>
  6.1424 +"
  6.1425 +  fi
  6.1426 +  BOOT_DIALOG="$BOOT_DIALOG$tmp"
  6.1427 +done <<EOT
  6.1428 +SmartBtmgr /usr/share/boot/btmgr btmgr This OS independent Smart Boot Manager can boot \\\\nany partition or ATAPI CD-ROM.
  6.1429 +Plop /usr/share/boot/plpbt.bin plop This non free Boot Manager can boot a floppy disk, hardisk, USB or \\\\nCD/DVD. Hit Ctrl-ESC for text mode.
  6.1430 +Etherboot /usr/share/boot/etherboot etherboot This network bootloader provides a replacement \\\\nfor proprietary PXE or NBI ROMs.
  6.1431 +gPXE /boot/gpxe gpxe PXE / iSCSI / AoE network bootloader.
  6.1432 +Memtest86+ /usr/share/boot/memtest.lzma memtest Memory failures detection tool.
  6.1433 +Grub4DOS /usr/share/boot/grldr.lzma grub4dos Enhanced grub version supporting NTFS.
  6.1434 +Grub /usr/sbin/grub grub General purpose boot loader with command shell.
  6.1435 +EOT
  6.1436 +tmp='
  6.1437 +    </notebook>
  6.1438 +    <hbox>
  6.1439 +'
  6.1440 +BOOT_DIALOG="$BOOT_DIALOG$tmp"
  6.1441 +if [ -e /dev/cdrom ]; then
  6.1442 +tmp='
  6.1443 +      <button>
  6.1444 +        <input file icon="media-cdrom"></input>
  6.1445 +	<label>Burn cdrom image</label>
  6.1446 +	<action>burnbox</action>
  6.1447 +      </button>
  6.1448 +'
  6.1449 +BOOT_DIALOG="$BOOT_DIALOG$tmp"
  6.1450 +fi
  6.1451 +if list_floppy check; then
  6.1452 +tmp='
  6.1453 +      <button>
  6.1454 +        <input file icon="media-floppy"></input>
  6.1455 +	<label>Manage floppy image</label>
  6.1456 +	<action type="launch">FLOPPY_IMAGE</action>
  6.1457 +      </button>
  6.1458 +'
  6.1459 +BOOT_DIALOG="$BOOT_DIALOG$tmp"
  6.1460 +fi
  6.1461 +tmp='
  6.1462 +      <button>
  6.1463 +        <input file icon="exit"></input>
  6.1464 +	<label>Exit</label>
  6.1465 +        <action type="exit">Exit</action>
  6.1466 +      </button>
  6.1467 +    </hbox>
  6.1468 +  
  6.1469 +  </vbox>
  6.1470 +</window>
  6.1471 +'
  6.1472 +BOOT_DIALOG="$BOOT_DIALOG$tmp"
  6.1473 +export BOOT_DIALOG
  6.1474 +
  6.1475 +# Only root can create floppy.
  6.1476 +check_root
  6.1477 +gtkdialog --program=BOOT_DIALOG | grep -q 'EXIT="restart"' && continue
  6.1478 +rm -f /tmp/floppybox.grub.menu
  6.1479 +exit 0
  6.1480 +done
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/oldstuff/gtkdialog/bootfloppybox.desktop	Sat Apr 28 20:16:24 2012 +0200
     7.3 @@ -0,0 +1,10 @@
     7.4 +[Desktop Entry]
     7.5 +Encoding=UTF-8
     7.6 +Name=Boot floppy/cdrom creation tool
     7.7 +Name[pt]=Criação de disquete/cdrom de boot
     7.8 +Name[pt_BR]=Criação de disquete/cdrom de boot
     7.9 +Name[fr]=Disquette/cdrom de démarrage
    7.10 +Exec=subox bootfloppybox
    7.11 +Icon=gtk-floppy
    7.12 +Type=Application
    7.13 +Categories=System;
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/oldstuff/gtkdialog/burnbox	Sat Apr 28 20:16:24 2012 +0200
     8.3 @@ -0,0 +1,714 @@
     8.4 +#!/bin/sh
     8.5 +# 
     8.6 +# Gtkdialog box to burn CD or DVD using Wodim with basic options. Burnbox
     8.7 +# can burn ISO images, blank rewritable CD or create audio CD with WAV.
     8.8 +# 
     8.9 +# (c) - SliTaz GNU/Linux 2009 - GNU GPL v3
    8.10 +
    8.11 +# Authors : Christophe Lincoln <pankso@slitaz.org>
    8.12 +#           Rohit Joshi <jozee@slitaz.org>
    8.13 +#
    8.14 +VERSION=20100315
    8.15 +TMPDIR="/tmp/burn-cd"
    8.16 +
    8.17 +chk_install()
    8.18 +{	
    8.19 +	for pkg in $@
    8.20 +	do
    8.21 +		if [ ! -d /var/lib/tazpkg/installed/${pkg} ]; then
    8.22 +			UNINSTALLED="$UNINSTALLED $pkg"
    8.23 +		fi			
    8.24 +	done 
    8.25 +	if [ ! "$UNINSTALLED" = "" ] ; then
    8.26 +		xterm -geometry 80x16 -title "INSTALL PACKAGE" \
    8.27 +				-e "echo -n \"This option depends on $UNINSTALLED. Please install and try again..\"; sleep 4;"
    8.28 +	fi	
    8.29 +}
    8.30 +
    8.31 +# Auto Install DEPENDS and/or SUGGESTED
    8.32 +install()
    8.33 +{
    8.34 +	#echo "pkgs to install: $1"
    8.35 +	for pkg in $1 ; do
    8.36 +	   # Avoid reinstall
    8.37 +		if [ ! -d /var/lib/tazpkg/installed/"$pkg" ]; then
    8.38 +			xterm -geometry 80x16 -title "INSTALL PACKAGE" \
    8.39 +				-e "	echo \"This option depends on $pkg. Installing $pkg as root: \" ;  subox tazpkg get-install $pkg --forced; sleep 2;
    8.40 +						echo -e \"----\nPress ENTER to close and PROCEED with decoding...\"; read i; exit 0;	"		
    8.41 +		fi
    8.42 +	done
    8.43 +	
    8.44 +}
    8.45 +
    8.46 +
    8.47 +# Check read write permission for device.
    8.48 +chk_rw_permissions()
    8.49 +{
    8.50 +	xterm -geometry 80x16 -title "Check Permission" \
    8.51 +		-e ' 
    8.52 +			if [ ! -r "$DEVICE"  -o   ! -w "$DEVICE" ]; then
    8.53 +				echo "You dont have read write permission for $DEVICE;  "
    8.54 +				echo "Add yourself to group cdrom: addgroup tux cdrom"								 		
    8.55 +			else
    8.56 +				echo "You have read write permission for $DEVICE. You can proceed to burn."					
    8.57 +			fi
    8.58 +			sleep 3;
    8.59 +		  '
    8.60 +}
    8.61 +
    8.62 +# Display audio cd size.
    8.63 +audio_cd_stats()
    8.64 +{
    8.65 +	AUDIO_CD_SIZE=`du -m $TMPDIR | awk '{print $1}'`
    8.66 +	TRACK_NB=`ls -1 $TMPDIR | wc -l`
    8.67 +	echo -n "Total $TRACK_NB tracks: $AUDIO_CD_SIZE Mb"
    8.68 +}
    8.69 +
    8.70 +
    8.71 +decode_ogg()
    8.72 +{
    8.73 +	if ls $TMPDIR | grep -q .ogg; then
    8.74 +		cd $TMPDIR
    8.75 +		xterm -geometry 80x16 -title "Oggdec" \
    8.76 +			-e 'for i in *.ogg; do oggdec "$i" && rm "$i"; done; sleep 2'
    8.77 +	fi
    8.78 +}
    8.79 +
    8.80 +decode_mp3()
    8.81 +{
    8.82 +	
    8.83 +	if ls $TMPDIR | grep -q .mp3; then
    8.84 +		cd $TMPDIR
    8.85 +		install "mpg123"
    8.86 +		
    8.87 +		xterm -geometry 80x16 -title "mpg123" \
    8.88 +				-e 'for file in *.mp3; do 
    8.89 +						mpg123 --rate 44100 --stereo --buffer 3072 --resync -w  `basename "$file" .mp3`.wav "$file" && rm -f "$file"; 
    8.90 +				  done; sleep 2'			  	
    8.91 +	fi
    8.92 +}
    8.93 +
    8.94 +decode_video()
    8.95 +{
    8.96 +	# convert videos into a VCD/SVCD/DVD compatible mpg video format
    8.97 +	if ls $TMPDIR | grep -q ".avi\|.mov\|.wmv\|.flv"  ; then
    8.98 +		cd $TMPDIR
    8.99 +		install "ffmpeg"
   8.100 +				
   8.101 +		xterm -geometry 80x16 -title "ffmpeg" \
   8.102 +				-e ' echo -n "Select target type (pal-vcd ntsc-vcd pal-svcd ntsc-svcd pal-dvd ntsc-dvd) "; read TARGET_OPTIONS
   8.103 +					 for file in *.avi *.wmv *.mov *.flv; do
   8.104 +						 ext=`echo "${file##*.}"`
   8.105 +						 output_file=`basename "$file" .$ext`.mpg
   8.106 +					 	 ffmpeg -i "$file" -target "$TARGET_OPTIONS" "$output_file" && rm "$file";
   8.107 +					 done; sleep 2;
   8.108 +				   '
   8.109 +	fi
   8.110 +	
   8.111 +
   8.112 +}
   8.113 +
   8.114 +# convert spaces in filename with _ and remove special characters "()'&" {}\! and translate uppercase to lowercase
   8.115 +fix_filename()
   8.116 +{
   8.117 +	ls /tmp/burn-cd/* | while read file
   8.118 +	do
   8.119 +    	mv "$file" `echo $file | tr ' ' '_' | tr -d '[{}(),\!&]' | tr -d "\'" | tr '[A-Z]' '[a-z]' | sed 's/_-_/_/g' `
   8.120 +	done 
   8.121 +	
   8.122 +}
   8.123 +
   8.124 +# We must think about " space " between directory/track and
   8.125 +# filter directory copy to avoid copying other files than audio.
   8.126 +# Only burning non-compressed wav format is supported directly.
   8.127 +
   8.128 +copy_audio_file()
   8.129 +{
   8.130 +	if ls "$NEW_TRACK" | grep -q .ogg; then
   8.131 +		cp "${NEW_TRACK%.ogg}.ogg" $TMPDIR
   8.132 +		fix_filename	
   8.133 +		decode_ogg 
   8.134 +	elif ls "$NEW_TRACK" | grep -q ".[m\|M][p\|P]3"; then
   8.135 +	  #	cp "${NEW_TRACK%.mp3}.mp3" $TMPDIR	
   8.136 +		cp "$NEW_TRACK" "$TMPDIR"	
   8.137 +		fix_filename
   8.138 +		decode_mp3
   8.139 +	else
   8.140 +		cp "${NEW_TRACK%.wav}.wav" $TMPDIR
   8.141 +	fi
   8.142 +}
   8.143 +
   8.144 +
   8.145 +copy_audio_dir()
   8.146 +{
   8.147 +	
   8.148 +	for i in .wav .ogg .mp3
   8.149 +	do
   8.150 +		cp "$NEW_DIR"/*$i $TMPDIR 2>/dev/null
   8.151 +	done
   8.152 +	fix_filename 
   8.153 +	decode_ogg  
   8.154 +	decode_mp3 
   8.155 +}
   8.156 +
   8.157 +# Only burning mpg video format is supported directly. MPEG-1 video for vcd and MPEG-2 for svcd and dvd
   8.158 +copy_video_file()
   8.159 +{
   8.160 +	if ls "$NEW_TRACK" | grep -q ".mpg\|.mpeg"; then
   8.161 +		cp "${NEW_TRACK%.mp*}.mpg" $TMPDIR
   8.162 +	elif ls "$NEW_TRACK" | grep -q ".avi\|.mov\|.wmv\|.flv"; then
   8.163 +	 	ext=`echo "${NEW_TRACK##*.}"`
   8.164 +		cp "${NEW_TRACK%.$ext}.$ext" $TMPDIR
   8.165 +		fix_filename
   8.166 +		if "$CHECKBOX_DECODE" ; then decode_video ; fi
   8.167 +	else
   8.168 +		echo "mpg format supported"
   8.169 +	fi
   8.170 +}
   8.171 +
   8.172 +copy_video_dir()
   8.173 +{
   8.174 +	for i in .mpg .avi .mov .wmv .mpeg .flv
   8.175 +	do
   8.176 +		cp "$NEW_DIR"/*$i $TMPDIR 2>/dev/null
   8.177 +	done
   8.178 +	fix_filename 	
   8.179 +	if "$CHECKBOX_DECODE" ; then decode_video ; fi
   8.180 +}
   8.181 +
   8.182 +copy_file()
   8.183 +{
   8.184 +	case "$BURN_MODE" in
   8.185 +			audio-cd) 
   8.186 +				copy_audio_file ;;
   8.187 +			vcd|svcd|video-dvd)
   8.188 +				copy_video_file ;;	
   8.189 +			*)	
   8.190 +				cp "$NEW_TRACK" $TMPDIR ; fix_filename ;;
   8.191 +	esac
   8.192 +	
   8.193 +}
   8.194 +
   8.195 +copy_dir()
   8.196 +{
   8.197 +	case "$BURN_MODE" in
   8.198 +			audio-cd) 
   8.199 +				copy_audio_dir ;;
   8.200 +			vcd|svcd|video-dvd)
   8.201 +				copy_video_dir ;;	
   8.202 +			*)	
   8.203 +				cp "$NEW_DIR" $TMPDIR 2>/dev/null 
   8.204 +				fix_filename ;;
   8.205 +	esac		
   8.206 +}
   8.207 +# =====ISO=====
   8.208 +burn_iso()
   8.209 +{
   8.210 +	xterm -geometry 80x16 -title "Wodim" \
   8.211 +		-e "wodim -v speed=$SPEED dev=$DEVICE $OPTIONS '$ISO_IMAGE'; sleep 4			
   8.212 +		"
   8.213 +}
   8.214 +# =====AUDIO=====
   8.215 +# Use -pad to avoid file size error.
   8.216 +burn_audio()
   8.217 +{
   8.218 +
   8.219 +	install "cdrkit"
   8.220 +	xterm -geometry 80x16 -title "Wodim:AUDIO" \
   8.221 +			-e " echo \"BURN TYPE SELECTED = $BURN_MODE \"; sleep 1;				
   8.222 +			 wodim -v speed=$SPEED dev=$DEVICE $OPTIONS -pad -dao -audio $TMPDIR/*.wav; sleep 4 
   8.223 +			 
   8.224 +		"
   8.225 +}
   8.226 +# =====DATA=====
   8.227 +burn_cddata()
   8.228 +{
   8.229 +	
   8.230 +	install "cdrkit"
   8.231 +
   8.232 +	xterm -geometry 80x16 -title "Wodim:CD DATA" \
   8.233 +			-e " echo \"BURN TYPE SELECTED = $BURN_MODE \"; sleep 1;
   8.234 +				wodim -v speed=$SPEED dev=$DEVICE $OPTIONS -pad -dao -data $TMPDIR/*; sleep 4 
   8.235 +				
   8.236 +			"
   8.237 +				
   8.238 +}
   8.239 +
   8.240 +burn_dvddata()
   8.241 +{
   8.242 +	# For multisession support, remove --dvd-compat option
   8.243 +	install "dvd+rw-tools"
   8.244 +
   8.245 +	xterm -geometry 80x16 -title "growisofs:DVD DATA" \
   8.246 +			-e " echo \"BURN TYPE SELECTED = $BURN_MODE \"; sleep 1;
   8.247 +				# no iso-file available
   8.248 +				growisofs -dvd-compat -speed=$SPEED -pad -J -r -f -Z  $DEVICE  $TMPDIR/*; sleep 4	
   8.249 +				"
   8.250 +}
   8.251 +
   8.252 +# ====VIDEO=====
   8.253 +burn_dvdvideo()
   8.254 +{
   8.255 +
   8.256 +	install "dvd+rw-tools"
   8.257 +	
   8.258 +	# current assumption: compatible dvd-video format
   8.259 +	xterm -geometry 80x16 -title "growisofs:DVD VIDEO" \
   8.260 +			-e " echo \"BURN TYPE SELECTED = $BURN_MODE\"; sleep 1;    
   8.261 +			   	 growisofs -dvd-video -udf -pad -J -r -f -Z $DEVICE -speed=$SPEED  $TMPDIR/*; sleep 2
   8.262 +				"	
   8.263 +		
   8.264 +}
   8.265 +
   8.266 +burn_vcd()
   8.267 +{
   8.268 +	
   8.269 +	install "vcdimager"
   8.270 +
   8.271 +	mkdir -p $TMPDIR/vcd
   8.272 +		xterm -geometry 80x16 -title "vcdimager:VCD" \
   8.273 +			-e " echo \"BURN TYPE SELECTED = $BURN_MODE $UNINSTALLED \"; sleep 1;
   8.274 +			   	 vcdimager -t vcd2 -l VCD -c $TMPDIR/vcd/vcd.cue -b $TMPDIR/vcd/vcd.bin $TMPDIR/*.mpg; sleep 2; 
   8.275 +				# cdrdao write --device $DEVICE $TMPDIR/vcd/vcd.cue; sleep 2
   8.276 +				  wodim -v speed=$SPEED dev=$DEVICE $OPTIONS -pad -dao cuefile=$TMPDIR/vcd/vcd.cue ; sleep 2				
   8.277 +				"	
   8.278 +	
   8.279 +		
   8.280 +}
   8.281 +
   8.282 +burn_svcd()
   8.283 +{
   8.284 +	
   8.285 +	install "vcdimager"
   8.286 +
   8.287 +	mkdir -p $TMPDIR/svcd
   8.288 +		xterm -geometry 80x16 -title "vcdimager:SVCD" \
   8.289 +			-e " echo \"BURN TYPE SELECTED = $BURN_MODE\"
   8.290 +				  vcdimager -t svcd -l SVCD -c $TMPDIR/svcd/svcd.cue -b $TMPDIR/svcd/svcd.bin $TMPDIR/*.mpg; sleep 2; 
   8.291 +				 # cdrdao write --device $DEVICE $TMPDIR/svcd/svcd.cue; sleep 2;
   8.292 +				 wodim -v speed=$SPEED dev=$DEVICE $OPTIONS -pad -dao cuefile=$TMPDIR/svcd/svcd.cue ; sleep 2
   8.293 +				"	
   8.294 +	
   8.295 +}
   8.296 +
   8.297 +# =====CLONE=====
   8.298 +
   8.299 +rip_disc()
   8.300 +{
   8.301 +	SUGGESTED="cdrkit-isoinfo"
   8.302 +	if ! "$CHECKBOX_FOLDER" ; then SAVE_DISC="/tmp/burn-cd" ; fi	
   8.303 +	if [ -d /var/lib/tazpkg/installed/${SUGGESTED} ]; then
   8.304 +		xterm -geometry 80x16 -title "dd" \
   8.305 +			-e ' echo "RIPPING DISC $DEVICE AT $SAVE_DISC..."
   8.306 +				 COUNT=`isoinfo -d -i $DEVICE | grep "^Volume size is:" | cut -d " " -f 4`
   8.307 +				 BLOCK=`isoinfo -d -i $DEVICE | grep "^Logical block size is:" | cut -d " " -f 5`
   8.308 +				 dd if=$DEVICE of=$SAVE_DISC/image.iso bs=$BLOCK count=$COUNT; sleep 4
   8.309 +				 sleep 2;
   8.310 +				# eject ;
   8.311 +			   '
   8.312 +	else 
   8.313 +		xterm -geometry 80x16 -title "dd" \
   8.314 +			-e '   echo "Though you dont have the cdrkit-isoinfo package installed, \
   8.315 +				          you can still rip but it may be slower."
   8.316 +					echo -n "Would you like to continue (y/N)? : "; read ans
   8.317 +					if [ "$ans" = "y" ]; then 
   8.318 +						echo "RIPPING DISC $DEVICE AT $SAVE_DISC...."
   8.319 +						dd if=$DEVICE of=$SAVE_DISC/image.iso; 
   8.320 +						sleep 2;
   8.321 +						#eject ;
   8.322 +					fi
   8.323 +				'
   8.324 +	fi	
   8.325 +	if ! "$CHECKBOX_FOLDER" ; then 
   8.326 +				ISO_IMAGE="/tmp/burn-cd/image.iso"
   8.327 +				xterm -geometry 80x16 -title "dd" \
   8.328 +			-e ' echo -e " ---Please insert EMPTY DISC at $DEVICE ---\n ---press ENTER to continue..." && read close;'
   8.329 +				burn_iso
   8.330 +	fi
   8.331 +}
   8.332 +
   8.333 +blank_dvd()
   8.334 +{
   8.335 +	xterm -geometry 80x16 -title "growisofs:DVD ERASE" \
   8.336 +		-e "growisofs -Z $DEVICE=/dev/zero"
   8.337 +}
   8.338 +
   8.339 +burn_disc()
   8.340 +{
   8.341 +  	case "$BURN_MODE" in
   8.342 +			audio*)
   8.343 +				burn_audio ;;
   8.344 +			data-cd*)
   8.345 +				burn_cddata ;;
   8.346 +			data-dvd*)
   8.347 +				burn_dvddata;;
   8.348 +			video*)
   8.349 +				burn_dvdvideo;;
   8.350 +			vcd*)
   8.351 +				burn_vcd;;
   8.352 +			svcd*)
   8.353 +				burn_svcd;;			
   8.354 +	esac
   8.355 +		
   8.356 +}
   8.357 +
   8.358 +track_list()
   8.359 +{
   8.360 +	for file in `ls $TMPDIR` ; do
   8.361 +		track_size=`du -m $TMPDIR/$file | awk '{print $1}'`
   8.362 +		echo "$file | $track_size"	
   8.363 +	done
   8.364 +}
   8.365 +
   8.366 +export BIN=$0
   8.367 +# Main GTK interface
   8.368 +MAIN_DIALOG='
   8.369 +<window title="SliTaz - Burnbox" icon-name="drive-optical">
   8.370 +<vbox>
   8.371 +
   8.372 +	<notebook labels=" Burn CD/DVD (Audio,Video,Data)| Backup Disc| Burn ISO | Help/Settings">
   8.373 +	
   8.374 +	<vbox>	
   8.375 +		<tree icon_name="audio-x-generic">
   8.376 +			<width>500</width><height>200</height>
   8.377 +			<variable>TRACKS_LIST</variable>
   8.378 +			<label>Track name (Double-click to remove a track) | Track Size (Mb)</label>
   8.379 +			<input>$BIN track_list</input>
   8.380 +			<action>rm "/tmp/burn-cd/$TRACKS_LIST"</action>
   8.381 +			<action>refresh:TRACKS_LIST</action>
   8.382 +			<action>refresh:TRACKS_SIZE</action>
   8.383 +		</tree>'
   8.384 +		
   8.385 +# Select burn audio-cd, data-cd, dvd-video or vcd/svcd		
   8.386 +MAIN_DIALOG=${MAIN_DIALOG}'
   8.387 +   <frame>
   8.388 +		  <hbox>
   8.389 +		   <text>
   8.390 +				<label> Select Burn type: </label>
   8.391 +			</text>
   8.392 +			<combobox>'
   8.393 +			tmp2="${MAIN_DIALOG}"
   8.394 +			for i in audio-cd data-cd data-dvd video-dvd vcd svcd; do
   8.395 +					[ "$i" = "$BURN_MODE" ] || tmp2="$tmp2<item>$i</item>"
   8.396 +			done
   8.397 +			tmp3='
   8.398 +			<variable>BURN_MODE</variable>						
   8.399 +			</combobox>
   8.400 +			<checkbox>
   8.401 +				<label> Enable decoding video</label>
   8.402 +				<variable>CHECKBOX_DECODE</variable>
   8.403 +				<default>true</default>											
   8.404 +			</checkbox>
   8.405 +			</hbox>
   8.406 +			'
   8.407 +MAIN_DIALOG="$tmp2$tmp3"
   8.408 +# Select, add and burn audio buttons.
   8.409 +MAIN_DIALOG=${MAIN_DIALOG}"
   8.410 +		<hbox>
   8.411 +			<text>
   8.412 +				<label> File:     </label>
   8.413 +			</text>
   8.414 +			<entry accept=\"filename\">
   8.415 +				<label>Select an Audio/Video/data track</label>
   8.416 +				<variable>NEW_TRACK</variable>
   8.417 +			</entry>
   8.418 +			<button>
   8.419 +			    <label>Browse</label>
   8.420 +				<input file stock=\"gtk-open\"></input>
   8.421 +				<action type=\"fileselect\">NEW_TRACK</action>
   8.422 +			</button>
   8.423 +			<button>
   8.424 +				<label>Add</label>
   8.425 +				<input file stock=\"gtk-add\"></input>
   8.426 +				<action>$0 copy_file</action>
   8.427 +				<action>refresh:TRACKS_LIST</action>
   8.428 +				<action>refresh:TRACKS_SIZE</action>				
   8.429 +			</button>
   8.430 +		</hbox>
   8.431 +		<hbox>
   8.432 +			<text>
   8.433 +				<label> Folder:</label>
   8.434 +			</text>
   8.435 +			<entry accept=\"directory\">
   8.436 +				<label>Select an Audio/Video/Data track</label>
   8.437 +				<variable>NEW_DIR</variable>
   8.438 +			</entry>
   8.439 +			<button>
   8.440 +			    <label>Browse</label>
   8.441 +				<input file stock=\"gtk-open\"></input>
   8.442 +				<action type=\"fileselect\">NEW_DIR</action>
   8.443 +			</button>
   8.444 +			<button>
   8.445 +				<label>Add</label>
   8.446 +				<input file stock=\"gtk-add\"></input>
   8.447 +				<action>$0 copy_dir</action>
   8.448 +				<action>refresh:TRACKS_LIST</action>
   8.449 +				
   8.450 +				<action>refresh:TRACKS_SIZE</action>
   8.451 +			</button>
   8.452 +		</hbox>"
   8.453 +
   8.454 +MAIN_DIALOG=${MAIN_DIALOG}"
   8.455 +		<hbox>
   8.456 +			<text>
   8.457 +				<variable>TRACKS_SIZE</variable>
   8.458 +				<input>$0 audio_cd_stats</input>
   8.459 +			</text>
   8.460 +			<button>
   8.461 +				<label>Clean</label>
   8.462 +				<input file stock=\"gtk-clear\"></input>
   8.463 +				<action>rm -rf $TMPDIR/*</action>
   8.464 +				<action>refresh:TRACKS_LIST</action>
   8.465 +				<action>refresh:TRACKS_SIZE</action>
   8.466 +				<action>clear:NEW_TRACK</action>
   8.467 +				<action>clear:NEW_DIR</action>
   8.468 +			</button>
   8.469 +			<button>
   8.470 +				<label>Burn disc</label>
   8.471 +				<input file icon=\"forward\"></input>
   8.472 +				<action>$0 burn_disc</action>
   8.473 +			</button>
   8.474 +		</hbox>
   8.475 +		</frame>
   8.476 +	</vbox> "
   8.477 +
   8.478 +# Backup CD
   8.479 +MAIN_DIALOG=${MAIN_DIALOG}'	
   8.480 +<vbox>	
   8.481 +	
   8.482 +		<text use-markup="true"> 
   8.483 +			<label>
   8.484 +			"
   8.485 +<b>Choose either the Data or the Audio CD backup frame </b>
   8.486 +"
   8.487 +		</label>
   8.488 +		</text> 
   8.489 +	
   8.490 + <frame Data CD/DVD backup >
   8.491 +   <text>
   8.492 +		<label> 
   8.493 +			"  " 
   8.494 +		</label>
   8.495 +	</text>
   8.496 +			<checkbox>
   8.497 +				<label>Save backup on Hard Disk Folder (Unselect to backup on CD disc)</label>
   8.498 +				<variable>CHECKBOX_FOLDER</variable>
   8.499 +				<default>true</default>
   8.500 +				<action>if true enable:SAVE_DISC</action>
   8.501 +				<action>if true enable:OPENBUTTON</action>
   8.502 +				<action>if false disable:SAVE_DISC</action>
   8.503 +				<action>if false disable:OPENBUTTON</action>				
   8.504 +			</checkbox>
   8.505 +			<hbox>
   8.506 +				<text use-markup="true">
   8.507 +					<label>"      Backup Folder Path:"</label>
   8.508 +				</text>
   8.509 +				<entry accept="directory">
   8.510 +				<label>Select a folder to save cloned disc to</label>
   8.511 +					<variable>SAVE_DISC</variable>
   8.512 +				</entry>
   8.513 +				<button>
   8.514 +				    <label>Browse</label>
   8.515 +					<input file stock="gtk-open"></input>
   8.516 +					<variable>OPENBUTTON</variable>
   8.517 +					<action type="fileselect">SAVE_DISC</action>
   8.518 +				</button>	
   8.519 +				</hbox>				
   8.520 +'
   8.521 +# Burn backup button.
   8.522 +MAIN_DIALOG=${MAIN_DIALOG}"
   8.523 +			<hbox>
   8.524 +			<text>
   8.525 +				<label>\"Proceed to backup your data CD: \" 	</label>
   8.526 +			</text>
   8.527 +			<button>
   8.528 +					<label>Backup DataCD</label>
   8.529 +					<variable>DATA_RIP</variable>
   8.530 +					<input file icon=\"forward\"></input>
   8.531 +					<action>$0 rip_disc</action>
   8.532 +				</button>
   8.533 +			</hbox>
   8.534 +			</frame>"			
   8.535 +MAIN_DIALOG=${MAIN_DIALOG}'		
   8.536 +	<frame Audio CD backup>	
   8.537 +		<text>
   8.538 +			<label> 
   8.539 +				"  " 
   8.540 +			</label>
   8.541 +		</text> 			 				
   8.542 +			<hbox>
   8.543 +			<text>
   8.544 +				<label> "Proceed to clone your audio CD:"</label>
   8.545 +			</text>
   8.546 +				<button>					
   8.547 +				<label> Backup AudioCD</label>
   8.548 +				<variable>AUDIO_RIP</variable>
   8.549 +				<input file icon="forward"></input>
   8.550 +				<action>asunder</action>
   8.551 +				</button>
   8.552 +	        </hbox>
   8.553 + </frame>
   8.554 +		
   8.555 +	</vbox>'
   8.556 +	
   8.557 +MAIN_DIALOG=${MAIN_DIALOG}'
   8.558 +	<vbox>
   8.559 +		<text use-markup="true"> 
   8.560 +			<label>
   8.561 +			"			 
   8.562 +			"
   8.563 +		</label>
   8.564 +		</text> 
   8.565 +		<frame Select ISO and burn>		
   8.566 +		<hbox>
   8.567 +		  <text>
   8.568 +		<label> 
   8.569 +			"  	" 
   8.570 +		</label>
   8.571 +		</text>
   8.572 +				<text use-markup="true">
   8.573 +					<label>"<b>ISO path:</b>"</label>
   8.574 +				</text>
   8.575 +				<entry>
   8.576 +					<variable>ISO_IMAGE</variable>
   8.577 +				</entry>
   8.578 +				<button>
   8.579 +				    <label>Browse</label>
   8.580 +					<input file stock="gtk-open"></input>
   8.581 +					<action type="fileselect">ISO_IMAGE</action>
   8.582 +				</button>
   8.583 +			</hbox>
   8.584 +			'
   8.585 +# Burn iso button.
   8.586 +MAIN_DIALOG=${MAIN_DIALOG}"
   8.587 +			<hbox>
   8.588 +				<button>
   8.589 +					<label>Burn ISO</label>
   8.590 +					<input file icon=\"forward\"></input>
   8.591 +					<action>$0 burn_iso</action>
   8.592 +				</button>
   8.593 +			</hbox>
   8.594 +			</frame>
   8.595 +			</vbox>"
   8.596 +
   8.597 +	
   8.598 +
   8.599 +#
   8.600 +#				
   8.601 +# tmp3=	
   8.602 +MAIN_DIALOG=${MAIN_DIALOG}'
   8.603 +	<vbox>
   8.604 +		<frame Information>
   8.605 +		
   8.606 +			<text width_request="250" use-markup="true">
   8.607 +				<label>
   8.608 +"Burnbox burns ISOs, backs up CD/DVDs, burns data CD/DVDs, audio CDs and video CDs (VCD/SVCD)
   8.609 +"
   8.610 +				</label>				
   8.611 +			</text>
   8.612 +			<hbox>
   8.613 +				<text use-markup="true">
   8.614 +					<label> "<b> Please consult HELP file if needed:  </b>"	</label>
   8.615 +				</text>
   8.616 +			  <button>
   8.617 +					<input file icon="help"></input>
   8.618 +					<action> browser file:///usr/share/doc/slitaz-tools/burnbox.html </action>
   8.619 +				</button>
   8.620 +				</hbox>
   8.621 +			
   8.622 +		</frame>
   8.623 +		<frame Settings>
   8.624 +		<text>
   8.625 +				<label>
   8.626 +"Before burning, please verify/change device writer settings below if needed.
   8.627 +"
   8.628 +				</label>
   8.629 +		</text>
   8.630 +		
   8.631 +			<hbox>
   8.632 +				<text use-markup="true">
   8.633 +					<label>"<b>Device:     </b>"</label>
   8.634 +				</text>
   8.635 +				<entry>
   8.636 +					<default>/dev/cdrom</default>
   8.637 +					<variable>DEVICE</variable>
   8.638 +				</entry>
   8.639 +			</hbox>
   8.640 +			<hbox>
   8.641 +				<text use-markup="true">
   8.642 +					<label>"<b>Speed:     </b>"</label>
   8.643 +				</text>
   8.644 +				<entry>
   8.645 +					<input>cat /proc/sys/dev/cdrom/info | grep "drive speed" | cut -f 3</input>
   8.646 +					<variable>SPEED</variable>
   8.647 +				</entry>
   8.648 +			</hbox>
   8.649 +			<hbox>
   8.650 +				<text use-markup="true">
   8.651 +					<label>"<b>Options:  </b>"</label>
   8.652 +				</text>
   8.653 +				<entry>
   8.654 +					<default>-eject -multi</default>
   8.655 +					<variable>OPTIONS</variable>
   8.656 +				</entry>
   8.657 +				<button>
   8.658 +					<input file icon="help"></input>
   8.659 +					<action>xterm -sb -geometry 95x25 -title "wodim help" -e "wodim --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
   8.660 +				</button>
   8.661 +			</hbox>	'
   8.662 +			
   8.663 +	   MAIN_DIALOG=${MAIN_DIALOG}'		
   8.664 +		</frame>
   8.665 +		<frame Blank CD/DVD-RW>
   8.666 +			<hbox>
   8.667 +				<text use-markup="true">
   8.668 +					<label>"<b>Option:   </b>"</label>
   8.669 +				</text>
   8.670 +				<entry>
   8.671 +					<variable>BLANK_OPTS</variable>
   8.672 +					<default>fast</default>
   8.673 +				</entry>
   8.674 +				<button>
   8.675 +					<input file icon="help"></input>
   8.676 +					<action>xterm -geometry 80x16 -title "wodim blank=help" -e "wodim blank=help ; echo -e \"----\nENTER to continue...\" && read close"</action>
   8.677 +				</button>
   8.678 +				<button>
   8.679 +					<label>Blank disc</label>
   8.680 +					<input file icon="forward"></input>
   8.681 +					<action>xterm -title "Wodim" -e "wodim -v -blank=$BLANK_OPTS dev=$DEVICE; sleep 2"</action>
   8.682 +				</button>
   8.683 +			</hbox>
   8.684 +		</frame>
   8.685 +	</vbox>'
   8.686 +export MAIN_DIALOG=${MAIN_DIALOG}'
   8.687 +	
   8.688 +	</notebook>' 
   8.689 +	MAIN_DIALOG=${MAIN_DIALOG}"<hbox>
   8.690 +			<button>				
   8.691 +					<input file icon=\"dialog-information\"></input>
   8.692 +					<label> Check Permissions for Device</label>
   8.693 +					<action>$0 chk_rw_permissions</action>
   8.694 +				</button> 
   8.695 +				"
   8.696 +	MAIN_DIALOG=${MAIN_DIALOG}'
   8.697 +			<button>
   8.698 +			<label>Exit</label>
   8.699 +			<input file icon="exit"></input>
   8.700 +			<action type="exit">Exit</action>
   8.701 +		</button>
   8.702 +	</hbox>
   8.703 +	
   8.704 +</vbox>
   8.705 +</window>
   8.706 +'
   8.707 +
   8.708 +# Script can be called with an arg to exec a function.
   8.709 +if [ -n "$1" ]; then
   8.710 +	$1
   8.711 +else
   8.712 +	mkdir -p $TMPDIR
   8.713 +	gtkdialog --center --program=MAIN_DIALOG >/dev/null
   8.714 +	rm -rf $TMPDIR
   8.715 +fi
   8.716 +
   8.717 +exit 0
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/oldstuff/gtkdialog/burnbox-doc.desktop	Sat Apr 28 20:16:24 2012 +0200
     9.3 @@ -0,0 +1,9 @@
     9.4 +[Desktop Entry]
     9.5 +Encoding=UTF-8
     9.6 +Name=Burnbox manual
     9.7 +Name[pt]=Manual do Burnbox
     9.8 +Name[pt_BR]=Manual do Burnbox
     9.9 +Exec=browser file:///usr/share/doc/slitaz-tools/burnbox.html
    9.10 +Icon=text-html
    9.11 +Type=Application
    9.12 +Categories=Documentation;
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/oldstuff/gtkdialog/burnbox.desktop	Sat Apr 28 20:16:24 2012 +0200
    10.3 @@ -0,0 +1,11 @@
    10.4 +[Desktop Entry]
    10.5 +Encoding=UTF-8
    10.6 +Name=Burn CD/DVD
    10.7 +Name[fr]=Graver des CD ou DVD
    10.8 +Name[pt]=Gravador de CD/DVD
    10.9 +Name[pt_BR]=Gravador de CD/DVD
   10.10 +Comment=Burn ISO images or audio tracks to CD or DVD
   10.11 +Exec=burnbox
   10.12 +Icon=drive-optical
   10.13 +Type=Application
   10.14 +Categories=GTK;Utility;
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/oldstuff/gtkdialog/burnbox.en.html	Sat Apr 28 20:16:24 2012 +0200
    11.3 @@ -0,0 +1,119 @@
    11.4 +<!DOCTYPE html>
    11.5 +<html xmlns="http://www.w3.org/1999/xhtml">
    11.6 +<head>
    11.7 +	<title>Burnbox Manual</title>
    11.8 +	<meta charset="utf-8" />
    11.9 +	<link rel="stylesheet" type="text/css" href="style.css" />
   11.10 +</head>
   11.11 +<body>
   11.12 +
   11.13 +<div id="header">
   11.14 +	<h1>SliTaz Burnbox Manual</h1>
   11.15 +</div>
   11.16 +
   11.17 +<!-- Start content -->
   11.18 +<div id="content">
   11.19 +
   11.20 +<h3>About</h3>
   11.21 +<p>
   11.22 +Burnbox supports:
   11.23 +</p>
   11.24 +<ul>
   11.25 +	<li>ISO burning</li>
   11.26 +	<li>Backup of data and audio CDs</li>
   11.27 +	<li>Data CD/DVD burning (DVD burning requires an optional package <em>dvd+rw-tools</em>)</li>
   11.28 +	<li>Audio CD burning (MP3 requires an optional package <em>mpg123</em>)</li>
   11.29 +	<li>Video CD (VCD/SVCD) burning (requires packages <em>vcdimager</em> and <em>ffmpeg</em>)</li>
   11.30 +</ul>
   11.31 +
   11.32 +<h3>General Device Settings</h3>
   11.33 +<p>
   11.34 +In the last tab, make sure the cdrom settings are correct (Device:/dev/cdrom; Speed (auto-detected): 48; Options: ). 
   11.35 +Input is taken from the DEVICE settings.
   11.36 +</p>
   11.37 +
   11.38 +<h3>Blank CD/DVD-RW</h3>
   11.39 +<p>
   11.40 +Use <code>Blank disk</code> to erase contents and prepare for burning.
   11.41 +</p>
   11.42 +
   11.43 +<h3>Iso Burning</h3>
   11.44 +<p>
   11.45 +This is supported in the third tab.
   11.46 +</p>
   11.47 +<ul>
   11.48 +	<li>Press button <code>Browse</code> to specify the iso file path</li>
   11.49 +	<li>Press button <code>Burn ISO</code></li>
   11.50 +</ul>
   11.51 +<p>
   11.52 +You can also create or manipulate ISO images with the ISO Master utility.
   11.53 +</p>
   11.54 +
   11.55 +<h3>Backup of data and audio CD</h3>
   11.56 +<p>
   11.57 +This is supported in the second tab. Optional package <em>cdrkit-isoinfo</em> may help to improve the burn speed. 
   11.58 +</p>
   11.59 +<ul>
   11.60 +	<li>Insert CD</li>
   11.61 +	<li>Select backup option: "Save backup on Hard Disk Folder" (default) or "Backup on CD disc"</li>
   11.62 +	<li>If backup option is "Save backup on Hard Disk Folder" (default), then specify the folder to do a "CD/DVD backup"</li>
   11.63 +	<li>Press button <code>Backup DataCD</code></li>
   11.64 +</ul>
   11.65 +<p>
   11.66 +Audio CD ripping is supported using the asunder package. 
   11.67 +</p>
   11.68 +
   11.69 +<h3>Data CD/DVD burning</h3>
   11.70 +<p>
   11.71 +This is supported in the First tab. One can specify the burn type before adding files. 
   11.72 +Depending upon the burn type, the files are decoded on the fly. 
   11.73 +One can remove the added files by simply double-clicking on the file in the tree view. 
   11.74 +Total track size shows the CD/DVD space occupied.
   11.75 +</p>
   11.76 +
   11.77 +<ul>
   11.78 +	<li>Select data-cd in Burn Type</li>
   11.79 +	<li>Specify file/folder or <code>Browse</code></li>
   11.80 +	<li>Press button <code>Add</code></li>
   11.81 +	<li>Press button <code>Burn Disc</code></li>
   11.82 +</ul>
   11.83 +
   11.84 +<h3>Audio CD burning</h3>
   11.85 +<p>
   11.86 +This is supported in the first tab. WAV, OGG, MP3 files are supported. 
   11.87 +OGG and MP3 are automatically converted into an uncompressed WAV format for burning.
   11.88 +</p>
   11.89 +<ul>
   11.90 +	<li>Select audio-cd in Burn Type</li>
   11.91 +	<li>Specify file/folder or <code> Browse</code></li>
   11.92 +	<li>Press button <code> Add</code> to auto-decode to uncompressed WAV (OGG, MP3 are decoded)</li>
   11.93 +	<li>Press button <code> Burn Disc</code></li>
   11.94 +</ul>
   11.95 +
   11.96 +<h3>Video CD (VCD/SVCD) burning</h3>
   11.97 +<p>
   11.98 +This is supported in the first tab. Only burning mpg video format is supported directly: MPEG-1 video for vcd and MPEG-2 for svcd and dvd. 
   11.99 +AVI, MOV, FLV, WMV videos are automatically converted into a VCD/SVCD/DVD compatible mpg video format.
  11.100 +</p>
  11.101 +<ul>
  11.102 +	<li>Select video-dvd, vcd or svcd in Burn Type</li>
  11.103 +	<li>Specify file/folder or <code>Browse</code></li>
  11.104 +	<li>Press button <code>Add</code> and select Enable decoding video for MPG files (AVI, FLV, MOV, WMV are decoded)</li>
  11.105 +	<li>Press button <code>Burn Disc</code></li>
  11.106 +</ul>
  11.107 +
  11.108 +<h3>Common Problems</h3>
  11.109 +<ul>
  11.110 +	<li>Burnbox works as root but not for a user: This happens when the user is not added to the "cdrom" group <pre>addgroup tux cdrom</pre></li>
  11.111 +	<li>Cdrom not readable / writable: Make sure the user has proper permissions and is added to the "cdrom" group</li>	
  11.112 +	<li>MP3 audio burn does not work: Check if you have installed <em>mpg123</em></li>
  11.113 +	<li>VCD option does not work: Check if you have installed <em>vcdimager</em></li>
  11.114 +	<li>AVI, FLV, WMV files are not decoded to MPG: Check if you have installed <em>ffmpeg</em></li>
  11.115 +	<li>DVD burn does not work: Check if you have installed <em>dvd+rw-tools</em></li>
  11.116 +</ul>
  11.117 +
  11.118 +<!-- End content -->
  11.119 +</div>
  11.120 +
  11.121 +</body>
  11.122 +</html>
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/oldstuff/gtkdialog/burnbox.fr.html	Sat Apr 28 20:16:24 2012 +0200
    12.3 @@ -0,0 +1,120 @@
    12.4 +<!DOCTYPE html>
    12.5 +<html xmlns="http://www.w3.org/1999/xhtml">
    12.6 +<head>
    12.7 +	<title>Documentation de Burnbox</title>
    12.8 +	<meta charset="utf-8" />
    12.9 +	<link rel="stylesheet" type="text/css" href="style.css" />
   12.10 +</head>
   12.11 +<body>
   12.12 +
   12.13 +<div id="header">
   12.14 +	<h1>Documentation de SliTaz Burnbox</h1>
   12.15 +</div>
   12.16 +
   12.17 +<!-- Start content -->
   12.18 +<div id="content">
   12.19 +
   12.20 +<h3>A propos</h3>
   12.21 +<p>
   12.22 +Possibilités de Burnbox:
   12.23 +</p>
   12.24 +<ul>
   12.25 +	<li>Gravure d'image ISO</li>
   12.26 +	<li>Sauvegarde de données et des CDs audio</li>
   12.27 +	<li>Enregistrement de données sur CD/DVD (la gravure sur DVD burning nécessite un paquet suplémentaire <em>dvd+rw-tools</em>)</li>
   12.28 +	<li>Enregistrement de CD Audio (pour les MP3 il faut installer <em>mpg123</em>)</li>
   12.29 +	<li>Enregistrement de CD Video (VCD/SVCD) (paquets requis: <em>vcdimager</em> et <em>ffmpeg</em>)</li>
   12.30 +</ul>
   12.31 +
   12.32 +<h3>Configuration générale des périphériques</h3>
   12.33 +<p>
   12.34 +Dans le dernier onglet, assurez-vous que les paramètres sont correctes (Pilote:/dev/cdrom; Vitess (auto-detected): 48; Options: ).
   12.35 +Les informations sont récupérées depuis la variable DEVICE.
   12.36 +</p>
   12.37 +
   12.38 +<h3>Effacer CD/DVD-RW</h3>
   12.39 +<p>
   12.40 +Utilisez <code>Blank disk</code> pour effacer un média.
   12.41 +</p>
   12.42 +
   12.43 +<h3>Graver une ISO</h3>
   12.44 +<p>
   12.45 +Cliquez sur le troisième onglet.
   12.46 +</p>
   12.47 +<ul>
   12.48 +	<li>Cliquez sur le bouton <code>Browse</code> pour rechercher l'image ISO'</li>
   12.49 +	<li>Cliquez sur le bouton <code>Burn ISO</code></li>
   12.50 +</ul>
   12.51 +<p>
   12.52 +Vous pouvez créér ou modifier des images ISO avec l'outil ISO Master.
   12.53 +</p>
   12.54 +
   12.55 +<h3>Sauvegarde de données et de CD audio</h3>
   12.56 +<p>
   12.57 +Ceci est pris en charge dans le deuxième onglet. Le paquet <em>cdrkit-isoinfo</em> (optionnel) peut vous aider à améliorer la vitesse d'enregistrement. 
   12.58 +</p>
   12.59 +<ul>
   12.60 +	<li>Insérez un CD</li>
   12.61 +	<li>Choisisse l'option: "Save backup on Hard disk" (par défaut) où "Backup on CD disc"</li>
   12.62 +	<li>Si l'option sélectionnée est "Save backup on Hard disk" (défaut), préciser le dossier à utiliser pour "CD/DVD backup"</li>
   12.63 +	<li>Cliquez sur le bouton <code>Backup DataCD</code></li>
   12.64 +</ul>
   12.65 +<p>
   12.66 +
   12.67 +l'extraction de CD audio est prise en charge en utilisant le paquet Asunder.
   12.68 +</p>
   12.69 +
   12.70 +<h3>Enregistrement des données sur CD/DVD</h3>
   12.71 +<p>
   12.72 +Ceci est pris en charge dans le premier onglet. On peut spécifier le type de gravure avant d'ajouter des fichiers.
   12.73 +Selon le type de gravure, les fichiers sont déchiffrés à la volée.
   12.74 +On peut supprimer les fichiers ajoutés simplement en double-cliquant sur le fichier dans l'arborescence.
   12.75 +La taille de la piste Total indique l'espace occupé sur le CD / DVD.
   12.76 +</p>
   12.77 +
   12.78 +<ul>
   12.79 +	<li>Choisissez data-cd dans Burn Type</li>
   12.80 +	<li>Indiquez le fichiers/dossier ou cliquez sur <code>Browse</code></li>
   12.81 +	<li>Cliquez sur le bouton <code>Add</code></li>
   12.82 +	<li>Cliquez sur le bouton <code>Burn Disc</code></li>
   12.83 +</ul>
   12.84 +
   12.85 +<h3>Enregistrement de CD audio</h3>
   12.86 +<p>
   12.87 +Ceci est pris en charge dans le premier onglet. les formats WAV, OGG, MP3 sont supportés.
   12.88 +Les fichiers OGG et MP3 sont automatiquement convertis et décompressé au format WAV pour la gravure.
   12.89 +</p>
   12.90 +<ul>
   12.91 +	<li>Choisissez audio-cd dans "Burn Type"</li>
   12.92 +	<li>Indiquez le fichiers/dossier ou cliquez sur <code>Browse</code></li>
   12.93 +	<li>Cliquez sur <code> Add</code> to auto-decode to uncompressed WAV (les fichiers OGG, MP3 sont décodés)</li>
   12.94 +	<li>Cliquez sur le bouton <code>Burn Disc</code></li>
   12.95 +</ul>
   12.96 +
   12.97 +<h3>Enregistrement de video sur CD (VCD/SVCD)</h3>
   12.98 +<p>
   12.99 +Ceci est pris en charge dans le premier onglet. Seul le format MPG est directement pris en charge: vidéo MPEG-1 pour VCD et MPEG-2 pour SVCD et DVD. 
  12.100 +Les formats AVI, MOV, FLV, WMV vidéos sont automatiquement converties en un VCD/SVCD/DVD compatible avec le format vidéo mpg.
  12.101 +</p>
  12.102 +<ul>
  12.103 +	<li>Sélectionnez ideo-dvd, vcd ou svcd dans Burn Type</li>
  12.104 +	<li>Indiquez le fichier/répertoire ou cliquez sur <code>Browse</code></li>
  12.105 +	<li>Cliquez sur le bouton <code>Add</code> et cochez "Enable decoding video" pour les fichiers MPG (AVI, FLV, MOV, WMV sont décodés)</li>
  12.106 +	<li>Cliquez sur le bouton <code>Burn Disc</code></li>
  12.107 +</ul>
  12.108 +
  12.109 +<h3>Problèmes fréquents</h3>
  12.110 +<ul>
  12.111 +	<li>Burnbox fonctionne uniquement avec le compte root: Cela arrive si l'utilisateur ne fait pas parti du group "cdrom"<pre>addgroup tux cdrom</pre></li>
  12.112 +	<li>Le cdrom n'est pas accessible en lecture ou écriture: Assurez-vous nque l'utilisateur à les bonnes permissions et qu'il edt bien membre du groupe "cdrom"</li>	
  12.113 +	<li>La gravure des fichiers MP3 ne fonctionne pas: Vérifiez si <em>mpg123</em> est installé</li>
  12.114 +	<li>Les options VCD ne fonctionnes pas: Installez <em>vcdimager</em></li>
  12.115 +	<li>Les fichiers AVI, FLV, WMV ne sont pas transcodés au format MPG: Vérifiez l'installation de <em>ffmpeg</em></li>
  12.116 +	<li>La gravure de DVD ne fonctionne pas: Vérifiez si vous avez installé <em>dvd+rw-tools</em></li>
  12.117 +</ul>
  12.118 +
  12.119 +<!-- End content -->
  12.120 +</div>
  12.121 +
  12.122 +</body>
  12.123 +</html>
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/oldstuff/gtkdialog/burnbox.html	Sat Apr 28 20:16:24 2012 +0200
    13.3 @@ -0,0 +1,1 @@
    13.4 +burnbox.en.html
    13.5 \ No newline at end of file
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/oldstuff/gtkdialog/burnbox.pt_BR.html	Sat Apr 28 20:16:24 2012 +0200
    14.3 @@ -0,0 +1,133 @@
    14.4 +<!DOCTYPE html>
    14.5 +<html xmlns="http://www.w3.org/1999/xhtml">
    14.6 +<head>
    14.7 +	<title>Manual do Burnbox</title>
    14.8 +	<meta charset="utf-8" />
    14.9 +	<link rel="stylesheet" type="text/css" href="style.css" />
   14.10 +</head>
   14.11 +<body>
   14.12 +
   14.13 +<div id="header">
   14.14 +	<h1>Manual do Burnbox (Aplicativo de Gravação de CD/DVD)</h1>
   14.15 +</div>
   14.16 +
   14.17 +<!-- Start content -->
   14.18 +<div id="content">
   14.19 +
   14.20 +<h3>Sobre</h3>
   14.21 +<p>
   14.22 +	O Burnbox suporta:
   14.23 +</p>
   14.24 +<ul>
   14.25 +	<li>Gravação de imagens ISO</li>
   14.26 +	<li>Backup de dados e CDs de áudio</li>
   14.27 +	<li>Gravação de dados em CD/DVD (A gravação em DVD requer o pacote opcional <em>dvd+rw-tools</em>)</li>
   14.28 +	<li>Gravação de CD de áudio (Para áudio MP3 é necessário o pacote <em>mpg123</em>)</li>
   14.29 +	<li>Gravação de Video CD (VCD/SVCD) (Requer os pacotes <em>vcdimager</em> e <em>ffmpeg</em>)</li>
   14.30 +</ul>
   14.31 +
   14.32 +<h3>Configurações de Dispositivo</h3>
   14.33 +<p>
   14.34 +Assegure-se de que o drive de cdrom está configurado corretamente 
   14.35 +na primeira aba do programa (device: /dev/cdrom, speed (auto-detected): 48;
   14.36 +Options: ). A entrada é definida a partir da configuração do DEVICE (dispositivo).
   14.37 +</p>
   14.38 +
   14.39 +<h3>Apagar CD/DVD-RW</h3>
   14.40 +<p>
   14.41 +Use a opção <code>Blank disk</code> para apagar o conteúdo de um cd ou
   14.42 +dvd regravável e prepará-lo para gravação.</p>
   14.43 +
   14.44 +<h3>Gravação de Imagens ISO</h3>
   14.45 +<p>
   14.46 +Utilize a segunda aba para gravações de imagem ISO.
   14.47 +</p>
   14.48 +<ul>
   14.49 +	<li>Clique no botão <code>Browse</code> para especificar a imagem iso</li>
   14.50 +	<li>Clique no botão <code>Burn ISO</code> para iniciar a gravação</li>
   14.51 +</ul>
   14.52 +<p>
   14.53 +Você pode criar ou manipular imagens ISO com o aplicativo ISO Master.
   14.54 +</p>
   14.55 +
   14.56 +<h3>Backup de dados e CD de áudio</h3>
   14.57 +<p>
   14.58 +Utilize a segunda aba. O pacote opcional <em>cdrkit-isoinfo</em> 
   14.59 +pode ajudar a aumentar as velocidades de gravação. 
   14.60 +</p>
   14.61 +<ul>
   14.62 +	<li>Coloque o  CD no drive</li>
   14.63 +	<li>Selecione a opção de backup: "Save backup on Hard disk" (default) ou "Backup on CD disc"</li>
   14.64 +	<li>Se você selecionar a opção "Save backup on Hard disk" (default), selecione a pasta para gravar o "CD/DVD backup"</li>
   14.65 +	<li>Clique no botão <code>Backup DataCD</code></li>
   14.66 +</ul>
   14.67 +<p>
   14.68 +A extração de faixas de áudio de CDs é possível com o aplicativo Asunder. 
   14.69 +</p>
   14.70 +
   14.71 +<h3>Gravação de CD/DVD de dados</h3>
   14.72 +<p>
   14.73 +Você encontra esta opção na terceira aba. Pode-se especificar o tipo de 
   14.74 +gravação antes de adiciona os arquivos. Dependendo do tipo de gravação
   14.75 +escolhido, os arquivos são decodificados durante a execução do programa.
   14.76 +Pode-se remover arquivos simplesmente clicando no nome do arquivo na
   14.77 +visão de pastas em árvore. A informação "total track size" mostra o
   14.78 +quanto o CD/DVD está ocupado.
   14.79 +</p>
   14.80 +
   14.81 +<ul>
   14.82 +	<li>Selecione "data-cd" em "Burn Type"</li>
   14.83 +	<li>Especifique "file/folder" ou <code>Browse</code></li>
   14.84 +	<li>Clique em <code>Add</code></li>
   14.85 +	<li>Clique em <code>Burn Disc</code></li>
   14.86 +</ul>
   14.87 +
   14.88 +<h3>Gravação de CDs de áudio</h3>
   14.89 +<p>
   14.90 +Você encontra esta opção na terceira aba. São suportados arquivos WAV, OGG
   14.91 +e MP3. OGG e MP3 são convertidos automaticamente em arquivos WAV sem
   14.92 +compressão para a gravação.
   14.93 +</p>
   14.94 +<ul>
   14.95 +	<li>Selecione "audio-cd" in "Burn Type"</li>
   14.96 +	<li>Especifique "file/folder" ou <code> Browse</code></li>
   14.97 +	<li>Clique em <code> Add</code> para decodificar arquivos OGG e MP3 em WAV</li>
   14.98 +	<li>Clique em <code> Burn Disc</code></li>
   14.99 +</ul>
  14.100 +
  14.101 +<h3>Gravação de Video CD (VCD/SVCD)</h3>
  14.102 +<p>
  14.103 +Você encontra esta opção na terceira aba. Somente a gravação de vídeos
  14.104 +no formato mpg são suportados diretamente: MPEG-1 para VCD e MPEG-2
  14.105 +para SVCD e DVD. Arquivos AVI, MOV, FLV e WMV são automaticamente 
  14.106 +convertidos para mpg compatível com VCD/SVCD/DVD.
  14.107 +</p>
  14.108 +<ul>
  14.109 +	<li>Selecione "data-cd" em "Burn Type"</li>
  14.110 +	<li>Especifique "file/folder" ou <code>Browse</code></li>
  14.111 +	<li>Clique em <code>Add</code> para decodificar AVI, FLV, MOV, WVM em MPG</li>
  14.112 +	<li>Clique em <code>Burn Disc</code></li>
  14.113 +</ul>
  14.114 +
  14.115 +<h3>Problemas comuns</h3>
  14.116 +<ul>
  14.117 +	<li>O Burnbox funciona com o usuário root mas não com um usuário comum:
  14.118 +        isto ocorre quando o usuário não se encontra no grupo "cdrom".
  14.119 +        Para resolver execute <code>addgroup usuário cdrom</code></li>
  14.120 +	<li>Mensagens "cdrom not readable / writable": Certifique-se de que
  14.121 +        o usuário possui as permissões necessárias e está no grupo "cdrom"</li>	
  14.122 +	<li>Gravação de áudio MP3 não funciona: verifique se o pacote 
  14.123 +        <em>mpg123</em> está instalado</li>
  14.124 +	<li>Opção VCD não funciona: verifique se o pacote <em>vcdimager</em>
  14.125 +        está instalado</li>
  14.126 +	<li>Arquivos AVI, FLV, WMV não são convertidos para MPG: verifique se
  14.127 +        o pacote <em>ffmpeg</em> está instalado</li>
  14.128 +	<li>Gravação de DVD não funciona: Verifique se o pacote <em>dvd+rw-tools</em>
  14.129 +        está instalado</li>
  14.130 +</ul>
  14.131 +
  14.132 +<!-- End content -->
  14.133 +</div>
  14.134 +
  14.135 +</body>
  14.136 +</html>
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/oldstuff/gtkdialog/libmountbox	Sat Apr 28 20:16:24 2012 +0200
    15.3 @@ -0,0 +1,675 @@
    15.4 +#!/bin/sh
    15.5 +#
    15.6 +# Libmountbox provides devices list in suitable format for GTK tree
    15.7 +# and various dialog boxes to mount, umount, etc.
    15.8 +#
    15.9 +# (C) 2009 - SliTaz GNU/Linux project.
   15.10 +#
   15.11 +
   15.12 +# Short usage.
   15.13 +usage()
   15.14 +{
   15.15 +	echo -e "\nUsage: $0 command\n
   15.16 +Output commands:
   15.17 +  list-mounted      List all mounted devices in a suitable GTK tree format.
   15.18 +  list-umounted     List all umounted in a suitable GTK tree format.
   15.19 +  create-file       Create an empty file with predefined size.
   15.20 +  add-old-crypto    Create loop-eas device.
   15.21 +  remove-crypto     Delete a crypto device.
   15.22 +  
   15.23 +GTKdialog boxes
   15.24 +  mounted-fs-infos  Display mounted devices info with actions.
   15.25 +  umounted-fs-infos Display umounted devices info with actions.
   15.26 +  remove-loop       Confirmation box.
   15.27 +  new-file          Parameter box for file creation.
   15.28 +  cryptomgr         Manage crypto device with devmapper.
   15.29 +  add-crypto        Pass phrase dialog.\n"
   15.30 +}
   15.31 +
   15.32 +# Format df -h output for GTK tree.
   15.33 +mounted_fs_data()
   15.34 +{
   15.35 +	SIZE=`echo $RES | cut -d " " -f 2`
   15.36 +	USED=`echo $RES | cut -d " " -f 3`
   15.37 +	AVAILABLE=`echo $RES | cut -d " " -f 4`
   15.38 +	PCT=`echo $RES | cut -d " " -f 5`
   15.39 +	MOUNTED_ON=`echo $RES | cut -d " " -f 6`
   15.40 +}
   15.41 +
   15.42 +# Update BLOCKS SIZE UUID TYPE LABEL variables
   15.43 +getdevinfo()
   15.44 +{
   15.45 +	local dev
   15.46 +	dev=${1#/dev/}
   15.47 +	BLOCKS=0
   15.48 +	if [ -f /sys/block/$dev/size ]; then
   15.49 +		BLOCKS=`cat /sys/block/$dev/size`
   15.50 +	elif [ -f /sys/block/*/$dev/size ]; then
   15.51 +		BLOCKS=`cat /sys/block/*/$dev/size`
   15.52 +	fi
   15.53 +	if [ $BLOCKS -gt 2097152 ]; then
   15.54 +		unit=G
   15.55 +		n=$(($BLOCKS * 10 / 2097152))
   15.56 +	elif [ $BLOCKS -gt 2048 ]; then
   15.57 +		unit=M
   15.58 +		n=$(($BLOCKS * 10 / 2048))
   15.59 +	else
   15.60 +		unit=K
   15.61 +		n=$(($BLOCKS * 5))
   15.62 +	fi
   15.63 +	SIZE=$(($n/10)).$(($n%10))$unit
   15.64 +	UUID=`blkid | grep ^/dev/$dev: | grep UUID= | sed 's/.*UUID=\"\([^\"]*\)\".*/\1/'`
   15.65 +	TYPE=`blkid | grep ^/dev/$dev: | grep TYPE= | sed 's/.*TYPE=\"\([^\"]*\)\".*/\1/'`
   15.66 +	LABEL=`blkid | grep ^/dev/$dev: | grep LABEL= | sed 's/.*LABEL=\"\([^\"]*\)\".*/\1/'`
   15.67 +}
   15.68 +
   15.69 +# Generate label for device manager
   15.70 +dmlabel()
   15.71 +{
   15.72 +	echo crypto-$(basename $1)
   15.73 +}
   15.74 +
   15.75 +unwrap()
   15.76 +{
   15.77 +awk '{
   15.78 +  if ($2 == "") last=$1;
   15.79 +  else {
   15.80 +    print last $0
   15.81 +    last=""
   15.82 +  }
   15.83 +}'
   15.84 +}
   15.85 +
   15.86 +case $1 in
   15.87 +	list-mounted)
   15.88 +		# List all fs found by: df -h
   15.89 +		#
   15.90 +		for dev in `df -h | grep ^/dev/ | cut -d " " -f 1`
   15.91 +		do
   15.92 +			RO='read-only'
   15.93 +			mount | grep $dev | grep -q '(rw' && RO=''
   15.94 +			RES=`df -h $dev | unwrap | grep ^$dev`
   15.95 +			mounted_fs_data
   15.96 +			echo "$dev | $SIZE | $USED | $AVAILABLE | $PCT | $MOUNTED_ON | $RO"
   15.97 +		done ;;
   15.98 +	list-umounted)
   15.99 +		# List all umounted fs found by: fdisk -l
  15.100 +		#
  15.101 +		for dev in `fdisk -l | grep ^/dev | cut -d " " -f 1`
  15.102 +		do
  15.103 +			RES=`fdisk -l | grep $dev | sed s/*//g`
  15.104 +			START=`echo $RES | cut -d " " -f 2`
  15.105 +			END=`echo $RES | cut -d " " -f 3`
  15.106 +			BLOCKS=`echo $RES | cut -d " " -f 4`
  15.107 +			ID=`echo $RES | cut -d " " -f 5`
  15.108 +			SYSTEM=`echo $RES | cut -d " " -f 6-`
  15.109 +			# Bootable...
  15.110 +			if fdisk -l | grep $dev | grep -q "*"; then
  15.111 +				BOOT="yes"
  15.112 +			else
  15.113 +				BOOT="-"
  15.114 +			fi
  15.115 +			# Skip swap, extended, and mounted partitions.
  15.116 +			if echo $RES | grep -q "swap" || echo $RES | grep -q "Extended" ; then
  15.117 +				continue
  15.118 +			elif mount | grep -q "^$dev "; then
  15.119 +				continue
  15.120 +			else
  15.121 +				getdevinfo $dev
  15.122 +				echo "$dev | $SIZE | $SYSTEM | $TYPE | $LABEL | $BOOT | $START | $END | $BLOCKS | $ID | $UUID"
  15.123 +			fi
  15.124 +		done
  15.125 +		for dev in /dev/mapper/* ; do
  15.126 +			[ -b $dev ] || continue
  15.127 +			mount | grep -q "^$dev " && continue
  15.128 +			mdev=dm-$(ls -l $dev | awk '{ print $6 }')
  15.129 +			mount | grep -q "^/dev/$mdev " && continue
  15.130 +			getdevinfo /dev/$mdev
  15.131 +			echo "$dev | $SIZE | - | $TYPE | $LABEL | - | - | - | $BLOCKS | - | $UUID"
  15.132 +		done
  15.133 +		for dev in $(losetup | cut -d: -f1); do
  15.134 +			[ -b $dev ] || continue
  15.135 +			mount | grep -q "^$dev " && continue
  15.136 +			getdevinfo $dev
  15.137 +			echo "$dev | $SIZE | - | $TYPE | $LABEL | - | - | - | $BLOCKS | - | $UUID"
  15.138 +		done
  15.139 +		[ -e /dev/cdrom ] &&
  15.140 +		echo "/dev/cdrom | - | CD/DVD | iso9660 | - | - | - | - | - | - | -"
  15.141 +		for i in /sys/devices/platform/floppy.*/block:*; do 
  15.142 +			[ -e $i ] && echo "/dev/${i#*block:} | - | - | - | floppy | - | - | - | - | -"
  15.143 +		done
  15.144 +		;;
  15.145 +	mounted-fs-infos)
  15.146 +		# Mounted fs info and actions, rootfs or other fs.
  15.147 +		#
  15.148 +		if [ "$MOUNTED" == "/dev/root" ]; then
  15.149 +			export MOUNTED_DEVICE="
  15.150 +<window title=\"Device: rootfs\" icon-name=\"media-flash\">
  15.151 +<vbox>
  15.152 +	<text use-markup=\"true\" width-chars=\"56\">
  15.153 +		<label>\"
  15.154 +<b>/dev/root</b>
  15.155 +\"
  15.156 +		</label>
  15.157 +	</text>
  15.158 +	<text use-markup=\"true\" width-chars=\"56\">
  15.159 +		<input>df -h / | grep ^rootfs</input>
  15.160 +	</text>
  15.161 +	<hbox>
  15.162 +		<button>
  15.163 +			<label>Browse</label>
  15.164 +			<input file icon=\"folder-open\"></input>
  15.165 +			<action>pcmanfm / &</action>
  15.166 +			<action type=\"closewindow\">MOUNTED_DEVICE</action>
  15.167 +		</button>
  15.168 +		<button>
  15.169 +			<input file icon=\"gtk-close\"></input>
  15.170 +			<action type=\"closewindow\">MOUNTED_DEVICE</action>
  15.171 +		</button>
  15.172 +	</hbox>
  15.173 +</vbox>
  15.174 +</window>"
  15.175 +		gtkdialog --center --program=MOUNTED_DEVICE
  15.176 +		else
  15.177 +			getdevinfo $MOUNTED
  15.178 +			RES=`df -h $MOUNTED | grep ^$MOUNTED`
  15.179 +			mounted_fs_data
  15.180 +			export MOUNTED_DEVICE="
  15.181 +<window title=\"Device: $MOUNTED\" icon-name=\"media-flash\">
  15.182 +<vbox>
  15.183 +	<text use-markup=\"true\" width-chars=\"56\">
  15.184 +		<label>\"
  15.185 +Device <b>$MOUNTED</b> is mounted on <b>$MOUNTED_ON</b>
  15.186 +
  15.187 +Size: $SIZE
  15.188 +UUID: $UUID
  15.189 +Type: $TYPE
  15.190 +Label: $LABEL
  15.191 +\"
  15.192 +		</label>
  15.193 +	</text>
  15.194 +	<hbox>
  15.195 +		<button>
  15.196 +			<label>Browse</label>
  15.197 +			<input file icon=\"folder-open\"></input>
  15.198 +			<action>pcmanfm $MOUNTED_ON &</action>
  15.199 +			<action type=\"closewindow\">MOUNTED_DEVICE</action>
  15.200 +		</button>"
  15.201 +if mount | grep $MOUNTED_ON | grep -q '(rw'; then
  15.202 +	MOUNTED_DEVICE="$MOUNTED_DEVICE
  15.203 +		<button>
  15.204 +			<label>Remount read-only</label>
  15.205 +			<input file icon=\"redo\"></input>
  15.206 +			<action>mount -o remount,ro $MOUNTED_ON</action>
  15.207 +			<action type=\"closewindow\">MOUNTED_DEVICE</action>
  15.208 +		</button>"
  15.209 +else
  15.210 +	MOUNTED_DEVICE="$MOUNTED_DEVICE
  15.211 +		<button>
  15.212 +			<label>Remount read-write</label>
  15.213 +			<input file icon=\"redo\"></input>
  15.214 +			<action>mount -o remount,rw $MOUNTED_ON</action>
  15.215 +			<action type=\"closewindow\">MOUNTED_DEVICE</action>
  15.216 +		</button>"
  15.217 +fi
  15.218 +MOUNTED_DEVICE="$MOUNTED_DEVICE
  15.219 +		<button>
  15.220 +			<label>Umount</label>
  15.221 +			<input file icon=\"undo\"></input>
  15.222 +			<action>umount $MOUNTED_ON</action>
  15.223 +			<action type=\"closewindow\">MOUNTED_DEVICE</action>
  15.224 +		</button>
  15.225 +		<button>
  15.226 +			<input file icon=\"gtk-close\"></input>
  15.227 +			<action type=\"closewindow\">MOUNTED_DEVICE</action>
  15.228 +		</button>
  15.229 +	</hbox>
  15.230 +</vbox>
  15.231 +</window>"
  15.232 +		gtkdialog --center --program=MOUNTED_DEVICE
  15.233 +		fi ;;
  15.234 +	umounted-fs-infos)
  15.235 +		# Mounted fs info and actions, rootfs or other fs.
  15.236 +		#
  15.237 +		case "$DEVICE" in
  15.238 +		/dev/mapper/*) mdev=/dev/dm-$(ls -l $DEVICE | awk '{ print $6 }');;
  15.239 +		*) mdev=$DEVICE;;
  15.240 +		esac
  15.241 +		getdevinfo $mdev
  15.242 +		export UMOUNTED_DEVICE="
  15.243 +<window title=\"Device: $DEVICE\" icon-name=\"media-flash\">
  15.244 +<vbox>
  15.245 +	<text use-markup=\"true\" width-chars=\"56\">
  15.246 +		<label>\"
  15.247 +Mount <b>$DEVICE</b> on <b>$MOUNT_POINT</b>
  15.248 +
  15.249 +Size: $SIZE
  15.250 +UUID: $UUID
  15.251 +Type: $TYPE
  15.252 +Label: $LABEL
  15.253 +\"
  15.254 +		</label>
  15.255 +	</text>
  15.256 +	
  15.257 +	<hbox>
  15.258 +		<button>
  15.259 +			<label>Mount read-only</label>
  15.260 +			<input file icon=\"edit-redo\"></input>
  15.261 +			<action>mkdir -p $MOUNT_POINT</action>
  15.262 +			<action>mount -r $DEVICE $MOUNT_POINT</action>
  15.263 +			<action type=\"closewindow\">MOUNTED_DEVICE</action>
  15.264 +		</button>
  15.265 +		<button>
  15.266 +			<label>Mount read-write</label>
  15.267 +			<input file icon=\"edit-redo\"></input>
  15.268 +			<action>mkdir -p $MOUNT_POINT</action>
  15.269 +			<action>mount $DEVICE $MOUNT_POINT</action>
  15.270 +			<action type=\"closewindow\">MOUNTED_DEVICE</action>
  15.271 +		</button>"
  15.272 +while read type fsck args; do
  15.273 +	[ "$TYPE" == "$type" ] || continue
  15.274 +	which $fsck > /dev/null || continue
  15.275 +UMOUNTED_DEVICE="$UMOUNTED_DEVICE		
  15.276 +		<button>
  15.277 +			<label>$fsck check</label>
  15.278 +			<input file icon=\"drive-harddisk\"></input>
  15.279 +			<action>xterm -T \"$fsck $args $DEVICE\" \
  15.280 +				-geometry 80x12 \
  15.281 +				-e \"echo; $fsck $args $DEVICE; \
  15.282 +				echo -e '----\\nENTER to close Terminal'; \
  15.283 +				read i\" &</action>
  15.284 +			<action type=\"closewindow\">MOUNTED_DEVICE</action>
  15.285 +		</button>"
  15.286 +done <<EOT
  15.287 +ext3 e2fsck -p
  15.288 +ext2 e2fsck -p
  15.289 +vfat dosfsck -a
  15.290 +msdos dosfsck -a
  15.291 +xfs fsck.xfs -s
  15.292 +reiserfs reiserfsck --fix-fixable
  15.293 +jfs jfs_fsck -a
  15.294 +EOT
  15.295 +UMOUNTED_DEVICE="$UMOUNTED_DEVICE		
  15.296 +		<button>
  15.297 +			<input file icon=\"gtk-close\"></input>
  15.298 +			<action type=\"closewindow\">UMOUNTED_DEVICE</action>
  15.299 +		</button>
  15.300 +	</hbox>
  15.301 +</vbox>
  15.302 +</window>"
  15.303 +		gtkdialog --center --program=UMOUNTED_DEVICE ;;
  15.304 +	loopmgr)
  15.305 +		export LOOP_MANAGER="
  15.306 +<window title=\"Loop manager\" icon-name=\"media-flash\">
  15.307 +<vbox>
  15.308 +	<tree>
  15.309 +		<width>420</width><height>120</height>
  15.310 +		<variable>LOOP_DEV</variable>
  15.311 +		<label>Device|File|Size|Type|Label|Mounted on|Offset|UUID</label>"
  15.312 +		while read dev offset file; do
  15.313 +			DEV=$(echo $dev | cut -d: -f1)
  15.314 +			[ -b "$DEV" ] || continue
  15.315 +			MOUNT=$(mount | grep ^$DEV | awk '{ print $3 }')
  15.316 +			getdevinfo $DEV
  15.317 +			LOOP_MANAGER="$LOOP_MANAGER
  15.318 +		<item>$DEV | $file | $SIZE | $TYPE | $LABEL | $MOUNT | $offset | $UUID</item>
  15.319 +"
  15.320 +		done <<EOT
  15.321 +$(losetup)
  15.322 +EOT
  15.323 +		LOOP_MANAGER="$LOOP_MANAGER
  15.324 +		<action>/usr/lib/slitaz/libmountbox remove-loop</action>
  15.325 +		<action>/usr/lib/slitaz/libmountbox loopmgr &</action>
  15.326 +		<action type=\"closewindow\">LOOP_MANAGER</action>
  15.327 +	</tree>
  15.328 +	<hbox>
  15.329 +		<text use-markup=\"true\">
  15.330 +			<label>\"<b>File</b>\"</label>
  15.331 +		</text>
  15.332 +		<entry accept=\"filename\">
  15.333 +			<variable>FILE</variable>
  15.334 +		</entry>
  15.335 +		<button>
  15.336 +			<input file icon=\"folder-open\"></input>
  15.337 +			<action type=\"fileselect\">FILE</action>
  15.338 +		</button>
  15.339 +	</hbox>
  15.340 +	<hbox>
  15.341 +		<text use-markup=\"true\">
  15.342 +			<label>\"<b>Offset</b>\"</label>
  15.343 +		</text>
  15.344 +		<entry>
  15.345 +			<default>0</default>
  15.346 +			<variable>OFFSET</variable>
  15.347 +		</entry>
  15.348 +		<button>
  15.349 +			<label>Disable</label>
  15.350 +			<input file icon=\"remove\"></input>
  15.351 +			<action>/usr/lib/slitaz/libmountbox remove-loop</action>
  15.352 +			<action>/usr/lib/slitaz/libmountbox loopmgr &</action>
  15.353 +			<action type=\"closewindow\">LOOP_MANAGER</action>
  15.354 +		</button>
  15.355 +		<button>
  15.356 +			<label>Enable</label>
  15.357 +			<input file icon=\"add\"></input>
  15.358 +			<action>losetup -o \$OFFSET \$(losetup -f) \$FILE</action>
  15.359 +			<action>/usr/lib/slitaz/libmountbox loopmgr &</action>
  15.360 +			<action type=\"closewindow\">LOOP_MANAGER</action>
  15.361 +		</button>
  15.362 +		<button>
  15.363 +			<label>Create</label>
  15.364 +			<input file icon=\"filenew\"></input>
  15.365 +			<action>/usr/lib/slitaz/libmountbox new-file</action>
  15.366 +			<action>/usr/lib/slitaz/libmountbox loopmgr &</action>
  15.367 +			<action type=\"closewindow\">LOOP_MANAGER</action>
  15.368 +		</button>
  15.369 +		<button>
  15.370 +			<input file icon=\"gtk-close\"></input>
  15.371 +			<action type=\"closewindow\">LOOP_MANAGER</action>
  15.372 +		</button>
  15.373 +	</hbox>
  15.374 +</vbox>
  15.375 +</window>"
  15.376 +		gtkdialog --center --program=LOOP_MANAGER ;;
  15.377 +	remove-loop)
  15.378 +		getdevinfo $LOOP_DEV
  15.379 +		export REMOVE_DEVICE="
  15.380 +<window title=\"Device: $LOOP_DEV\" icon-name=\"media-flash\">
  15.381 +<vbox>
  15.382 +	<text use-markup=\"true\" width-chars=\"56\">
  15.383 +		<label>\"
  15.384 +Disable <b>$LOOP_DEV</b> ?
  15.385 +
  15.386 +Size: $SIZE
  15.387 +UUID: $UUID
  15.388 +Type: $TYPE
  15.389 +Label: $LABEL
  15.390 +\"
  15.391 +		</label>
  15.392 +	</text>
  15.393 +	<hbox>
  15.394 +		<button yes>
  15.395 +			<action>umount $LOOP_DEV</action>
  15.396 +			<action>losetup -d $LOOP_DEV</action>
  15.397 +			<action type=\"closewindow\">LOOP_MANAGER</action>
  15.398 +			<action>/usr/lib/slitaz/libmountbox loopmgr &</action>
  15.399 +			<action type=\"closewindow\">REMOVE_DEVICE</action>
  15.400 +		</button>
  15.401 +		<button no>
  15.402 +			<action type=\"closewindow\">REMOVE_DEVICE</action>
  15.403 +		</button>
  15.404 +	</hbox>
  15.405 +</vbox>
  15.406 +</window>"
  15.407 +		gtkdialog --center --program=REMOVE_DEVICE ;;
  15.408 +	create-file)
  15.409 +		file=$2
  15.410 +		size=$3
  15.411 +		[ -n "$file" -a -n "$size" ] || exit
  15.412 +		[ "$4" == "true" ] && bs="1K"
  15.413 +		[ "$5" == "true" ] && bs="1M"
  15.414 +		[ "$6" == "true" ] && bs="1024M"
  15.415 +		[ "$8" == "true" ] && dev="/dev/zero count=$size"
  15.416 +		[ "$9" == "true" ] && dev="/dev/urandom count=$size"
  15.417 +		[ "$10" == "true" ] && dev="/dev/zero seek=$size count=0"
  15.418 +		if [ "$7" != "true" -a -e "$file" ]; then
  15.419 +			export FILE_EXIST="
  15.420 +<window title=\"File exist\" icon-name=\"media-flash\">
  15.421 +<vbox>
  15.422 +	<hbox>
  15.423 +		<text use-markup=\"true\">
  15.424 +			<label> \"The file <b>$file</b> already exists\" </label>
  15.425 +		</text>
  15.426 +	</hbox>
  15.427 +	<hbox>
  15.428 +		<button>
  15.429 +			<input file icon=\"gtk-close\"></input>
  15.430 +			<action type=\"closewindow\">FILE_EXIST</action>
  15.431 +		</button>
  15.432 +	</hbox>
  15.433 +</vbox>
  15.434 +</window>"
  15.435 +			gtkdialog --center --program=FILE_EXIST
  15.436 +			exit
  15.437 +		fi
  15.438 +		dd if=$dev of=$file bs=$bs
  15.439 +		;;
  15.440 +	new-file)
  15.441 +		export CREATE_FILE="
  15.442 +<window title=\"Create file\" icon-name=\"media-flash\">
  15.443 +<vbox>
  15.444 +	<hbox>
  15.445 +		<text use-markup=\"true\">
  15.446 +			<label>\"<b>File:</b>\"</label>
  15.447 +		</text>
  15.448 +		<entry>
  15.449 +			<variable>FILE</variable>
  15.450 +$( [ -n "$FILE" ] && echo "<default>$FILE</default>" )
  15.451 +		</entry>
  15.452 +		<button>
  15.453 +			<input file icon=\"folder-open\"></input>
  15.454 +			<action type=\"fileselect\">FILE</action>
  15.455 +		</button>
  15.456 +	</hbox>
  15.457 +	<hbox>
  15.458 +		<text use-markup=\"true\">
  15.459 +			<label>\"<b>Size:</b>\"</label>
  15.460 +		</text>
  15.461 +		<entry>
  15.462 +			<variable>NEW_SIZE</variable>
  15.463 +			<default>0</default>
  15.464 +		</entry>
  15.465 +		<radiobutton>
  15.466 +			<label>Kb</label>
  15.467 +			<variable>KB</variable>
  15.468 +		</radiobutton>
  15.469 +		<radiobutton>
  15.470 +			<label>Mb</label>
  15.471 +			<variable>MB</variable>
  15.472 +		</radiobutton>
  15.473 +		<radiobutton>
  15.474 +			<label>Gb</label>
  15.475 +			<variable>GB</variable>
  15.476 +		</radiobutton>
  15.477 +	</hbox>
  15.478 +	<hbox>
  15.479 +		<text use-markup=\"true\">
  15.480 +			<label>\"<b>Fill</b>\"</label>
  15.481 +		</text>
  15.482 +		<radiobutton>
  15.483 +			<label>random</label>
  15.484 +			<variable>RANDOM</variable>
  15.485 +		</radiobutton>
  15.486 +		<radiobutton>
  15.487 +			<label>zero</label>
  15.488 +			<variable>ZERO</variable>
  15.489 +		</radiobutton>
  15.490 +		<radiobutton>
  15.491 +			<label>sparse</label>
  15.492 +			<variable>SPARSE</variable>
  15.493 +		</radiobutton>
  15.494 +		<checkbox>
  15.495 +			<label>Override</label>
  15.496 +			<variable>OVERRIDE</variable>
  15.497 +			<default>false</default>
  15.498 +		</checkbox>
  15.499 +		<button>
  15.500 +			<label>Create</label>
  15.501 +			<input file icon=\"filenew\"></input>
  15.502 +			<action>/usr/lib/slitaz/libmountbox create-file \"\$FILE\" \"\$NEW_SIZE\" \$KB \$MB \$GB \$OVERRIDE \$ZERO \$RANDOM \$SPARSE</action>
  15.503 +			<action type=\"closewindow\">CREATE_FILE</action>
  15.504 +		</button>
  15.505 +		<button>
  15.506 +			<input file icon=\"gtk-close\"></input>
  15.507 +			<action type=\"closewindow\">CREATE_FILE</action>
  15.508 +		</button>
  15.509 +	</hbox>
  15.510 +</vbox>
  15.511 +</window>"
  15.512 +		gtkdialog --center --program=CREATE_FILE ;;
  15.513 +	cryptomgr)
  15.514 +		missing=""
  15.515 +		for i in libdevmapper dmsetup linux-md hashalot cryptsetup ; do
  15.516 +			[ -d /var/lib/tazpkg/installed/$i ] || missing="$missing $i"
  15.517 +		done
  15.518 +		if [ -n "$missing" ]; then
  15.519 +			export CRYPTO_MANAGER="
  15.520 +<window title=\"Crypto manager\" icon-name=\"media-flash\">
  15.521 +<vbox>
  15.522 +	<hbox>
  15.523 +		<text use-markup=\"true\">
  15.524 +		<label>\"
  15.525 +<b>Packages needed :</b>
  15.526 +
  15.527 +$(for i in $missing ; do echo $i; done)
  15.528 +\" </label>
  15.529 +		</text>
  15.530 +	</hbox>
  15.531 +	<hbox>
  15.532 +		<button>
  15.533 +			<label>Install</label>
  15.534 +			<input file icon=\"go-jump\"></input>
  15.535 +			<action>xterm -T \"Install packages\" \
  15.536 +			-geometry 80x16+120+120 -e \"for i in $missing ; do \
  15.537 +			yes y | tazpkg get-install \\\$i ; done; sleep 2\" \
  15.538 +			</action>
  15.539 +			<action>/usr/lib/slitaz/libmountbox cryptomgr &</action>
  15.540 +			<action type=\"closewindow\">CRYPTO_MANAGER</action>
  15.541 +		</button>
  15.542 +		<button>
  15.543 +			<input file icon=\"gtk-close\"></input>
  15.544 +			<action type=\"closewindow\">CRYPTO_MANAGER</action>
  15.545 +		</button>
  15.546 +	</hbox>
  15.547 +</vbox>
  15.548 +</window>"
  15.549 +			gtkdialog --center --program=CRYPTO_MANAGER
  15.550 +			exit
  15.551 +		fi
  15.552 +		for i in dm-mod dm-crypt aes-i586 ; do
  15.553 +			lsmod | grep -q $i || modprobe $i
  15.554 +		done
  15.555 +		export CRYPTO_MANAGER="
  15.556 +<window title=\"Crypto manager\" icon-name=\"media-flash\">
  15.557 +<vbox>
  15.558 +	<tree>
  15.559 +		<width>420</width><height>120</height>
  15.560 +		<variable>CRYTO_DEV</variable>
  15.561 +		<label>Name|Device|Size|Type|Label|Mounted on|UUID</label>"
  15.562 +		while read name ; do
  15.563 +			[ -b /dev/mapper/$name ] || continue
  15.564 +			DEV=/dev/dm-$(ls -l /dev/mapper/$name | awk '{ print $6 }')
  15.565 +			MOUNT=$(mount | egrep "^$DEV|/dev/mapper/$name" | awk '{ print $3 }')
  15.566 +			getdevinfo $DEV
  15.567 +			case "$name" in 
  15.568 +			*crypto*) item="item icon=\"passwd\"";;
  15.569 +			*)        item="item icon=\"drive-harddisk\"";;
  15.570 +			esac
  15.571 +			CRYPTO_MANAGER="$CRYPTO_MANAGER
  15.572 +		<$item>$name|$DEV | $SIZE | $TYPE | $LABEL | $MOUNT | $UUID</item>
  15.573 +"
  15.574 +		done <<EOT
  15.575 +$(ls /dev/mapper 2> /dev/null)
  15.576 +EOT
  15.577 +		CRYPTO_MANAGER="$CRYPTO_MANAGER
  15.578 +	</tree>
  15.579 +	<hbox>
  15.580 +		<text use-markup=\"true\">
  15.581 +			<label>\"<b>Device :</b>\"</label>
  15.582 +		</text>
  15.583 +		<combobox>
  15.584 +			<label>Device</label>
  15.585 +$( (losetup ; blkid | grep -v /dev/loop ) | cut -d: -f1 | awk '{ printf "<item>%s</item>\n",$1}')
  15.586 +			<variable>DEVICE</variable>
  15.587 +		</combobox>
  15.588 +		<text use-markup=\"true\">
  15.589 +			<label>\"<b>Cipher :</b>\"</label>
  15.590 +		</text>
  15.591 +		<combobox>
  15.592 +			<variable>CRYPTO</variable>
  15.593 +			<item>aes-256</item>
  15.594 +			<item>aes-192</item>
  15.595 +			<item>aes-128</item>
  15.596 +		</combobox>
  15.597 +	</hbox>
  15.598 +	<hbox>
  15.599 +		<button>
  15.600 +			<label>Remove</label>
  15.601 +			<input file icon=\"remove\"></input>
  15.602 +			<action>/usr/lib/slitaz/libmountbox remove-crypto</action>
  15.603 +			<action>/usr/lib/slitaz/libmountbox cryptomgr &</action>
  15.604 +			<action type=\"closewindow\">CRYPTO_MANAGER</action>
  15.605 +		</button>
  15.606 +		<button>
  15.607 +			<label>Create</label>
  15.608 +			<input file icon=\"add\"></input>
  15.609 +			<action>/usr/lib/slitaz/libmountbox add-crypto</action>
  15.610 +			<action>/usr/lib/slitaz/libmountbox cryptomgr &</action>
  15.611 +			<action type=\"closewindow\">CRYPTO_MANAGER</action>
  15.612 +		</button>
  15.613 +		<button>
  15.614 +			<label>Format</label>
  15.615 +			<input file icon=\"gtk-clear\"></input>
  15.616 +			<action>/usr/lib/slitaz/libmountbox format-crypto</action>
  15.617 +			<action>xterm -T \"Format LUKS\" \
  15.618 +			-geometry 80x16+120+120 -e \"\
  15.619 +			cryptsetup luksFormat -c aes -h sha\${CRYPTO#aes-} \$DEVICE \" \
  15.620 +			</action>
  15.621 +			<action>/usr/lib/slitaz/libmountbox cryptomgr &</action>
  15.622 +			<action type=\"closewindow\">CRYPTO_MANAGER</action>
  15.623 +		</button>
  15.624 +		<button>
  15.625 +			<input file icon=\"gtk-close\"></input>
  15.626 +			<action type=\"closewindow\">CRYPTO_MANAGER</action>
  15.627 +		</button>
  15.628 +	</hbox>
  15.629 +</vbox>
  15.630 +</window>"
  15.631 +		gtkdialog --center --program=CRYPTO_MANAGER ;;
  15.632 +	add-old-crypto)
  15.633 +		# Not luks format
  15.634 +		# Try old loop-eas
  15.635 +		case "$CRYPTO" in
  15.636 +		*128)	key="16 sha256";;
  15.637 +		*192)	key="24 sha384";;
  15.638 +		*)	key="32 sha512";;
  15.639 +		esac
  15.640 +		getdevinfo $DEVICE
  15.641 +		key=$(echo $PASS_PHRASE | hashalot -x -n $key)
  15.642 +		echo 0 $BLOCKS crypt aes-plain $key 0 $DEVICE 0 | \
  15.643 +				dmsetup create $(dmlabel $DEVICE)
  15.644 +		;;
  15.645 +	add-crypto)
  15.646 +		if cryptsetup isLuks $DEVICE 2> /dev/null; then
  15.647 +			xterm -T "Open LUKS" -e \
  15.648 +			  "cryptsetup luksOpen $DEVICE $(dmlabel $DEVICE)"
  15.649 +		else
  15.650 +			export GET_PASS_PHRASE="
  15.651 +<window title=\"Crypto manager\" icon-name=\"media-flash\">
  15.652 +<vbox>
  15.653 +	<hbox>
  15.654 +		<text use-markup=\"true\">
  15.655 +			<label>\"<b>Pass phrase :</b>\"</label>
  15.656 +		</text>
  15.657 +		<entry>
  15.658 +			<variable>PASS_PHRASE</variable>
  15.659 +		</entry>
  15.660 +		<button ok>
  15.661 +			<action>/usr/lib/slitaz/libmountbox add-old-crypto</action>
  15.662 +			<action type=\"closewindow\">GET_PASS_PHRASE</action>
  15.663 +		</button>
  15.664 +	</hbox>
  15.665 +</vbox>
  15.666 +</window>"
  15.667 +			gtkdialog --center --program=GET_PASS_PHRASE
  15.668 +		fi
  15.669 +		;;
  15.670 +	remove-crypto)
  15.671 +		cryptsetup luksClose $CRYTO_DEV
  15.672 +		[ -e /dev/mapper/$CRYTO_DEV ] && dmsetup remove $CRYTO_DEV
  15.673 +		;;
  15.674 +	*)
  15.675 +		usage ;;
  15.676 +esac
  15.677 +
  15.678 +exit 0
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/oldstuff/gtkdialog/mountbox	Sat Apr 28 20:16:24 2012 +0200
    16.3 @@ -0,0 +1,183 @@
    16.4 +#!/bin/sh
    16.5 +# 
    16.6 +# Gtkdialog box for the mount/umount commands. Part of SliTaz tools.
    16.7 +# libmountbox: /usr/lib/slitaz/libmountbox
    16.8 +#
    16.9 +# (C) 2009 - SliTaz GNU/Linux project.
   16.10 +#
   16.11 +VERSION=20090802
   16.12 +# Mountbox is only for root.
   16.13 +if test $(id -u) != 0 ; then
   16.14 +	exec subox mountbox
   16.15 +	exit 0
   16.16 +fi
   16.17 +
   16.18 +# Commom mount point in /mnt
   16.19 +mkdir -p /mnt/harddisk
   16.20 +
   16.21 +# Just basic help.
   16.22 +export HELP='
   16.23 +<window title="Mountbox - Help" icon-name="help">
   16.24 +<vbox>
   16.25 +	<text use-markup="true" width-chars="56">
   16.26 +		<label>"
   16.27 +<b>SliTaz Mountbox - Help</b>"
   16.28 +		</label>
   16.29 +	</text>
   16.30 +	
   16.31 +	<frame English>
   16.32 +		<text wrap="true" use-markup="true">
   16.33 +			<label>
   16.34 +"Mountbox lets you mount devices on mount points. A device 
   16.35 +can be a cdrom, flash key, USB disk or local HD partition.
   16.36 +Mount points are generated from /media and /mnt. Simply
   16.37 +select an unmounted device. Then type or select a folder 
   16.38 +to mount. Then press a button to mount a device.
   16.39 +"
   16.40 +			</label>
   16.41 +		</text>
   16.42 +	</frame>
   16.43 +	<frame Français>
   16.44 +		<text wrap="true" use-markup="true">
   16.45 +			<label>
   16.46 +"Mountbox permet de monter des périphériques (devices)
   16.47 +sur des points de montage. Un device peut être un cdrom,
   16.48 +une clé USB ou un disque dur local. La liste des points
   16.49 +de montage est généré depuis /media te /mnt.
   16.50 +"
   16.51 +			</label>
   16.52 +		</text>
   16.53 +	</frame>
   16.54 +	
   16.55 +	<hbox>
   16.56 +		<button ok>
   16.57 +			<action type="closewindow">HELP</action>
   16.58 +		</button>
   16.59 +	</hbox>
   16.60 +</vbox>
   16.61 +</window>'
   16.62 +
   16.63 +# Mount and umount buttons with fields for device and mount points.
   16.64 +MAIN_DIALOG='
   16.65 +<window title="Mountbox" icon-name="media-flash">
   16.66 +<vbox>
   16.67 +	<frame>
   16.68 +	<tree>
   16.69 +		<width>500</width><height>130</height>
   16.70 +		<variable>DEVICE</variable>
   16.71 +		<label>Umounted dev|Size|System|Type|Label|Boot|Start|End|Blocks|Id|UUID</label>
   16.72 +		<input>/usr/lib/slitaz/libmountbox list-umounted</input>
   16.73 +		<action>/usr/lib/slitaz/libmountbox umounted-fs-infos</action>
   16.74 +		<action>refresh:MOUNTED</action>
   16.75 +		<action>refresh:DEVICE</action>
   16.76 +	</tree>
   16.77 +	</frame>
   16.78 +	<frame>
   16.79 +	<tree>
   16.80 +		<width>500</width><height>110</height>
   16.81 +		<variable>MOUNTED</variable>
   16.82 +		<label>Mounted fs|Size|Used|Available|Use%|Mounted on|Option</label>'
   16.83 +
   16.84 +# /dev/root
   16.85 +RES=`df -h / | grep rootfs`
   16.86 +dev="/dev/root"
   16.87 +SIZE=`echo $RES | cut -d " " -f 2`
   16.88 +USED=`echo $RES | cut -d " " -f 3`
   16.89 +AVAILABLE=`echo $RES | cut -d " " -f 4`
   16.90 +PCT=`echo $RES | cut -d " " -f 5`
   16.91 +MOUNTED_ON=`echo $RES | cut -d " " -f 6`
   16.92 +if [ $SIZE != 0 ]; then
   16.93 +	ROOT_ITEM="
   16.94 +		<item icon=\"drive-harddisk\">$dev | $SIZE | $USED | $AVAILABLE | $PCT | $MOUNTED_ON</item>"
   16.95 +fi
   16.96 +MAIN_DIALOG=${MAIN_DIALOG}${ROOT_ITEM}
   16.97 +
   16.98 +# Now we have rootfs and icons, list all mounted fs.
   16.99 +DEVICE='<input>/usr/lib/slitaz/libmountbox list-mounted</input>
  16.100 +		<action>/usr/lib/slitaz/libmountbox mounted-fs-infos</action>
  16.101 +		<action>refresh:MOUNTED</action>
  16.102 +		<action>refresh:DEVICE</action>
  16.103 +	</tree>
  16.104 +	
  16.105 +	</frame>
  16.106 +	
  16.107 +	<hbox>
  16.108 +		<text use-markup="true" >
  16.109 +			<label>"<b>Mount selected device on:</b>"</label>
  16.110 +		</text>
  16.111 +		<entry accept="directory">
  16.112 +			<default>/media/cdrom</default>
  16.113 +			<variable>MOUNT_POINT</variable>
  16.114 +			</entry>
  16.115 +		<button>
  16.116 +			<label>Browse</label>
  16.117 +			<input file icon="folder-open"></input>
  16.118 +			<action type="fileselect">MOUNT_POINT</action>
  16.119 +		</button>
  16.120 +	</hbox>
  16.121 +	'
  16.122 +
  16.123 +# Get the mount points list.
  16.124 +MAIN_DIALOG=${MAIN_DIALOG}${DEVICE}
  16.125 +
  16.126 +# Actions buttons (mount, umount, eject, etc).
  16.127 +ACTIONS='
  16.128 +		
  16.129 +	<hbox>
  16.130 +		<button>
  16.131 +			<label>Mount</label>
  16.132 +			<input file icon="edit-redo"></input>
  16.133 +			<action>mkdir -p $MOUNT_POINT</action>
  16.134 +			<action>mount $DEVICE $MOUNT_POINT</action>
  16.135 +			<action>refresh:MOUNTED</action>
  16.136 +			<action>refresh:DEVICE</action>
  16.137 +		</button>
  16.138 +		<button>
  16.139 +			<label>Umount</label>
  16.140 +			<input file icon="undo"></input>
  16.141 +			<action>umount $MOUNT_POINT; sleep 1</action>
  16.142 +			<action>refresh:MOUNTED</action>
  16.143 +			<action>refresh:DEVICE</action>
  16.144 +		</button>
  16.145 +		<button>
  16.146 +			<label>Device list</label>
  16.147 +			<input file icon="reload"></input>
  16.148 +			<action>refresh:DEVICE</action>
  16.149 +		</button>
  16.150 +		<button>
  16.151 +			<label>Eject</label>
  16.152 +			<input file icon="media-cdrom"></input>
  16.153 +			<action>eject</action>
  16.154 +		</button>
  16.155 +		<button>
  16.156 +			<label>Loop</label>
  16.157 +			<input file icon="go-jump"></input>
  16.158 +			<action>/usr/lib/slitaz/libmountbox loopmgr</action>
  16.159 +			<action>refresh:MOUNTED</action>
  16.160 +			<action>refresh:DEVICE</action>
  16.161 +		</button>
  16.162 +		<button>
  16.163 +			<label>Crypto</label>
  16.164 +			<input file icon="passwd"></input>
  16.165 +			<action>/usr/lib/slitaz/libmountbox cryptomgr</action>
  16.166 +			<action>refresh:DEVICE</action>
  16.167 +		</button>
  16.168 +		<button help>
  16.169 +			<input file icon="help"></input>
  16.170 +			<action type="launch">HELP</action>
  16.171 +		</button>
  16.172 +		<button>
  16.173 +			<label>Quit</label>
  16.174 +			<input file icon="exit"></input>
  16.175 +			<action type="exit">Exit</action>
  16.176 +		</button>
  16.177 +		
  16.178 +	</hbox>
  16.179 +	
  16.180 +</vbox>
  16.181 +</window>'
  16.182 +
  16.183 +export MAIN_DIALOG=${MAIN_DIALOG}${ACTIONS}
  16.184 +gtkdialog --center --program=MAIN_DIALOG >/dev/null
  16.185 +
  16.186 +exit 0
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/oldstuff/gtkdialog/mountbox.desktop	Sat Apr 28 20:16:24 2012 +0200
    17.3 @@ -0,0 +1,11 @@
    17.4 +[Desktop Entry]
    17.5 +Encoding=UTF-8
    17.6 +Name=Mount devices
    17.7 +Name[fr]=Monter un périphérique
    17.8 +Name[pt]=Montagem de Dispositivos
    17.9 +Name[pt_BR]=Montagem de Dispositivos
   17.10 +Comment=Mount devices on mount points
   17.11 +Exec=subox mountbox
   17.12 +Icon=media-flash
   17.13 +Type=Application
   17.14 +Categories=System;Application;
    18.1 --- a/rootfs/usr/share/applications/bootfloppybox.desktop	Sat Apr 28 20:13:13 2012 +0200
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,10 +0,0 @@
    18.4 -[Desktop Entry]
    18.5 -Encoding=UTF-8
    18.6 -Name=Boot floppy/cdrom creation tool
    18.7 -Name[pt]=Criação de disquete/cdrom de boot
    18.8 -Name[pt_BR]=Criação de disquete/cdrom de boot
    18.9 -Name[fr]=Disquette/cdrom de démarrage
   18.10 -Exec=subox bootfloppybox
   18.11 -Icon=gtk-floppy
   18.12 -Type=Application
   18.13 -Categories=System;
    19.1 --- a/rootfs/usr/share/applications/burnbox-doc.desktop	Sat Apr 28 20:13:13 2012 +0200
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,9 +0,0 @@
    19.4 -[Desktop Entry]
    19.5 -Encoding=UTF-8
    19.6 -Name=Burnbox manual
    19.7 -Name[pt]=Manual do Burnbox
    19.8 -Name[pt_BR]=Manual do Burnbox
    19.9 -Exec=browser file:///usr/share/doc/slitaz-tools/burnbox.html
   19.10 -Icon=text-html
   19.11 -Type=Application
   19.12 -Categories=Documentation;
    20.1 --- a/rootfs/usr/share/applications/burnbox.desktop	Sat Apr 28 20:13:13 2012 +0200
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,11 +0,0 @@
    20.4 -[Desktop Entry]
    20.5 -Encoding=UTF-8
    20.6 -Name=Burn CD/DVD
    20.7 -Name[fr]=Graver des CD ou DVD
    20.8 -Name[pt]=Gravador de CD/DVD
    20.9 -Name[pt_BR]=Gravador de CD/DVD
   20.10 -Comment=Burn ISO images or audio tracks to CD or DVD
   20.11 -Exec=burnbox
   20.12 -Icon=drive-optical
   20.13 -Type=Application
   20.14 -Categories=GTK;Utility;
    21.1 --- a/rootfs/usr/share/applications/mountbox.desktop	Sat Apr 28 20:13:13 2012 +0200
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,11 +0,0 @@
    21.4 -[Desktop Entry]
    21.5 -Encoding=UTF-8
    21.6 -Name=Mount devices
    21.7 -Name[fr]=Monter un périphérique
    21.8 -Name[pt]=Montagem de Dispositivos
    21.9 -Name[pt_BR]=Montagem de Dispositivos
   21.10 -Comment=Mount devices on mount points
   21.11 -Exec=subox mountbox
   21.12 -Icon=media-flash
   21.13 -Type=Application
   21.14 -Categories=System;Application;
    22.1 --- a/tinyutils/bootfloppybox	Sat Apr 28 20:13:13 2012 +0200
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,1477 +0,0 @@
    22.4 -#! /bin/sh
    22.5 -# 
    22.6 -# Gtkdialog box for the mount command. Part of SliTaz tools.
    22.7 -#
    22.8 -VERSION=20120412
    22.9 -
   22.10 -# Check if user is root.
   22.11 -check_root()
   22.12 -{
   22.13 -	if test $(id -u) != 0 ; then
   22.14 -		echo -e "
   22.15 -You must be root to run `basename $0`. Please type 'su' and 
   22.16 -root password to become super-user.\n"
   22.17 -		exit 0
   22.18 -	fi
   22.19 -}
   22.20 -
   22.21 -# This function is used after each screen to continue or abort install.
   22.22 -check_retval()
   22.23 -{
   22.24 -	case $retval in
   22.25 -		1)
   22.26 -			rm -f /tmp/floppybox.grub.menu
   22.27 -			echo -e "\nVoluntary exit.\n" && exit 0 ;;
   22.28 -		255)
   22.29 -			rm -f /tmp/floppybox.grub.menu
   22.30 -			echo -e "ESC pressed.\n" && exit 0 ;;
   22.31 -	esac
   22.32 -}
   22.33 -
   22.34 -# Trigger floppy driver to update /sys/devices/platform/
   22.35 -dd if=/dev/fd0 bs=1k count=1 > /dev/null 2>&1
   22.36 -
   22.37 -# check or list floppy devices.
   22.38 -list_floppy()
   22.39 -{
   22.40 -	local list
   22.41 -	list=""
   22.42 -	for i in /sys/devices/platform/floppy.*/block/*; do
   22.43 -		[ -d $i ] || continue
   22.44 -		list="$list $(basename $i)"
   22.45 -	done
   22.46 -	[ -n "$1" ] || echo $list
   22.47 -	[ -n "$list" ]
   22.48 -}
   22.49 -
   22.50 -# dialog to select the floppy device
   22.51 -select_floppy()
   22.52 -{
   22.53 -	DEVICE="$DIALOG --title \" Floppy device \" --backtitle \"Boot Floppy Creation\" --clear --extra-button --extra-label \"Format\" --colors --radiolist \"
   22.54 -Select boot device
   22.55 -\" 18 70 50"
   22.56 -	on=on
   22.57 -	for i in $(list_floppy); do
   22.58 -		DEVICE="$DEVICE /dev/$i 'Floppy in $i' $on"
   22.59 -		on=off
   22.60 -	done
   22.61 -	DEVICE="$DEVICE floppy \"floppy image file boot.fd\" $on"
   22.62 -	DEVICE="$DEVICE cdrom \"cdrom image file boot.iso\" off 2>&1 1>&3"
   22.63 -	exec 3>&1
   22.64 -	DEVICE=`eval $DEVICE`
   22.65 -	retval=$?
   22.66 -	exec 3>&-
   22.67 -	check_retval
   22.68 -	if [ "$retval" = "3" ]; then
   22.69 -		case "$DEVICE" in
   22.70 -		/dev/*) fdformat -n $DEVICE;;
   22.71 -		esac
   22.72 -    	fi
   22.73 -}
   22.74 -
   22.75 -# Build menu for grub or grub4dos
   22.76 -mkmenu()
   22.77 -{
   22.78 -if [ "$1" = "grub4dos" ]; then
   22.79 -	SAVEDEFAULT="save default"
   22.80 -	cat > /tmp/floppybox.grub.menu <<EOT
   22.81 -# grub4dos menu
   22.82 -default /default
   22.83 -EOT
   22.84 -else
   22.85 -	SAVEDEFAULT="savedefault"
   22.86 -	cat > /tmp/floppybox.grub.menu <<EOT
   22.87 -# grub menu
   22.88 -default saved
   22.89 -EOT
   22.90 -fi
   22.91 -cat >> /tmp/floppybox.grub.menu <<EOT
   22.92 -timeout 8
   22.93 -color yellow/brown light-green/black
   22.94 -
   22.95 -EOT
   22.96 -entry=0
   22.97 -[ -f /boot/gpxe ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
   22.98 -title gPXE (Boot from the Web, PXE/iSCSI/AoE support)
   22.99 -	kernel /boot/gpxe $(dd if=/boot/gpxe bs=1 skip=519 count=255 2>/dev/null | strings)
  22.100 -
  22.101 -EOT
  22.102 -[ -f /usr/share/boot/btmgr -a -f /usr/share/boot/memdisk.lzma ] \
  22.103 -	&& entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
  22.104 -title Smart Boot Manager (text - boot floppy, hard disk or CD/DVD)
  22.105 -	kernel /boot/memdisk floppy c=80 h=2 s=18
  22.106 -	initrd /boot/btmgr.gz
  22.107 -
  22.108 -EOT
  22.109 -http://mirror.slitaz.org/boot/plpbt.bin
  22.110 -[ -f /usr/share/boot/plpbt.bin ] \
  22.111 -	&& entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
  22.112 -title Plop Boot Manager (graphic - boot floppy, hard disk, CD/DVD or USB)
  22.113 -	kernel /boot/plpbt.bin
  22.114 -
  22.115 -EOT
  22.116 -[ -f /usr/share/boot/etherboot ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
  22.117 -title Etherboot (LAN boot, PXE or NBI)
  22.118 -	kernel /boot/etherboot
  22.119 -
  22.120 -EOT
  22.121 -[ -f /usr/share/boot/memtest.lzma -a -f /usr/share/boot/memdisk.lzma ] \
  22.122 -&& entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
  22.123 -title Memtest86+ (Test system memory)
  22.124 -	kernel /boot/memdisk floppy c=80 h=2 s=18
  22.125 -	initrd /boot/memtest.gz
  22.126 -
  22.127 -EOT
  22.128 -[ "$1" = "grub4dos" ] && entry=$(($entry + 3)) && cat >> /tmp/floppybox.grub.menu <<EOT
  22.129 -title Windows (scan ntldr)
  22.130 -	fallback $(($entry -3 + 1))
  22.131 -        find --set-root /ntldr
  22.132 -	chainloader /ntldr
  22.133 -	$SAVEDEFAULT --wait=2
  22.134 -
  22.135 -title Windows (scan cmldr)
  22.136 -	fallback $(($entry -3 + 2))
  22.137 -        find --set-root /cmldr
  22.138 -        chainloader /cmldr
  22.139 -	$SAVEDEFAULT --wait=2
  22.140 -
  22.141 -title Windows (scan io.sys)
  22.142 -	fallback $(($entry -3 + 3))
  22.143 -        find --set-root /io.sys
  22.144 -        chainloader /io.sys
  22.145 -	$SAVEDEFAULT --wait=2
  22.146 -
  22.147 -EOT
  22.148 -entry=$(($entry + 3)) && cat >> /tmp/floppybox.grub.menu <<EOT
  22.149 -title Windows (example on /dev/hda1)
  22.150 -	rootnoverify (hd0,0)
  22.151 -	chainloader +1
  22.152 -	$SAVEDEFAULT
  22.153 -
  22.154 -title Slitaz Frugal (example on /dev/hda1)
  22.155 -	root (hd0,0)
  22.156 -	kernel /boot/bzImage rw root=/dev/null vga=normal
  22.157 -	initrd /boot/rootfs.gz
  22.158 -	$SAVEDEFAULT
  22.159 -
  22.160 -title Slitaz Installed (example on /dev/hda2)
  22.161 -	root (hd0,1)
  22.162 -	kernel /boot/bzImage ro root=/dev/hda2 vga=normal
  22.163 -	$SAVEDEFAULT
  22.164 -
  22.165 -EOT
  22.166 -[ "$1" = "grub4dos" ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
  22.167 -title Slitaz cdrom image (example on /dev/hda1, DEFRAGMENTED)
  22.168 -        map (hd0,0)/boot/slitaz-cooking.iso (hd1)
  22.169 -        map --hook
  22.170 -        kernel (hd1)/boot/bzImage rw root=/dev/null vga=normal
  22.171 -        initrd (hd1)/boot/rootfs.gz
  22.172 -	$SAVEDEFAULT
  22.173 -
  22.174 -EOT
  22.175 -false && [ -f /usr/share/boot/grub.exe.lzma ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
  22.176 -title Grub4Dos
  22.177 -	kernel /boot/grub/grub.exe --config-file="configfile (fd0)/boot/grub/menu4dos.lst"
  22.178 -
  22.179 -EOT
  22.180 -}
  22.181 -
  22.182 -# Install grub or grub4dos on floppy
  22.183 -install_grub()
  22.184 -{
  22.185 -	LOOP=""
  22.186 -	GRUB_DEV=${DEVICE#/dev/}
  22.187 -	GRUB_DEV=${GRUB_DEV%% *}
  22.188 -	case "$DEVICE" in
  22.189 -	floppy*)
  22.190 -		LOOP="-o loop"
  22.191 -		GRUB_DEV=fd0
  22.192 -		DEVICE=boot.fd
  22.193 -		dd if=/dev/zero of=$DEVICE bs=18k count=80;;
  22.194 -	esac
  22.195 -	grep -qs "^# $2 menu" /tmp/floppybox.grub.menu || mkmenu $2
  22.196 -	case "$DEVICE" in
  22.197 -	/dev/*|boot.fd)
  22.198 -		yes y | mke2fs $DEVICE
  22.199 -		mkdir /media/floppy
  22.200 -		mount $LOOP $DEVICE /media/floppy
  22.201 -		if [ "$2" = "grub4dos" ]; then
  22.202 -			mkdir -p /media/floppy/boot
  22.203 -			unlzma -c /usr/share/boot/grldr.lzma > /media/floppy/grldr
  22.204 -			cp $1/boot/* /media/floppy/boot 2> /dev/null
  22.205 -			cp /tmp/floppybox.grub.menu /media/floppy/menu.lst
  22.206 -			umount -d /media/floppy
  22.207 -			bootlace --floppy --sectors-per-track=18 --heads=2 \
  22.208 -				 --chs --ext2 $DEVICE
  22.209 -		else
  22.210 -			mkdir -p /media/floppy/boot/grub
  22.211 -			cp /usr/lib/grub/i386-pc/stage? /media/floppy/boot/grub
  22.212 -			cp -a $1/boot /media/floppy
  22.213 -			cp /tmp/floppybox.grub.menu /media/floppy/boot/grub/menu.lst
  22.214 -			grub-set-default --root-directory=/media/floppy 0
  22.215 -			echo "($GRUB_DEV) $(losetup | grep $DEVICE | cut -d: -f1)" > $1/device.map
  22.216 -			[ -n "$LOOP" ] && LOOP="--device-map=$1/device.map"
  22.217 -			grub $LOOP --batch <<EOT
  22.218 -root ($GRUB_DEV)
  22.219 -setup ($GRUB_DEV)
  22.220 -quit
  22.221 -EOT
  22.222 -			umount -d /media/floppy
  22.223 -		fi ;;
  22.224 -	cdrom*)
  22.225 -		mkdir -p $1/boot/grub 2> /dev/null
  22.226 -		cp /tmp/floppybox.grub.menu $1/boot/grub/menu.lst
  22.227 -		if [ "$2" = "grub4dos" ]; then
  22.228 -			unlzma -c /usr/share/boot/grldr.lzma > $1/boot/grub/grldr
  22.229 -			genisoimage -R -o boot.iso -b boot/grub/grldr \
  22.230 -				-c boot/boot.cat -no-emul-boot -boot-load-seg 0x1000 \
  22.231 -				-hide boot/boot.cat -input-charset iso8859-1 $1
  22.232 -		else
  22.233 -			cp /usr/lib/grub/i386-pc/stage2_eltorito $1/boot/grub
  22.234 -			genisoimage -R -o boot.iso -b boot/grub/stage2_eltorito \
  22.235 -				-c boot/boot.cat -no-emul-boot -boot-load-size 4 \
  22.236 -				-hide boot/boot.cat -input-charset iso8859-1 \
  22.237 -				-boot-info-table $1
  22.238 -		fi ;;
  22.239 -	esac
  22.240 -}
  22.241 -
  22.242 -# Build /init for floppies from iso image
  22.243 -buildinit()
  22.244 -{
  22.245 -	mv $1/init $1/init.org
  22.246 -	for i in /dev/tty0 /dev/[sh]d[ab]? ; do
  22.247 -		[ -e $1$i ] || cp -a $i $1/dev
  22.248 -	done
  22.249 -	cat > $1/init <<EOTEOT
  22.250 -#!/bin/sh
  22.251 -
  22.252 -cat_floppy()
  22.253 -{
  22.254 -	tmp="\$(dd if=/dev/fd0 count=1 2> /dev/null | md5sum)"
  22.255 -	echo -n "Insert floppy \$num for \$name and press Enter or Q to skip"
  22.256 -	while true; do
  22.257 -		echo -n ":"
  22.258 -		read -t 10 answer < /dev/tty0
  22.259 -		case "\$answer" in
  22.260 -		Q*|q*|A*|a*) break 3;;
  22.261 -		esac
  22.262 -		dd if=/dev/fd0 count=1 > /tmp/bs.\$\$ 2> /dev/null
  22.263 -		[ -s /tmp/bs.\$\$ ] || continue
  22.264 -		[ "\$(md5sum < /tmp/bs.\$\$)" != "\$tmp" ] || continue
  22.265 -		rm -f /tmp/bs.\$\$
  22.266 -		break
  22.267 -	done
  22.268 -	dd if=/dev/fd0 of=/tmp/rootfs.\$num 2> /dev/null || continue
  22.269 -	cat /tmp/rootfs.\$num >> \$1
  22.270 -	rm -f /tmp/rootfs.\$num
  22.271 -	num=\$((\$num+1))
  22.272 -}
  22.273 -
  22.274 -mount -t proc proc /proc
  22.275 -total=\$(grep MemTotal /proc/meminfo | sed 's/[^0-9]//g')
  22.276 -# the floppy driver may not be included in kernel
  22.277 -insmod /lib/modules/*/kernel/drivers/block/floppy.ko.gz 2> /dev/null
  22.278 -# loram may put floppy.ko.gz module in /lib
  22.279 -insmod /lib/floppy.ko.gz 2> /dev/null
  22.280 -case "\$(/sbin/blkid 2>&1)" in
  22.281 -*not\ found*)
  22.282 -	cat <<EOT
  22.283 -
  22.284 -You can preinstall SliTaz in an ext3 partition with this floppy set.
  22.285 -
  22.286 -Simply enter the device name (/dev/XXXX) to create the slitaz/install.sh or
  22.287 -leave it blank to skip :
  22.288 -EOT
  22.289 -	read -t 60 device < /dev/tty0
  22.290 -	[ -n "\$device" ] && mount \$device /mnt && mkdir /mnt/slitaz ;;
  22.291 -*TYPE=\"ext*)
  22.292 -	cat <<EOT
  22.293 -
  22.294 -You can preinstall SliTaz in one of these ext3 partitions:
  22.295 -\$(blkid | grep 'TYPE="ext')
  22.296 -
  22.297 -Simply enter the device name (/dev/XXXX) to create the slitaz/install.sh or
  22.298 -leave it blank to skip :
  22.299 -EOT
  22.300 -	read -t 60 device < /dev/tty0
  22.301 -	[ -n "\$device" ] && mount \$device /mnt && mkdir /mnt/slitaz ;;
  22.302 -*)
  22.303 -	cat <<EOT
  22.304 -
  22.305 -You can preinstall SliTaz in an ext3 partition with this floppy set.
  22.306 -After the boot process is completed, create a partition with 'fdisk',
  22.307 -format it with 'mke2fs -j' and reboot from the floppies again.
  22.308 -
  22.309 -EOT
  22.310 -esac
  22.311 -umount /proc
  22.312 -while read name min num count file md5; do
  22.313 -	[ -e \$file ] && continue
  22.314 -	[ \$total -lt \$min ] && break
  22.315 -	while [ \$count -ne 0 ]; do
  22.316 -		cat_floppy /tmp/rootfs
  22.317 -		count=\$((\$count-1))
  22.318 -	done
  22.319 -	echo "\$md5  /tmp/rootfs" | md5sum -c || break
  22.320 -	cpio -idmu < /tmp/rootfs > /dev/null 2>&1 ||
  22.321 -	( zcat /tmp/rootfs 2> /dev/null || unlzma -c /tmp/rootfs ) | cpio -idmu
  22.322 -	if [ -d /mnt/slitaz ]; then
  22.323 -		cp /tmp/rootfs /mnt/slitaz/rootfs.\$num ||
  22.324 -		mv -f /mnt/slitaz /mnt/slitaz-aborted
  22.325 -	fi
  22.326 -	rootfslist="\$rootfslist \$num"
  22.327 -	rm -f /tmp/rootfs*
  22.328 -	mkdir /sbin 2> /dev/null
  22.329 -done <<EOT
  22.330 -$(while read line; do echo $line; done)
  22.331 -EOT
  22.332 -if [ -d /mnt/slitaz ]; then
  22.333 -	cat > /mnt/slitaz/install.sh <<EOT
  22.334 -#!/bin/sh
  22.335 -
  22.336 -if [ -z "\\\$1" ]; then
  22.337 -	echo "Usage: \\\$0 target-directory"
  22.338 -	exit 1
  22.339 -fi
  22.340 -dir=\\\$(cd \\\$(dirname \\\$0); pwd)
  22.341 -cd \\\$1
  22.342 -for i in 0 \$rootfslist ; do
  22.343 -	[ -s \\\$dir/rootfs.\\\$i ] || continue
  22.344 -	cpio -idmu < \\\$dir/rootfs.\\\$i > /dev/null 2>&1 ||
  22.345 -	( zcat \\\$dir/rootfs.\\\$i 2> /dev/null || unlzma -c \\\$dir/rootfs.\\\$i ) | cpio -idmu
  22.346 -done
  22.347 -if ! mv -f init.org init 2> /dev/null; then
  22.348 -	for i in \\\$(ls rootfs*gz | sed '1!G;h;\\\$!d'); do
  22.349 -		mount -o loop,ro \\\$i /media/cdrom && rm -f \\\$i
  22.350 -		cp -a /media/cdrom/. .
  22.351 -		umount -d /media/cdrom
  22.352 -	done
  22.353 -fi
  22.354 -mkdir boot && cp \\\$dir/bzImage boot 
  22.355 -cp -a /usr/lib/grub/i386-pc boot/grub
  22.356 -cat > boot/grub/menu.lst<<EOF
  22.357 -# /boot/grub/menu.lst: GRUB boot loader configuration.
  22.358 -#
  22.359 -
  22.360 -# By default, boot the first entry.
  22.361 -default 0
  22.362 -
  22.363 -# Boot automatically after 8 secs.
  22.364 -timeout 8
  22.365 -
  22.366 -# Change the colors.
  22.367 -color yellow/brown light-green/black
  22.368 -
  22.369 -title	SliTaz GNU/Linux
  22.370 -	kernel /boot/bzImage root=\$device
  22.371 -                
  22.372 -EOF
  22.373 -grub-install --no-floppy --root-directory=\\\$PWD \${device%[1-9]*}
  22.374 -cd -
  22.375 -EOT
  22.376 -	chmod +x /mnt/slitaz/install.sh
  22.377 -	num=1
  22.378 -	name="the Linux kernel"
  22.379 -	dd count=0 of=/mnt/slitaz/bzImage.fd > /dev/null 2>&1
  22.380 -	fullsize=1
  22.381 -	while [ \$(stat -c %s /mnt/slitaz/bzImage.fd) -lt \$fullsize ]; do
  22.382 -		cat_floppy /mnt/slitaz/bzImage.fd
  22.383 -		setup=\$(dd if=/mnt/slitaz/bzImage.fd skip=497 bs=1 count=1 2> /dev/null | hexdump -e '"" 1/1 "%d" "\n"')
  22.384 -		syssize=\$(dd if=/mnt/slitaz/bzImage.fd skip=500 bs=1 count=4 2> /dev/null | hexdump -e '"" 1/4 "%d" "\n"')
  22.385 -		cmdline=\$(dd if=/mnt/slitaz/bzImage.fd skip=552 bs=1 count=4 2> /dev/null | hexdump -e '"" 1/4 "%d" "\n"')
  22.386 -		initrd=\$(dd if=/mnt/slitaz/bzImage.fd skip=540 bs=1 count=4 2> /dev/null | hexdump -e '"" 1/4 "%d" "\n"')
  22.387 -		[ \$cmdline -eq 0 ] || cmdline=512
  22.388 -		size=\$((512 + \$setup * 512 + \$cmdline + \$syssize * 16))
  22.389 -		[ -s /etc/slitaz-release ] || initrd=0
  22.390 -		fullsize=\$((\$size + \$initrd + 512))
  22.391 -		[ \$(stat -c %s /mnt/slitaz/bzImage.fd) -lt \$size ] ||
  22.392 -			name="the first initramfs"
  22.393 -	done
  22.394 -	[ -s /etc/slitaz-release ] &&
  22.395 -	dd if=/mnt/slitaz/bzImage.fd bs=512 skip=\$((\$setup+1+\$cmdline/512+(31+\$syssize)/32)) > /mnt/slitaz/rootfs.0 &&
  22.396 -	dd bs=1 seek=\$initrd count=0 of=/mnt/slitaz/rootfs.0
  22.397 -	dd if=/dev/zero of=/mnt/slitaz/bzImage.fd conv=notrunc bs=1 count=4 seek=552
  22.398 -	dd if=/dev/zero of=/mnt/slitaz/bzImage.fd conv=notrunc bs=1 count=8 seek=536
  22.399 -	dd if=/mnt/slitaz/bzImage.fd bs=512 count=\$((\$setup+1)) > /mnt/slitaz/bzImage
  22.400 -	dd if=/mnt/slitaz/bzImage.fd bs=512 skip=\$((\$setup+1+\$cmdline/512)) >> /mnt/slitaz/bzImage
  22.401 -	rm -f /mnt/slitaz/bzImage.fd
  22.402 -	size=\$((512 + \$setup * 512 + \$syssize * 16))
  22.403 -	dd bs=1 seek=\$size count=0 of=/mnt/slitaz/bzImage > /dev/null 2>&1
  22.404 -	[ \$(stat -c %s /mnt/slitaz/bzImage) -eq \$size ] ||
  22.405 -	mv -f /mnt/slitaz /mnt/slitaz-aborted
  22.406 -fi
  22.407 -[ -d /sbin ] && mv -f /init.org /init && exec /init
  22.408 -exec /bin/ash < /dev/tty0 > /dev/tty0 2>&1
  22.409 -EOTEOT
  22.410 -	chmod +x $1/init
  22.411 -}
  22.412 -
  22.413 -# write a 32 bits data
  22.414 -# usage: storelong offset data32 file
  22.415 -storelong()
  22.416 -{
  22.417 -	printf "00000  %02X %02X %02X %02X \n" \
  22.418 -		$(( $2 & 255 )) $(( ($2>>8) & 255 )) \
  22.419 -		$(( ($2>>16) & 255 )) $(( ($2>>24) & 255 )) | \
  22.420 -	hexdump -R | dd bs=1 conv=notrunc of=$3 seek=$(( $1 )) 2> /dev/null
  22.421 -}
  22.422 -
  22.423 -# read a 32 bits data
  22.424 -# usage: getlong offset file
  22.425 -getlong()
  22.426 -{
  22.427 -	dd if=$2 bs=1 skip=$(( $1 )) count=4 2> /dev/null | \
  22.428 -		hexdump -e '"" 1/4 "%d" "\n"'
  22.429 -}
  22.430 -
  22.431 -# output floppy images set
  22.432 -floppysetcat()
  22.433 -{
  22.434 -	KERNEL="$1"
  22.435 -	INITRD="$2"
  22.436 -	shift 2
  22.437 -	CMDLINE="$@"
  22.438 -
  22.439 -	# bzImage offsets
  22.440 -	SetupSzOfs=497
  22.441 -	SyssizeOfs=500
  22.442 -	CodeAdrOfs=0x214
  22.443 -	RamfsAdrOfs=0x218
  22.444 -	RamfsLenOfs=0x21C
  22.445 -	ArgPtrOfs=0x228
  22.446 -
  22.447 -	# boot+setup address
  22.448 -	SetupBase=0x90000
  22.449 -
  22.450 -	stacktop=0x9E00
  22.451 -
  22.452 -	bs=/tmp/bs$$
  22.453 -
  22.454 -	# Get and patch boot sector
  22.455 -	dd if=$KERNEL bs=512 count=1 of=$bs 2> /dev/null
  22.456 -	uudecode <<EOT | dd of=$bs conv=notrunc 2> /dev/null
  22.457 -begin-base64 644 -
  22.458 -/L+6nWgAkAcGF4n8McC5HQDzq1sfD6mg8X1ABlfFd3ixBvOlZWaPR3gGH8ZF
  22.459 -+D/6l1hB6DQBvgACA3QO6HYBWwseKAJ0LFNH6AoBXuhmAbAgzRCwCM0QTuhl
  22.460 -ATwIdAOIBK05NigCdPDoPgE8CnXgiHz+ieb/TBD/TBi/9AGBTRz/gMdFMACc
  22.461 -sBCxBUi0k4lEHLABiUQUmGaY0+BIZgMFZtPoaAAQB7+AACn4nHMCAccx21BW
  22.462 -6J4AXrkAgLSH/kQczRVYnXfcoRoCvxwCsQk4RBxyuJPNE+oAACCQsEYoyL7b
  22.463 -AejSAF3rI4D5E3IEOMF3a4D+AnIEOOZ3bGCB/QAGdCoGUlFTlrQCULEGtQTB
  22.464 -xQSwDyHoBJAnFEAn6IwA/s117LAgzRDitOiWAJjNE2FSUCjIdwKwAZg5+HIC
  22.465 -ifhQtALNE5VeWFpyoJVBjuGAxwJPdFFOdfSM4ZU4wXVFiMj+xrEBOOZ1O4j0
  22.466 -/sW2AID9UHIwOi7wAXIqtQBgvt4B/kQMU+gxAFvoOAB1FlKYzRO4AQLNE1rQ
  22.467 -1Dpk/nXqRgjkdeVh64sWB7AxLAO0DrsHAM0QPA1088OwDejv/6wIwHX4w79s
  22.468 -BLFbZQINuA0BZToNdArNFnT0mM0Wju9Hw1g6AEluc2VydCBkaXNrIDEuBw0A
  22.469 -AA==
  22.470 -====
  22.471 -EOT
  22.472 -
  22.473 -	# Get setup
  22.474 -	setupsz=$(getlong $SetupSzOfs $bs)
  22.475 -	setupszb=$(( $setupsz & 255 ))
  22.476 -	dd if=$KERNEL bs=512 skip=1 count=$setupszb 2> /dev/null >> $bs
  22.477 -
  22.478 -	# Store cmdline after setup
  22.479 -	if [ -n "$CMDLINE" ]; then
  22.480 -		echo -n "$CMDLINE" | dd bs=512 count=1 conv=sync 2> /dev/null >> $bs
  22.481 -		storelong ArgPtrOfs $(( $SetupBase + $stacktop )) $bs
  22.482 -	fi
  22.483 -
  22.484 -	# Compute initramfs size
  22.485 -	initrdlen=0
  22.486 -	padding=0
  22.487 -	for i in $( echo $INITRD | sed 's/,/ /' ); do
  22.488 -		[ -s "$i" ] || continue
  22.489 -		initrdlen=$(( $initrdlen + $padding ))
  22.490 -		padding=$(stat -c %s $i)
  22.491 -		initrdlen=$(( $initrdlen + $padding ))
  22.492 -		padding=$(( 4096 - ($padding & 4095) ))
  22.493 -		[ $padding -eq 4096 ] && padding=0
  22.494 -	done
  22.495 -	Ksize=$(( $(getlong $SyssizeOfs $bs)*16 ))
  22.496 -	Kpad=$(( (($Ksize+4095)/4096)*4096 - Ksize ))
  22.497 -	if [ $initrdlen -ne 0 ]; then
  22.498 -		Kbase=$(getlong $CodeAdrOfs $bs)
  22.499 -		storelong $RamfsAdrOfs \
  22.500 -			$(( (0x1000000 - $initrdlen) & 0xFFFF0000 )) $bs
  22.501 -		storelong $RamfsLenOfs $initrdlen $bs
  22.502 -	fi
  22.503 -
  22.504 -	# Output boot sector + setup + cmdline
  22.505 -	dd if=$bs 2> /dev/null
  22.506 -
  22.507 -	# Output kernel code
  22.508 -	dd if=$KERNEL bs=512 skip=$(( $setupszb + 1 )) 2> /dev/null
  22.509 -
  22.510 -	# Pad to next sector
  22.511 -	Kpad=$(( 512 - ($(stat -c %s $KERNEL) & 511) ))
  22.512 -	[ $Kpad -eq 512 ] || dd if=/dev/zero bs=1 count=$Kpad 2> /dev/null
  22.513 -
  22.514 -	# Output initramfs
  22.515 -	padding=0
  22.516 -	for i in $( echo $INITRD | sed 's/,/ /' ); do
  22.517 -		[ -s "$i" ] || continue
  22.518 -		[ $padding -ne 0 ] && dd if=/dev/zero bs=1 count=$padding
  22.519 -		dd if=$i 2> /dev/null
  22.520 -		padding=$(( 4096 - ($(stat -c %s $i) & 4095) ))
  22.521 -		[ $padding -eq 4096 ] && padding=0
  22.522 -	done
  22.523 -
  22.524 -	# Cleanup
  22.525 -	rm -f $bs
  22.526 -}
  22.527 -
  22.528 -# Create boot floppy set from kernel, initrd & cmdline
  22.529 -floppyset()
  22.530 -{
  22.531 -	floppysetcat "$@" | split -b 1440k /dev/stdin floppy$$
  22.532 -	i=1
  22.533 -	ls floppy$$* | while read file ; do
  22.534 -		output=$(printf "fd%03d.img" $i)
  22.535 -		cat $file /dev/zero | dd bs=1k count=1440 of=$output conv=sync 2> /dev/null
  22.536 -		rm -f $file
  22.537 -		i=$(( $i + 1 ))
  22.538 -	done
  22.539 -}
  22.540 -
  22.541 -# Create boot floppy set from a SliTaz ISO image
  22.542 -floppysetfromiso()
  22.543 -{
  22.544 -	mkdir /tmp/iso$$
  22.545 -	mount -o loop,ro $1 /tmp/iso$$
  22.546 -	rootfs="$(ls /tmp/iso$$/boot/rootfs*z 2> /dev/null | tail -1)"
  22.547 -	bzimage=/tmp/iso$$/boot/bzImage
  22.548 -	if [ -z "$rootfs" -o ! -s $bzimage ]; then
  22.549 -		umount -d /tmp/iso$$
  22.550 -		rm -rf /tmp/iso$$
  22.551 -		echo "Not a SliTaz ISO image !"
  22.552 -		return 1
  22.553 -	fi
  22.554 -	mkdir -p /tmp/rootfs$$/fs
  22.555 -	n=1
  22.556 -	for i in $(ls /tmp/iso$$/boot/rootfs*z | sort -r); do
  22.557 -		mkdir /tmp/rootfs$$/$n
  22.558 -		ln -s $i /tmp/rootfs$$/$n
  22.559 -		n=$(($n + 1))
  22.560 -	done
  22.561 -	echo "Unpacking rootfs..."
  22.562 -	( zcat $rootfs 2> /dev/null | unlzma -c $rootfs ) | \
  22.563 -		( cd /tmp/rootfs$$/fs ; cpio -idm > /dev/null )
  22.564 -	if [ $(unlzma -c $rootfs 2> /dev/null| wc -c) -gt $(stat -c %s $rootfs) ]; then
  22.565 -		if [ $(du -ck $rootfs $bzimage | awk 'END { print $1 }') -gt 15296 ]; then
  22.566 -	# The rootfs.gz file is too big, extract a minimum bootfs with busybox stuff
  22.567 -			echo "Extracting bootfs..."
  22.568 -			mv /tmp/rootfs$$/fs /tmp/rootfs$$/fs0
  22.569 -			for i in lib bin sbin usr/bin usr/sbin ; do
  22.570 -				mkdir -p /tmp/rootfs$$/fs/$i
  22.571 -			done
  22.572 -			cd /tmp/rootfs$$/fs0
  22.573 -			dir=$(echo lib/modules/*/kernel/drivers/block)
  22.574 -			[ -d $dir ] && mkdir -p ../fs/$dir
  22.575 -			[ -f $dir/floppy.ko.gz ] && mv $dir/floppy.ko.gz ../fs/$dir
  22.576 -			for i in dev init mnt proc sys tmp ; do
  22.577 -				mv $i ../fs
  22.578 -			done
  22.579 -			mv lib/ld-* ../fs/lib
  22.580 -			LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so bin/busybox | \
  22.581 -			awk '/\/lib\/lib/ { print $3 }' | while read lib ; do
  22.582 -				while [ -L .$lib ]; do
  22.583 -					local target
  22.584 -					target="$(readlink ".$lib")"
  22.585 -					case "$target" in
  22.586 -					/*)	;;
  22.587 -					*)	target="$(dirname $lib)/$target" ;;
  22.588 -					esac
  22.589 -					mv ".$lib" ../fs/lib
  22.590 -					lib="$target"
  22.591 -				done
  22.592 -				mv ".$lib" ../fs/lib
  22.593 -			done
  22.594 -			for i in $(bin/busybox | awk '{ if (s) printf "%s",$0 }
  22.595 -				   /Currently/ { s=1 }' | sed 's/,//g'); do
  22.596 -				for j in bin sbin usr/bin usr/sbin ; do
  22.597 -					[ -e $j/$i ] && mv $j/$i ../fs/$j/$i
  22.598 -				done
  22.599 -			done
  22.600 -			mv bin/busybox ../fs/bin
  22.601 -			[ -e ../fs/bin/cpio ] || mv bin/cpio ../fs/bin
  22.602 -			rm -f ../1/*
  22.603 -			find | cpio -o -H newc | lzma e ../1/rootfs.gz -si
  22.604 -			cd - > /dev/null
  22.605 -			rm -rf /tmp/rootfs$$/fs0
  22.606 -		else
  22.607 -	# The rootfs.gz file fits in 15MB, no need to split it.
  22.608 -			rm -rf /tmp/rootfs$$/1
  22.609 -		fi
  22.610 -	else
  22.611 -	# This is a loram rootfs.gz, extract loram bootstrap
  22.612 -		echo "Splitting loram rootfs..."
  22.613 -		offset=$(awk '/07070100/ { o+=index($0,"07070100"); print int(o/4) ; exit } { o+=1+length() }' < $rootfs)
  22.614 -		dd if=$rootfs skip=$(($offset / 1024)) bs=4k count=1 2> /dev/null | \
  22.615 -		dd skip=$(($offset % 1024)) bs=4 of=/tmp/rootfs$$/1/root 2> /dev/null
  22.616 -		dd if=$rootfs skip=$((1 + ($offset / 1024) )) bs=4k \
  22.617 -			>> /tmp/rootfs$$/1/root 2> /dev/null
  22.618 -		rm -f /tmp/rootfs$$/1/rootfs*
  22.619 -	fi
  22.620 -	# Create extra rootfs floppies
  22.621 -	for i in /tmp/rootfs$$/[1-9]*/root* ; do
  22.622 -		[ -f $i ] || continue
  22.623 -		echo "Creating floppies for rootfs $(basename $(dirname $i) )..."
  22.624 -		case "$(dd if=$i bs=1 count=4 2> /dev/null)" in
  22.625 -		0707) cat $i ;;
  22.626 -		*)    zcat $i 2> /dev/null || unlzma -c $i ;;
  22.627 -		esac | cpio -t > $(dirname $i)/files.list
  22.628 -		sed -i '/ blocks$/d' $(dirname $i)/files.list
  22.629 -		x=$(readlink $i)
  22.630 -		[ -n "$x" ] || x=$i
  22.631 -		pad=$(( $(stat -c %s $x ) % 1474560 ))
  22.632 -		[ $pad -ne 0 ] && pad=$(( 1474560 - $pad ))
  22.633 -		dd if=/dev/zero bs=1 count=$pad 2> /dev/null | cat $i - | \
  22.634 -		split -b 1440k /dev/stdin $(dirname $i)/floppy
  22.635 -	done
  22.636 -	selection="$(grep -s append /tmp/iso$$/boot/isolinux/common.cfg | sed 's/.*append //')"
  22.637 -	[ -n "$selection" ] || selection="0 slitaz"
  22.638 -	set -- $selection
  22.639 -	selection=""
  22.640 -	while [ -n "$2" ]; do
  22.641 -		[ ! -d /tmp/rootfs$$/1 -a -z "$4" ] && break
  22.642 -		case "$1" in
  22.643 -		*G)	selection="$2 $(( ${1%G} * 1024 * 1024 )) $selection" ;;
  22.644 -		*M)	selection="$2 $(( ${1%M} * 1024 )) $selection" ;;
  22.645 -		*)	selection="$2 $1 $selection" ;;
  22.646 -		esac
  22.647 -		shift 2
  22.648 -	done
  22.649 -	echo "Creating /init ..."
  22.650 -	base=100
  22.651 -	set -- $selection
  22.652 -	for i in /tmp/rootfs$$/[1-9]* ; do
  22.653 -		[ -d $i ] || continue
  22.654 -		while read file; do
  22.655 -			[ -e $i/../fs/$file ] && continue
  22.656 -			[ $(grep -- "$file" $i/../*/files.list | wc -l) -eq 1 ] &&
  22.657 -			break
  22.658 -		done < $i/files.list
  22.659 -		printf "%s %s %03d %d %s %s\n" \
  22.660 -			$1 $2 $base $(ls $i/floppy* | wc -l) $file \
  22.661 -			$(cat $i/floppy* | md5sum - | awk '{print $1}')
  22.662 -		base=$(($base + 100))
  22.663 -		shift 2
  22.664 -	done | buildinit /tmp/rootfs$$/fs
  22.665 -	cmdline="$(grep 'append *initrd' /tmp/iso$$/boot/isolinux/isolinux.cfg | tail -n 1 | sed 's/.*gz //')"
  22.666 -	( cd /tmp/rootfs$$/fs ; find | cpio -o -H newc ) | lzma e /tmp/rootfs$$/rootfs -si
  22.667 -	echo "Creating first stage boot floppies..."
  22.668 -	floppyset $bzimage /tmp/rootfs$$/rootfs "$cmdline"
  22.669 -	base=100
  22.670 -	for i in /tmp/rootfs$$/[1-9]* ; do
  22.671 -		[ -d $i ] || continue
  22.672 -		j=0
  22.673 -		for f in $i/floppy* ; do
  22.674 -			mv $f $(printf "fd%03d.img" $(( $base + $j )) )
  22.675 -			j=$(($j + 1))
  22.676 -		done
  22.677 -		base=$(($base + 100))
  22.678 -	done
  22.679 -	rm -rf /tmp/rootfs$$
  22.680 -	umount -d /tmp/iso$$
  22.681 -	rm -rf /tmp/iso$$
  22.682 -}
  22.683 -
  22.684 -# Show new boot floppy set
  22.685 -dialogwritefloppyset()
  22.686 -{
  22.687 -	if ! list_floppy check; then
  22.688 -		du -h fd???.img
  22.689 -		return
  22.690 -	fi
  22.691 -	while true; do
  22.692 -	exec 3>&1
  22.693 -	IMAGE=`$DIALOG --title " Write floppy image " \
  22.694 -		--backtitle "Boot floppy set creation on $DEVICE" --clear \
  22.695 -		--colors --radiolist "
  22.696 -    Insert a blank floppy in drive and
  22.697 -select the floppy image you want to write.
  22.698 -" 18 46 46 \
  22.699 -		$(on="on"; for i in fd???.img; do echo "$i $(du -h $i | cut -f1) $on "; on="off"; done) 2>&1 1>&3`
  22.700 -	retval=$?
  22.701 -	exec 3>&-
  22.702 -	check_retval
  22.703 -	dd if=$IMAGE of=$DEVICE
  22.704 -	done
  22.705 -}
  22.706 -
  22.707 -dialognofloppyset()
  22.708 -{
  22.709 -	cat << EOT
  22.710 -The boot loader can't load the kernel and the initramfs in the first 16MB
  22.711 -of RAM. The total size exceeds 15MB. No floppy image is created.
  22.712 -EOT
  22.713 -}
  22.714 -
  22.715 -# Check for iso 9660 image
  22.716 -isiso()
  22.717 -{
  22.718 -	mkdir /tmp/iso$$
  22.719 -	mount -o loop,ro $1 /tmp/iso$$ 2> /dev/null
  22.720 -	status=$?
  22.721 -	umount -d /tmp/iso$$ 2> /dev/null
  22.722 -	rm -rf /tmp/iso$$
  22.723 -	return $status
  22.724 -}
  22.725 -
  22.726 -dialogfloppyset()
  22.727 -{
  22.728 -	: ${DIALOG=dialog}
  22.729 -	while true; do
  22.730 -	exec 3>&1
  22.731 -	KERNEL=`$DIALOG --title " Select a Linux kernel or a SliTaz iso " \
  22.732 -		--backtitle "Boot floppy set creation on $DEVICE" --clear \
  22.733 -		--colors --fselect "$PWD" 10 70 \
  22.734 -		2>&1 1>&3`
  22.735 -	retval=$?
  22.736 -	exec 3>&-
  22.737 -	check_retval
  22.738 -	[ -f $KERNEL ] && break
  22.739 -	done
  22.740 -	if isiso $KERNEL ; then
  22.741 -		bootfloppybox call mkisofloppies $KERNEL
  22.742 -		dialogwritefloppyset
  22.743 -		return
  22.744 -	fi
  22.745 -	exec 3>&1
  22.746 -	INITRD=`$DIALOG --title " Select an Initramfs " \
  22.747 -		--backtitle "Boot floppy set creation on $DEVICE" --clear \
  22.748 -		--colors --fselect "$PWD" 10 70 \
  22.749 -		2>&1 1>&3`
  22.750 -	retval=$?
  22.751 -	exec 3>&-
  22.752 -	check_retval
  22.753 -	[ -f "$INITRD" ] || INITRD=""
  22.754 -	exec 3>&1
  22.755 -	CMDLINE=`$DIALOG --title " Enter boot command line " \
  22.756 -		--backtitle "Boot floppy set creation on $DEVICE" --clear \
  22.757 -		--colors --inputbox "Kernel command line" 10 70 "rw root=/dev/null autologin" \
  22.758 -		2>&1 1>&3`
  22.759 -	retval=$?
  22.760 -	exec 3>&-
  22.761 -	check_retval
  22.762 -	bootfloppybox call mkfloppies "$KERNEL" "$INITRD" "$CMDLINE" &&
  22.763 -	dialogwritefloppyset ||
  22.764 -	dialognofloppyset
  22.765 -}
  22.766 -
  22.767 -#
  22.768 -# Create floppy image set
  22.769 -#
  22.770 -export IMAGE_SET='
  22.771 -<window title="Image set generator" icon-name="gtk-floppy">
  22.772 -  <vbox>
  22.773 -    <text use-markup="true">
  22.774 -      <label>
  22.775 -"
  22.776 -<b>Create a boot floppy set</b>
  22.777 -"
  22.778 -      </label>
  22.779 -    </text>
  22.780 -    <notebook labels="Slitaz only|Any Linux">
  22.781 -    <frame Slitaz only (no size limit)>
  22.782 -    <vbox>
  22.783 -    <text wrap="false" width-chars="44" use-markup="true">
  22.784 -      <label>
  22.785 -"
  22.786 -Slitaz uses a floppy boot flavor as a first
  22.787 -stage boot to break the tiny loader 15MB limit.
  22.788 -"
  22.789 -      </label>
  22.790 -    </text>
  22.791 -    <hbox>
  22.792 -      <text use-markup="true">
  22.793 -        <label>"<b>Slitaz ISO : </b>"</label>
  22.794 -      </text>
  22.795 -      <entry accept="filename">
  22.796 -        <label>Select a Slitaz ISO image</label>
  22.797 -        <variable>ISO</variable>
  22.798 -      </entry>
  22.799 -      <button>
  22.800 -        <input file stock="gtk-open"></input>
  22.801 -        <action type="fileselect">ISO</action>
  22.802 -      </button>
  22.803 -    </hbox>
  22.804 -    <hbox>
  22.805 -      <text use-markup="true">
  22.806 -        <label>"<b>Output directory : </b>"</label>
  22.807 -      </text>
  22.808 -      <entry accept="directory">
  22.809 -        <label>Select output directory</label>
  22.810 -        <variable>FILE_DIRECTORY</variable>
  22.811 -        <default>/tmp</default>
  22.812 -      </entry>
  22.813 -      <button>
  22.814 -        <input file stock="gtk-open"></input>
  22.815 -        <action type="fileselect">FILE_DIRECTORY</action>
  22.816 -      </button>
  22.817 -    </hbox>
  22.818 -    <hbox>
  22.819 -      <button>
  22.820 -        <input file icon="forward"></input>
  22.821 -        <label>Create image set from ISO boot</label>
  22.822 -	<action>cd $FILE_DIRECTORY; bootfloppybox call mkisofloppiesxterm $ISO</action>
  22.823 -        <action type="closewindow">IMAGE_SET</action>
  22.824 -      </button>
  22.825 -    </hbox>
  22.826 -    </vbox>
  22.827 -    </frame>
  22.828 -    <frame Any Linux distribution (max total size 14-15MB)>
  22.829 -    <vbox>
  22.830 -    <text wrap="false" width-chars="44" use-markup="true">
  22.831 -      <label>
  22.832 -"
  22.833 -The total size of the kernel and the initramfs must be
  22.834 -lower than 14-15MB due to the tiny boot loader design.
  22.835 -"
  22.836 -      </label>
  22.837 -    </text>
  22.838 -    <hbox>
  22.839 -      <text use-markup="true">
  22.840 -        <label>"<b>Kernel      : </b>"</label>
  22.841 -      </text>
  22.842 -      <entry accept="filename">
  22.843 -        <label>Select a linux kernel</label>
  22.844 -        <variable>KERNEL</variable>
  22.845 -      </entry>
  22.846 -      <button>
  22.847 -        <input file stock="gtk-open"></input>
  22.848 -        <action type="fileselect">KERNEL</action>
  22.849 -      </button>
  22.850 -    </hbox>
  22.851 -    <hbox>
  22.852 -      <text use-markup="true">
  22.853 -        <label>"<b>Initramfs : </b>"</label>
  22.854 -      </text>
  22.855 -      <entry accept="filename">
  22.856 -        <label>Select an initramfs/initrd file</label>
  22.857 -        <variable>INITRD</variable>
  22.858 -      </entry>
  22.859 -      <button>
  22.860 -        <input file stock="gtk-open"></input>
  22.861 -        <action type="fileselect">INITRD</action>
  22.862 -      </button>
  22.863 -    </hbox>
  22.864 -    <hbox>
  22.865 -      <text use-markup="true">
  22.866 -        <label>"<b>Cmdline   : </b>"</label>
  22.867 -      </text>
  22.868 -      <entry>
  22.869 -        <label>Enter kernel arguments</label>
  22.870 -        <variable>CMDLINE</variable>
  22.871 -        <default>rw root=/dev/null autologin</default>
  22.872 -      </entry>
  22.873 -    </hbox>
  22.874 -    <hbox>
  22.875 -      <text use-markup="true">
  22.876 -        <label>"<b>Output directory : </b>"</label>
  22.877 -      </text>
  22.878 -      <entry accept="directory">
  22.879 -        <label>Select output directory</label>
  22.880 -        <variable>OUTPUT_DIRECTORY</variable>
  22.881 -        <default>/tmp</default>
  22.882 -      </entry>
  22.883 -      <button>
  22.884 -        <input file stock="gtk-open"></input>
  22.885 -        <action type="fileselect">OUTPUT_DIRECTORY</action>
  22.886 -      </button>
  22.887 -    </hbox>
  22.888 -    <hbox>
  22.889 -      <button>
  22.890 -        <input file icon="forward"></input>
  22.891 -        <label>Create image set</label>
  22.892 -	<action>cd $OUTPUT_DIRECTORY; bootfloppybox call mkfloppies "$KERNEL" "$INITRD" "$CMDLINE"</action>
  22.893 -        <action type="closewindow">IMAGE_SET</action>
  22.894 -      </button>
  22.895 -    </hbox>
  22.896 -    </vbox>
  22.897 -    </frame>
  22.898 -    </notebook>
  22.899 -    <hbox>
  22.900 -      <button>
  22.901 -        <input file icon="gtk-close"></input>
  22.902 -        <action type="closewindow">IMAGE_SET</action>
  22.903 -      </button>
  22.904 -    </hbox>
  22.905 -  </vbox>
  22.906 -</window>
  22.907 -'
  22.908 -
  22.909 -#
  22.910 -# Read/write floppy images
  22.911 -#
  22.912 -export FLOPPY_IMAGE='
  22.913 -<window title="Floppy image manager" icon-name="gtk-floppy">
  22.914 -  <vbox>
  22.915 -    <frame Floppy disk drive>
  22.916 -      <hbox>
  22.917 -        <text use-markup="true">
  22.918 -          <label>"<b>Device : </b>"</label>
  22.919 -        </text>
  22.920 -	<combobox>
  22.921 -          <variable>DEVICE</variable>'
  22.922 -FLOPPY_DEV=""
  22.923 -for i in $(list_floppy); do
  22.924 -	FLOPPY_DEV="$FLOPPY_DEV
  22.925 -	  <item>/dev/$i</item>"
  22.926 -done
  22.927 -	FLOPPY_IMAGE="$FLOPPY_IMAGE$FLOPPY_DEV
  22.928 -	</combobox>
  22.929 -        <button>
  22.930 -          <label>Format floppy</label>
  22.931 -          <input file icon=\"media-floppy\"></input>
  22.932 -	  <action>fdformat -n $DEVICE</action>
  22.933 -        </button>
  22.934 -      </hbox>
  22.935 -    </frame>
  22.936 -    <frame Floppy image file>
  22.937 -      <hbox>
  22.938 -        <text use-markup=\"true\">
  22.939 -          <label>\"<b>File : </b>\"</label>
  22.940 -        </text>
  22.941 -        <entry accept=\"filename\">
  22.942 -          <label>Select a floppy image</label>
  22.943 -          <variable>IMAGE</variable>
  22.944 -        </entry>
  22.945 -        <button>
  22.946 -          <input file stock=\"gtk-open\"></input>
  22.947 -          <action type=\"fileselect\">IMAGE</action>
  22.948 -        </button>
  22.949 -      </hbox>
  22.950 -    </frame>
  22.951 -    <hbox>
  22.952 -      <button>
  22.953 -        <input file icon=\"reload\"></input>
  22.954 -        <label>Create image set</label>
  22.955 -	<action type=\"launch\">IMAGE_SET</action>
  22.956 -      </button>
  22.957 -      <button>
  22.958 -        <input file icon=\"go-jump\"></input>
  22.959 -        <label>Write image to floppy</label>
  22.960 -        <action>dd if=\$IMAGE of=\$DEVICE</action>
  22.961 -      </button>
  22.962 -      <button>
  22.963 -        <input file icon=\"undo\"></input>
  22.964 -        <label>Get floppy image</label>
  22.965 -        <action>dd if=\$DEVICE of=\$IMAGE</action>
  22.966 -      </button>
  22.967 -      <button>
  22.968 -        <input file icon=\"gtk-close\"></input>
  22.969 -        <action type=\"closewindow\">FLOPPY_IMAGE</action>
  22.970 -      </button>
  22.971 -    </hbox>
  22.972 -  </vbox>
  22.973 -</window>
  22.974 -"
  22.975 -
  22.976 -gtkdialogshowfloppyset()
  22.977 -{
  22.978 -#
  22.979 -# Show floppy image set
  22.980 -#
  22.981 -IMAGE_SHOW='
  22.982 -<window title="Image set" icon-name="gtk-floppy">
  22.983 -  <vbox>
  22.984 -    <text use-markup="true">
  22.985 -      <label>
  22.986 -"
  22.987 -<b>Boot floppy images</b>
  22.988 -"
  22.989 -      </label>
  22.990 -    </text>
  22.991 -    <tree>
  22.992 -        <width>50</width><height>140</height>
  22.993 -    	<label>Size|File</label>
  22.994 -    	<input>du -h fd???.img | sed "s/\t/|/" </input>
  22.995 -    </tree>
  22.996 -    <hbox>
  22.997 -'
  22.998 -	[ 0$1 -gt $((15 * 1024 * 1024)) ] &&  IMAGE_SHOW="$IMAGE_SHOW
  22.999 -    <frame WARNING>
 22.1000 -    <text>
 22.1001 -      <label>
 22.1002 -\"This floppy set breaks the 15MB limit ($1 bytes).
 22.1003 -It may not be able to complete the boot process.\"
 22.1004 -      </label>
 22.1005 -    </text>
 22.1006 -    </frame>
 22.1007 -    </hbox>
 22.1008 -    <hbox>
 22.1009 -"
 22.1010 -	list_floppy check && IMAGE_SHOW="$IMAGE_SHOW
 22.1011 -      <button>
 22.1012 -        <input file icon=\"media-floppy\"></input>
 22.1013 -	<label>Manage images</label>
 22.1014 -	<action type=\"launch\">FLOPPY_IMAGE</action>
 22.1015 -      </button>
 22.1016 -"
 22.1017 -	IMAGE_SHOW="$IMAGE_SHOW
 22.1018 -      <button>
 22.1019 -        <input file icon=\"gtk-close\"></input>
 22.1020 -        <action type=\"closewindow\">IMAGE_SET</action>
 22.1021 -      </button>
 22.1022 -    </hbox>
 22.1023 -  </vbox>
 22.1024 -</window>
 22.1025 -"
 22.1026 -	export IMAGE_SHOW
 22.1027 -	gtkdialog --program=IMAGE_SHOW
 22.1028 -}
 22.1029 -
 22.1030 -while true; do
 22.1031 -
 22.1032 -if [ "$1" == "call" ]; then
 22.1033 -	case "$2" in
 22.1034 -	mkmenu) mkmenu $3;;
 22.1035 -	mkisofloppiesxterm)
 22.1036 -		shift 2
 22.1037 -		xterm -geometry 80x16 -title "Build boot floppies from ISO" \
 22.1038 -			-e "$0 call mkisofloppies $@ ; echo -e \"----\nENTER to continue...\" && read close"
 22.1039 -		gtkdialogshowfloppyset
 22.1040 -		;;
 22.1041 -	mkisofloppies)
 22.1042 -		shift 2
 22.1043 -		floppysetfromiso $@
 22.1044 -		;;
 22.1045 -	mkfloppies)
 22.1046 -		shift 2
 22.1047 -		floppyset "$@"
 22.1048 -		sz=$(cat fd???.img | wc -c)
 22.1049 -		if [ -n "$XAUTHORITY" ]; then
 22.1050 -			gtkdialogshowfloppyset $sz
 22.1051 -		else
 22.1052 -			if [ $sz -gt $((15 * 1024 * 1024)) ]; then
 22.1053 -				cat <<EOT
 22.1054 -This floppy set breaks the 15MB limit ($sz bytes).
 22.1055 -It may not be able to complete the boot process.
 22.1056 -EOT
 22.1057 -			fi
 22.1058 -		fi
 22.1059 -		;;
 22.1060 -	install)
 22.1061 -		DIR=/tmp/mkbootfloppy$$
 22.1062 -		mkdir -p $DIR
 22.1063 -		DEVICE=$4
 22.1064 -		file=$5
 22.1065 -		case "$3" in
 22.1066 -		dialog*)
 22.1067 -			shift 2
 22.1068 -			$@
 22.1069 -			;;
 22.1070 -		grub*)
 22.1071 -			mkdir -p $DIR/boot/grub
 22.1072 -			[ -f /usr/share/boot/btmgr -a -f /usr/share/boot/memdisk.lzma ] \
 22.1073 -				&& cat /usr/share/boot/btmgr /dev/zero | \
 22.1074 -				   dd bs=18k count=80 | gzip -9 > \
 22.1075 -				   $DIR/boot/btmgr.gz \
 22.1076 -				&& unlzma -c /usr/share/boot/memdisk.lzma > \
 22.1077 -					$DIR/boot/memdisk
 22.1078 -			[ -f /usr/share/boot/plpbt.bin ] \
 22.1079 -			  	&& cp /usr/share/boot/plpbt.bin $DIR/boot
 22.1080 -			[ -f /usr/share/boot/etherboot ] \
 22.1081 -				&& cp /usr/share/boot/etherboot $DIR/boot
 22.1082 -			[ -f /boot/gpxe ]\
 22.1083 -				&& cp /boot/gpxe $DIR/boot
 22.1084 -			[ -f /usr/share/boot/memtest.lzma -a \
 22.1085 -			  -f /usr/share/boot/memdisk.lzma ] \
 22.1086 -				&& unlzma -c /usr/share/boot/memtest.lzma | \
 22.1087 -				   cat - /dev/zero | dd bs=18k count=80 | \
 22.1088 -				   gzip -9 > $DIR/boot/memtest.gz \
 22.1089 -				&& unlzma -c /usr/share/boot/memdisk.lzma > \
 22.1090 -					$DIR/boot/memdisk
 22.1091 -			install_grub $DIR $3
 22.1092 -			;;
 22.1093 -		*)
 22.1094 -    			case "$file" in
 22.1095 -    			*.lzma) action="unlzma -c";;
 22.1096 -    			*.gz)   action="zcat";;
 22.1097 -    			*)      action="cat";;
 22.1098 -    			esac
 22.1099 -			case "$DEVICE" in
 22.1100 -			/dev/*) $action $file > $DEVICE;;
 22.1101 -			flopp*) $action $file | cat - /dev/zero | \
 22.1102 -						dd bs=18k count=80 > boot.fd;;
 22.1103 -			cdrom*)
 22.1104 -				mkdir -p $DIR/boot/grub
 22.1105 -				case "$3" in
 22.1106 -				btmgr|memtest)
 22.1107 -					$action $file | cat - /dev/zero | \
 22.1108 -						dd bs=18k count=80 | \
 22.1109 -						gzip -9 > $DIR/boot/$3.gz
 22.1110 -					unlzma -c /usr/share/boot/memdisk.lzma \
 22.1111 -						> $DIR/boot/memdisk
 22.1112 -					cat > /tmp/floppybox.grub.menu << EOT
 22.1113 -# grub menu
 22.1114 -timeout 0
 22.1115 -title $3
 22.1116 -kernel /boot/memdisk floppy c=80 h=2 s=18
 22.1117 -initrd /boot/$3.gz
 22.1118 -EOT
 22.1119 -					;;
 22.1120 -				*)	$action $file > $DIR/boot/$3
 22.1121 -					cat > /tmp/floppybox.grub.menu << EOT
 22.1122 -# grub menu
 22.1123 -timeout 0
 22.1124 -title $3
 22.1125 -kernel /boot/$3
 22.1126 -EOT
 22.1127 -					;;
 22.1128 -				esac
 22.1129 -				install_grub $DIR grub
 22.1130 -				;;
 22.1131 -			esac
 22.1132 -			;;
 22.1133 -		esac
 22.1134 -		rm -rf $DIR
 22.1135 -		;;
 22.1136 -	get-plop)
 22.1137 -		mkdir -p /tmp/get-plop$$
 22.1138 -		PLOP_URL=http://mirror.slitaz.org/boot/plpbt.bin
 22.1139 -		wget -O - $PLOP_URL  > /tmp/get-plop$$/plpbt.bin
 22.1140 -		VERSION="$(strings /tmp/get-plop$$/plpbt.bin \
 22.1141 -		  | grep 'Boot Manager v' | sed 's/.* v\([0-9\.]*\) .*/\1/')"
 22.1142 -		mkdir -p $(dirname /tmp/get-plop$$/plop-$VERSION/fs/$3)
 22.1143 -		mv /tmp/get-plop$$/plpbt.bin \
 22.1144 -		   /tmp/get-plop$$/plop-$VERSION/fs/$3
 22.1145 -		if [ -s /tmp/get-plop$$/plop-$VERSION/fs/$3 ]; then 
 22.1146 -			cat > /tmp/get-plop$$/plop-$VERSION/receipt <<EOT
 22.1147 -PACKAGE="plop"
 22.1148 -VERSION="$VERSION"
 22.1149 -CATEGORY="non-free"
 22.1150 -SHORT_DESC="Plop boot manager."
 22.1151 -WEB_SITE="http://www.plop.at/en/bootmanager.html"
 22.1152 -EOT
 22.1153 -			( cd /tmp/get-plop$$ ; tazpkg pack plop-$VERSION )
 22.1154 -			tazpkg install /tmp/get-plop$$/plop-$VERSION.tazpkg
 22.1155 -		fi
 22.1156 -		rm -rf /tmp/get-plop$$
 22.1157 -		;;
 22.1158 -	*)	echo "Invalid command $0 $@" 1>&2
 22.1159 -		exit 1;;
 22.1160 -	esac
 22.1161 -	exit 0
 22.1162 -fi
 22.1163 -
 22.1164 -if [ -z "$XAUTHORITY" ]; then
 22.1165 -
 22.1166 -    : ${DIALOG=dialog}
 22.1167 -    
 22.1168 -    DEVICE=/dev/fd0
 22.1169 -    list_floppy check || DEVICE="floppy"
 22.1170 -    while true; do
 22.1171 -	exec 3>&1
 22.1172 -	ID_SOURCE=`$DIALOG --title " Choose a boot floppy " \
 22.1173 -		--backtitle "Boot Floppy Creation on $DEVICE" --clear \
 22.1174 -		--extra-button --extra-label "Change floppy" \
 22.1175 -		--colors --radiolist "
 22.1176 -Create a floppy or a cdrom to boot a LiveCD in a PXE network...
 22.1177 -May need a floppy disk in drive. Erase the whole floppy disk.
 22.1178 -		" 18 70 50\
 22.1179 -		FloppySet	"Boot Slitaz with floppies only." on \
 22.1180 -		SmartBtmgr	"Boot any partition or ATAPI CD-ROM." off \
 22.1181 -		Plop		"Boot USB harddisk floppy or CD/DVD." off \
 22.1182 -		Etherboot	"Replacement for proprietary PXE ROMs." off \
 22.1183 -		gPXE		"Boot from http://boot.slitaz.org/" off \
 22.1184 -		Memtest86+	"Memory failures detection tool." off \
 22.1185 -		Grub4DOS	"Enhanced grub version supporting NTFS." off \
 22.1186 -		Grub		"Boot loader with command shell." off \
 22.1187 -		2>&1 1>&3`
 22.1188 -	retval=$?
 22.1189 -	exec 3>&-
 22.1190 -	check_retval
 22.1191 -	if [ "$retval" = "3" ]; then
 22.1192 -		select_floppy
 22.1193 -		continue;
 22.1194 -	fi
 22.1195 -	while read key file pkg; do
 22.1196 -		[ "$key" = "$ID_SOURCE" ] || continue
 22.1197 -		if [ ! -f "$file" ]; then
 22.1198 -			$DIALOG --title " Install package " --colors \
 22.1199 -				--backtitle "Boot Floppy Creation" --clear \
 22.1200 -				--yes-label "Install" \
 22.1201 -				--no-label "Quit" \
 22.1202 -				--yesno "The package $pkg is not yet installed. Install it ?" 18 70
 22.1203 -			retval=$?
 22.1204 -			if [ "$pkg" = "plop" ]; then
 22.1205 -				bootfloppybox call get-plop $file
 22.1206 -			else
 22.1207 -				tazpkg get-install $pkg
 22.1208 -			fi
 22.1209 -		fi
 22.1210 -		bootfloppybox call install "$pkg" "$DEVICE" "$file"
 22.1211 -		exit 0
 22.1212 -	done <<EOT
 22.1213 -FloppySet /bin/dd dialogfloppyset
 22.1214 -SmartBtmgr /usr/share/boot/btmgr btmgr
 22.1215 -Plop /usr/share/boot/plpbt.bin plop
 22.1216 -Etherboot /usr/share/boot/etherboot etherboot
 22.1217 -gPXE /boot/gpxe gpxe
 22.1218 -Memtest86+ /usr/share/boot/memtest.lzma memtest
 22.1219 -Grub4DOS /usr/share/boot/grldr.lzma grub4dos
 22.1220 -Grub /usr/sbin/grub grub
 22.1221 -EOT
 22.1222 -    done
 22.1223 -fi
 22.1224 -#
 22.1225 -# Describe gPXE arguments.
 22.1226 -#
 22.1227 -export HELP='
 22.1228 -<window title="gPXE forced url" icon-name="gtk-floppy">
 22.1229 -<vbox>
 22.1230 -  <text use-markup="true">
 22.1231 -    <label>"
 22.1232 -<b>Web boot parameters</b>"
 22.1233 -    </label>
 22.1234 -  </text>
 22.1235 -  <frame>
 22.1236 -    <text wrap="true" width-chars="58" use-markup="true">
 22.1237 -      <label>
 22.1238 -"Without parameters (i.e. with an empty Boot URL) gPXE will perform a normal PXE boot: IP configuration with DHCP and download the DHCP bootfile with TFTP.
 22.1239 -
 22.1240 -You can override the DHCP bootfile with a Boot URL such as <i>tftp://192.168.0.1/pxe/pxeloader</i>, <i>http://mirror.slitaz.org/pxe/pxelinux.0</i>, or <i>x-tftm://192.168.0.201//lts/vmlinuz.ltsp</i>.
 22.1241 -
 22.1242 -You can override the IP configuration too (useful without a DHCP server), example: <i>ip=192.168.0.10/24 gw=192.168.0.1 dns=192.168.0.1 nodhcp url=http://mirror.slitaz.org/pxe/pxelinux.0</i>
 22.1243 -
 22.1244 -The <i>nodhcp</i> keyword avoids dhcp timeouts and the <i>url=</i> keyword is optional when the url is the only one argument.
 22.1245 -
 22.1246 -Comma separated URL lists are supported. The PXE client will try to load the first URL. If the load fails, it will try the next URL, and so on. 
 22.1247 -"
 22.1248 -      </label>
 22.1249 -    </text>
 22.1250 -  </frame>
 22.1251 -</vbox>
 22.1252 -</window>
 22.1253 -'
 22.1254 -#
 22.1255 -# Write bootfloppy image to floppy device.
 22.1256 -#
 22.1257 -BOOT_DIALOG='
 22.1258 -<window title="bootfloppybox" icon-name="gtk-floppy">
 22.1259 -  <vbox>
 22.1260 - 
 22.1261 -    <text use-markup="true">
 22.1262 -      <label>
 22.1263 -"
 22.1264 -<b>SliTaz - Bootfloppybox</b>"
 22.1265 -      </label>
 22.1266 -    </text>
 22.1267 -    <text wrap="false" width-chars="44" use-markup="true">
 22.1268 -      <label>
 22.1269 -"
 22.1270 -Create a floppy or a cdrom to boot a LiveCD in a PXE network or the WEB...
 22.1271 -May need a floppy disk in drive. Erase the whole floppy disk.
 22.1272 -"
 22.1273 -      </label>
 22.1274 -    </text>
 22.1275 -  
 22.1276 -    <frame Floppy disk drive>
 22.1277 -      <hbox>
 22.1278 -        <text use-markup="true">
 22.1279 -          <label>"<b>Device : </b>"</label>
 22.1280 -        </text>
 22.1281 -	<combobox>
 22.1282 -          <variable>DEVICE</variable>'
 22.1283 -FLOPPY_DEV=""
 22.1284 -for i in $(list_floppy); do
 22.1285 -	FLOPPY_DEV="$FLOPPY_DEV
 22.1286 -	  <item>/dev/$i</item>"
 22.1287 -done
 22.1288 -	BOOT_DIALOG="$BOOT_DIALOG$FLOPPY_DEV
 22.1289 -	  <item>floppy image (boot.fd)</item>
 22.1290 -	  <item>cdrom image (boot.iso)</item>
 22.1291 -	</combobox>"
 22.1292 -if [ -n "$FLOPPY_DEV" ]; then
 22.1293 -	tmp='
 22.1294 -        <button>
 22.1295 -          <label>Format floppy</label>
 22.1296 -          <input file icon="media-floppy"></input>
 22.1297 -	  <action>case "$DEVICE" in /dev/*) fdformat -n $DEVICE;; esac</action>
 22.1298 -        </button>'
 22.1299 -	BOOT_DIALOG="$BOOT_DIALOG$tmp"
 22.1300 -fi
 22.1301 -tmp='
 22.1302 -      </hbox>
 22.1303 -    </frame>
 22.1304 -    <notebook labels="Set|LiveCD|USB|PXE Network|WEB Network|Memory Test|Windows|Expert">
 22.1305 -    <frame Boot floppy set (many floppies)>
 22.1306 -      <vbox>
 22.1307 -      <hbox>
 22.1308 -        <text wrap="true" width-chars="58" use-markup="true">
 22.1309 -          <label>
 22.1310 -"
 22.1311 -Only people without a CD-ROM, USB and Network should use a floppy set. 
 22.1312 -The images are built from an ISO boot or from a Linux kernel, an initramfs
 22.1313 -and a boot command line. Non Slitaz boot floppy sets are limited to 15MB.
 22.1314 -"
 22.1315 -          </label>
 22.1316 -        </text>
 22.1317 -      </hbox>
 22.1318 -      <hbox>
 22.1319 -      <button>
 22.1320 -        <label>Create image set</label>
 22.1321 -        <input file icon="forward"></input>
 22.1322 -	<action type="launch">IMAGE_SET</action>
 22.1323 -      </button>
 22.1324 -      </hbox>
 22.1325 -      </vbox>
 22.1326 -    </frame>
 22.1327 -'  
 22.1328 -BOOT_DIALOG="$BOOT_DIALOG$tmp"
 22.1329 -while read name file pkg desc; do
 22.1330 -    tmp="<frame $name (single floppy)>
 22.1331 -      <hbox>
 22.1332 -    <text wrap=\"true\" width-chars=\"58\" use-markup=\"true\">
 22.1333 -      <label>
 22.1334 -\"
 22.1335 -$(echo -e $desc)
 22.1336 -\"
 22.1337 -      </label>
 22.1338 -    </text>
 22.1339 -      </hbox>
 22.1340 -      <hbox>
 22.1341 -"
 22.1342 -  if [ -f $file ]; then
 22.1343 -    if [ "$pkg" = "grub" -o "$pkg" = "grub4dos" ]; then
 22.1344 -      tmp="$tmp
 22.1345 -      <button>
 22.1346 -        <label>Grub menu</label>
 22.1347 -        <input file icon=\"accessories-text-editor\"></input>
 22.1348 -	<action>bootfloppybox call mkmenu $pkg</action>
 22.1349 -        <action type=\"lauch\">leafpad /tmp/floppybox.grub.menu</action>
 22.1350 -      </button>
 22.1351 -"
 22.1352 -    elif [ "$pkg" = "etherboot" ]; then
 22.1353 -      tmp="$tmp
 22.1354 -      <button>
 22.1355 -        <input file icon=\"browser\"></input>
 22.1356 -	<label>Wiki</label>
 22.1357 -	<action>browser http://doc.slitaz.org/en:guides:pxe &</action>
 22.1358 -      </button>
 22.1359 -"
 22.1360 -    elif [ "$pkg" = "gpxe" ]; then
 22.1361 -      tmp="$tmp
 22.1362 -      <text wrap=\"true\" use-markup=\"true\">
 22.1363 -        <label> \"<b>Boot URL:</b>\" </label>
 22.1364 -      </text>
 22.1365 -      <entry>
 22.1366 -	<default>$(dd if=$file bs=1 skip=519 count=255 2>/dev/null | strings)</default>
 22.1367 -        <variable>URL</variable>
 22.1368 -      </entry>
 22.1369 -      </hbox>
 22.1370 -      <hbox>
 22.1371 -      <button>
 22.1372 -        <input file icon=\"browser\"></input>
 22.1373 -	<label>Wiki</label>
 22.1374 -	<action>browser http://doc.slitaz.org/en:guides:pxe &</action>
 22.1375 -      </button>
 22.1376 -      <button help>
 22.1377 -	<action type=\"launch\">HELP</action>
 22.1378 -      </button>
 22.1379 -      <button>
 22.1380 -        <label>Update</label>
 22.1381 -        <input file icon=\"reload\"></input>
 22.1382 -	<action>echo -n \"\$URL\" | cat - /dev/zero | dd conv=notrunc bs=1 count=255 seek=519 of=$file 2>/dev/null</action>
 22.1383 -      </button>
 22.1384 -"
 22.1385 -    fi
 22.1386 -    receipt=/var/lib/tazpkg/installed/$pkg/receipt
 22.1387 -    if [ -f $receipt ]; then
 22.1388 -      . $receipt
 22.1389 -      tmp="$tmp
 22.1390 -      <button>
 22.1391 -        <input file icon=\"browser\"></input>
 22.1392 -	<label>Web</label>
 22.1393 -	<action>browser $WEB_SITE &</action>
 22.1394 -      </button>
 22.1395 -"
 22.1396 -    fi
 22.1397 -    tmp="$tmp
 22.1398 -      <button>
 22.1399 -        <label>Write floppy</label>
 22.1400 -        <input file icon=\"forward\"></input>
 22.1401 -	<action>bootfloppybox call install \"$pkg\" \"\$DEVICE\" \"$file\"</action>
 22.1402 -      </button>
 22.1403 -      </hbox>
 22.1404 -    </frame>
 22.1405 -"
 22.1406 -  else
 22.1407 -    tmp2="tazpkg get-install $pkg --forced"
 22.1408 -    [ "$pkg" = "plop" ] && tmp2="bootfloppybox call get-plop $file"
 22.1409 -    tmp="$tmp
 22.1410 -      <text wrap=\"true\" width-chars=\"34\" use-markup=\"true\">
 22.1411 -        <label>
 22.1412 -\"<i>The package <b>$pkg</b> is not yet installed</i>\"
 22.1413 -        </label>
 22.1414 -      </text>
 22.1415 -      <button>
 22.1416 -        <input file icon=\"go-jump\"></input>
 22.1417 -	<label>Install</label>
 22.1418 -	<action>[ -f /var/lib/tazpkg/packages.list ] || tazpkg recharge</action>
 22.1419 -	<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x17 -title \"$pkg install\" -e \"$tmp2 ; sleep 2\"</action>
 22.1420 -        <action type=\"exit\">restart</action>
 22.1421 -      </button>
 22.1422 -      </hbox>
 22.1423 -    </frame>
 22.1424 -"
 22.1425 -  fi
 22.1426 -  BOOT_DIALOG="$BOOT_DIALOG$tmp"
 22.1427 -done <<EOT
 22.1428 -SmartBtmgr /usr/share/boot/btmgr btmgr This OS independent Smart Boot Manager can boot \\\\nany partition or ATAPI CD-ROM.
 22.1429 -Plop /usr/share/boot/plpbt.bin plop This non free Boot Manager can boot a floppy disk, hardisk, USB or \\\\nCD/DVD. Hit Ctrl-ESC for text mode.
 22.1430 -Etherboot /usr/share/boot/etherboot etherboot This network bootloader provides a replacement \\\\nfor proprietary PXE or NBI ROMs.
 22.1431 -gPXE /boot/gpxe gpxe PXE / iSCSI / AoE network bootloader.
 22.1432 -Memtest86+ /usr/share/boot/memtest.lzma memtest Memory failures detection tool.
 22.1433 -Grub4DOS /usr/share/boot/grldr.lzma grub4dos Enhanced grub version supporting NTFS.
 22.1434 -Grub /usr/sbin/grub grub General purpose boot loader with command shell.
 22.1435 -EOT
 22.1436 -tmp='
 22.1437 -    </notebook>
 22.1438 -    <hbox>
 22.1439 -'
 22.1440 -BOOT_DIALOG="$BOOT_DIALOG$tmp"
 22.1441 -if [ -e /dev/cdrom ]; then
 22.1442 -tmp='
 22.1443 -      <button>
 22.1444 -        <input file icon="media-cdrom"></input>
 22.1445 -	<label>Burn cdrom image</label>
 22.1446 -	<action>burnbox</action>
 22.1447 -      </button>
 22.1448 -'
 22.1449 -BOOT_DIALOG="$BOOT_DIALOG$tmp"
 22.1450 -fi
 22.1451 -if list_floppy check; then
 22.1452 -tmp='
 22.1453 -      <button>
 22.1454 -        <input file icon="media-floppy"></input>
 22.1455 -	<label>Manage floppy image</label>
 22.1456 -	<action type="launch">FLOPPY_IMAGE</action>
 22.1457 -      </button>
 22.1458 -'
 22.1459 -BOOT_DIALOG="$BOOT_DIALOG$tmp"
 22.1460 -fi
 22.1461 -tmp='
 22.1462 -      <button>
 22.1463 -        <input file icon="exit"></input>
 22.1464 -	<label>Exit</label>
 22.1465 -        <action type="exit">Exit</action>
 22.1466 -      </button>
 22.1467 -    </hbox>
 22.1468 -  
 22.1469 -  </vbox>
 22.1470 -</window>
 22.1471 -'
 22.1472 -BOOT_DIALOG="$BOOT_DIALOG$tmp"
 22.1473 -export BOOT_DIALOG
 22.1474 -
 22.1475 -# Only root can create floppy.
 22.1476 -check_root
 22.1477 -gtkdialog --program=BOOT_DIALOG | grep -q 'EXIT="restart"' && continue
 22.1478 -rm -f /tmp/floppybox.grub.menu
 22.1479 -exit 0
 22.1480 -done
    23.1 --- a/tinyutils/burnbox	Sat Apr 28 20:13:13 2012 +0200
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,714 +0,0 @@
    23.4 -#!/bin/sh
    23.5 -# 
    23.6 -# Gtkdialog box to burn CD or DVD using Wodim with basic options. Burnbox
    23.7 -# can burn ISO images, blank rewritable CD or create audio CD with WAV.
    23.8 -# 
    23.9 -# (c) - SliTaz GNU/Linux 2009 - GNU GPL v3
   23.10 -
   23.11 -# Authors : Christophe Lincoln <pankso@slitaz.org>
   23.12 -#           Rohit Joshi <jozee@slitaz.org>
   23.13 -#
   23.14 -VERSION=20100315
   23.15 -TMPDIR="/tmp/burn-cd"
   23.16 -
   23.17 -chk_install()
   23.18 -{	
   23.19 -	for pkg in $@
   23.20 -	do
   23.21 -		if [ ! -d /var/lib/tazpkg/installed/${pkg} ]; then
   23.22 -			UNINSTALLED="$UNINSTALLED $pkg"
   23.23 -		fi			
   23.24 -	done 
   23.25 -	if [ ! "$UNINSTALLED" = "" ] ; then
   23.26 -		xterm -geometry 80x16 -title "INSTALL PACKAGE" \
   23.27 -				-e "echo -n \"This option depends on $UNINSTALLED. Please install and try again..\"; sleep 4;"
   23.28 -	fi	
   23.29 -}
   23.30 -
   23.31 -# Auto Install DEPENDS and/or SUGGESTED
   23.32 -install()
   23.33 -{
   23.34 -	#echo "pkgs to install: $1"
   23.35 -	for pkg in $1 ; do
   23.36 -	   # Avoid reinstall
   23.37 -		if [ ! -d /var/lib/tazpkg/installed/"$pkg" ]; then
   23.38 -			xterm -geometry 80x16 -title "INSTALL PACKAGE" \
   23.39 -				-e "	echo \"This option depends on $pkg. Installing $pkg as root: \" ;  subox tazpkg get-install $pkg --forced; sleep 2;
   23.40 -						echo -e \"----\nPress ENTER to close and PROCEED with decoding...\"; read i; exit 0;	"		
   23.41 -		fi
   23.42 -	done
   23.43 -	
   23.44 -}
   23.45 -
   23.46 -
   23.47 -# Check read write permission for device.
   23.48 -chk_rw_permissions()
   23.49 -{
   23.50 -	xterm -geometry 80x16 -title "Check Permission" \
   23.51 -		-e ' 
   23.52 -			if [ ! -r "$DEVICE"  -o   ! -w "$DEVICE" ]; then
   23.53 -				echo "You dont have read write permission for $DEVICE;  "
   23.54 -				echo "Add yourself to group cdrom: addgroup tux cdrom"								 		
   23.55 -			else
   23.56 -				echo "You have read write permission for $DEVICE. You can proceed to burn."					
   23.57 -			fi
   23.58 -			sleep 3;
   23.59 -		  '
   23.60 -}
   23.61 -
   23.62 -# Display audio cd size.
   23.63 -audio_cd_stats()
   23.64 -{
   23.65 -	AUDIO_CD_SIZE=`du -m $TMPDIR | awk '{print $1}'`
   23.66 -	TRACK_NB=`ls -1 $TMPDIR | wc -l`
   23.67 -	echo -n "Total $TRACK_NB tracks: $AUDIO_CD_SIZE Mb"
   23.68 -}
   23.69 -
   23.70 -
   23.71 -decode_ogg()
   23.72 -{
   23.73 -	if ls $TMPDIR | grep -q .ogg; then
   23.74 -		cd $TMPDIR
   23.75 -		xterm -geometry 80x16 -title "Oggdec" \
   23.76 -			-e 'for i in *.ogg; do oggdec "$i" && rm "$i"; done; sleep 2'
   23.77 -	fi
   23.78 -}
   23.79 -
   23.80 -decode_mp3()
   23.81 -{
   23.82 -	
   23.83 -	if ls $TMPDIR | grep -q .mp3; then
   23.84 -		cd $TMPDIR
   23.85 -		install "mpg123"
   23.86 -		
   23.87 -		xterm -geometry 80x16 -title "mpg123" \
   23.88 -				-e 'for file in *.mp3; do 
   23.89 -						mpg123 --rate 44100 --stereo --buffer 3072 --resync -w  `basename "$file" .mp3`.wav "$file" && rm -f "$file"; 
   23.90 -				  done; sleep 2'			  	
   23.91 -	fi
   23.92 -}
   23.93 -
   23.94 -decode_video()
   23.95 -{
   23.96 -	# convert videos into a VCD/SVCD/DVD compatible mpg video format
   23.97 -	if ls $TMPDIR | grep -q ".avi\|.mov\|.wmv\|.flv"  ; then
   23.98 -		cd $TMPDIR
   23.99 -		install "ffmpeg"
  23.100 -				
  23.101 -		xterm -geometry 80x16 -title "ffmpeg" \
  23.102 -				-e ' echo -n "Select target type (pal-vcd ntsc-vcd pal-svcd ntsc-svcd pal-dvd ntsc-dvd) "; read TARGET_OPTIONS
  23.103 -					 for file in *.avi *.wmv *.mov *.flv; do
  23.104 -						 ext=`echo "${file##*.}"`
  23.105 -						 output_file=`basename "$file" .$ext`.mpg
  23.106 -					 	 ffmpeg -i "$file" -target "$TARGET_OPTIONS" "$output_file" && rm "$file";
  23.107 -					 done; sleep 2;
  23.108 -				   '
  23.109 -	fi
  23.110 -	
  23.111 -
  23.112 -}
  23.113 -
  23.114 -# convert spaces in filename with _ and remove special characters "()'&" {}\! and translate uppercase to lowercase
  23.115 -fix_filename()
  23.116 -{
  23.117 -	ls /tmp/burn-cd/* | while read file
  23.118 -	do
  23.119 -    	mv "$file" `echo $file | tr ' ' '_' | tr -d '[{}(),\!&]' | tr -d "\'" | tr '[A-Z]' '[a-z]' | sed 's/_-_/_/g' `
  23.120 -	done 
  23.121 -	
  23.122 -}
  23.123 -
  23.124 -# We must think about " space " between directory/track and
  23.125 -# filter directory copy to avoid copying other files than audio.
  23.126 -# Only burning non-compressed wav format is supported directly.
  23.127 -
  23.128 -copy_audio_file()
  23.129 -{
  23.130 -	if ls "$NEW_TRACK" | grep -q .ogg; then
  23.131 -		cp "${NEW_TRACK%.ogg}.ogg" $TMPDIR
  23.132 -		fix_filename	
  23.133 -		decode_ogg 
  23.134 -	elif ls "$NEW_TRACK" | grep -q ".[m\|M][p\|P]3"; then
  23.135 -	  #	cp "${NEW_TRACK%.mp3}.mp3" $TMPDIR	
  23.136 -		cp "$NEW_TRACK" "$TMPDIR"	
  23.137 -		fix_filename
  23.138 -		decode_mp3
  23.139 -	else
  23.140 -		cp "${NEW_TRACK%.wav}.wav" $TMPDIR
  23.141 -	fi
  23.142 -}
  23.143 -
  23.144 -
  23.145 -copy_audio_dir()
  23.146 -{
  23.147 -	
  23.148 -	for i in .wav .ogg .mp3
  23.149 -	do
  23.150 -		cp "$NEW_DIR"/*$i $TMPDIR 2>/dev/null
  23.151 -	done
  23.152 -	fix_filename 
  23.153 -	decode_ogg  
  23.154 -	decode_mp3 
  23.155 -}
  23.156 -
  23.157 -# Only burning mpg video format is supported directly. MPEG-1 video for vcd and MPEG-2 for svcd and dvd
  23.158 -copy_video_file()
  23.159 -{
  23.160 -	if ls "$NEW_TRACK" | grep -q ".mpg\|.mpeg"; then
  23.161 -		cp "${NEW_TRACK%.mp*}.mpg" $TMPDIR
  23.162 -	elif ls "$NEW_TRACK" | grep -q ".avi\|.mov\|.wmv\|.flv"; then
  23.163 -	 	ext=`echo "${NEW_TRACK##*.}"`
  23.164 -		cp "${NEW_TRACK%.$ext}.$ext" $TMPDIR
  23.165 -		fix_filename
  23.166 -		if "$CHECKBOX_DECODE" ; then decode_video ; fi
  23.167 -	else
  23.168 -		echo "mpg format supported"
  23.169 -	fi
  23.170 -}
  23.171 -
  23.172 -copy_video_dir()
  23.173 -{
  23.174 -	for i in .mpg .avi .mov .wmv .mpeg .flv
  23.175 -	do
  23.176 -		cp "$NEW_DIR"/*$i $TMPDIR 2>/dev/null
  23.177 -	done
  23.178 -	fix_filename 	
  23.179 -	if "$CHECKBOX_DECODE" ; then decode_video ; fi
  23.180 -}
  23.181 -
  23.182 -copy_file()
  23.183 -{
  23.184 -	case "$BURN_MODE" in
  23.185 -			audio-cd) 
  23.186 -				copy_audio_file ;;
  23.187 -			vcd|svcd|video-dvd)
  23.188 -				copy_video_file ;;	
  23.189 -			*)	
  23.190 -				cp "$NEW_TRACK" $TMPDIR ; fix_filename ;;
  23.191 -	esac
  23.192 -	
  23.193 -}
  23.194 -
  23.195 -copy_dir()
  23.196 -{
  23.197 -	case "$BURN_MODE" in
  23.198 -			audio-cd) 
  23.199 -				copy_audio_dir ;;
  23.200 -			vcd|svcd|video-dvd)
  23.201 -				copy_video_dir ;;	
  23.202 -			*)	
  23.203 -				cp "$NEW_DIR" $TMPDIR 2>/dev/null 
  23.204 -				fix_filename ;;
  23.205 -	esac		
  23.206 -}
  23.207 -# =====ISO=====
  23.208 -burn_iso()
  23.209 -{
  23.210 -	xterm -geometry 80x16 -title "Wodim" \
  23.211 -		-e "wodim -v speed=$SPEED dev=$DEVICE $OPTIONS '$ISO_IMAGE'; sleep 4			
  23.212 -		"
  23.213 -}
  23.214 -# =====AUDIO=====
  23.215 -# Use -pad to avoid file size error.
  23.216 -burn_audio()
  23.217 -{
  23.218 -
  23.219 -	install "cdrkit"
  23.220 -	xterm -geometry 80x16 -title "Wodim:AUDIO" \
  23.221 -			-e " echo \"BURN TYPE SELECTED = $BURN_MODE \"; sleep 1;				
  23.222 -			 wodim -v speed=$SPEED dev=$DEVICE $OPTIONS -pad -dao -audio $TMPDIR/*.wav; sleep 4 
  23.223 -			 
  23.224 -		"
  23.225 -}
  23.226 -# =====DATA=====
  23.227 -burn_cddata()
  23.228 -{
  23.229 -	
  23.230 -	install "cdrkit"
  23.231 -
  23.232 -	xterm -geometry 80x16 -title "Wodim:CD DATA" \
  23.233 -			-e " echo \"BURN TYPE SELECTED = $BURN_MODE \"; sleep 1;
  23.234 -				wodim -v speed=$SPEED dev=$DEVICE $OPTIONS -pad -dao -data $TMPDIR/*; sleep 4 
  23.235 -				
  23.236 -			"
  23.237 -				
  23.238 -}
  23.239 -
  23.240 -burn_dvddata()
  23.241 -{
  23.242 -	# For multisession support, remove --dvd-compat option
  23.243 -	install "dvd+rw-tools"
  23.244 -
  23.245 -	xterm -geometry 80x16 -title "growisofs:DVD DATA" \
  23.246 -			-e " echo \"BURN TYPE SELECTED = $BURN_MODE \"; sleep 1;
  23.247 -				# no iso-file available
  23.248 -				growisofs -dvd-compat -speed=$SPEED -pad -J -r -f -Z  $DEVICE  $TMPDIR/*; sleep 4	
  23.249 -				"
  23.250 -}
  23.251 -
  23.252 -# ====VIDEO=====
  23.253 -burn_dvdvideo()
  23.254 -{
  23.255 -
  23.256 -	install "dvd+rw-tools"
  23.257 -	
  23.258 -	# current assumption: compatible dvd-video format
  23.259 -	xterm -geometry 80x16 -title "growisofs:DVD VIDEO" \
  23.260 -			-e " echo \"BURN TYPE SELECTED = $BURN_MODE\"; sleep 1;    
  23.261 -			   	 growisofs -dvd-video -udf -pad -J -r -f -Z $DEVICE -speed=$SPEED  $TMPDIR/*; sleep 2
  23.262 -				"	
  23.263 -		
  23.264 -}
  23.265 -
  23.266 -burn_vcd()
  23.267 -{
  23.268 -	
  23.269 -	install "vcdimager"
  23.270 -
  23.271 -	mkdir -p $TMPDIR/vcd
  23.272 -		xterm -geometry 80x16 -title "vcdimager:VCD" \
  23.273 -			-e " echo \"BURN TYPE SELECTED = $BURN_MODE $UNINSTALLED \"; sleep 1;
  23.274 -			   	 vcdimager -t vcd2 -l VCD -c $TMPDIR/vcd/vcd.cue -b $TMPDIR/vcd/vcd.bin $TMPDIR/*.mpg; sleep 2; 
  23.275 -				# cdrdao write --device $DEVICE $TMPDIR/vcd/vcd.cue; sleep 2
  23.276 -				  wodim -v speed=$SPEED dev=$DEVICE $OPTIONS -pad -dao cuefile=$TMPDIR/vcd/vcd.cue ; sleep 2				
  23.277 -				"	
  23.278 -	
  23.279 -		
  23.280 -}
  23.281 -
  23.282 -burn_svcd()
  23.283 -{
  23.284 -	
  23.285 -	install "vcdimager"
  23.286 -
  23.287 -	mkdir -p $TMPDIR/svcd
  23.288 -		xterm -geometry 80x16 -title "vcdimager:SVCD" \
  23.289 -			-e " echo \"BURN TYPE SELECTED = $BURN_MODE\"
  23.290 -				  vcdimager -t svcd -l SVCD -c $TMPDIR/svcd/svcd.cue -b $TMPDIR/svcd/svcd.bin $TMPDIR/*.mpg; sleep 2; 
  23.291 -				 # cdrdao write --device $DEVICE $TMPDIR/svcd/svcd.cue; sleep 2;
  23.292 -				 wodim -v speed=$SPEED dev=$DEVICE $OPTIONS -pad -dao cuefile=$TMPDIR/svcd/svcd.cue ; sleep 2
  23.293 -				"	
  23.294 -	
  23.295 -}
  23.296 -
  23.297 -# =====CLONE=====
  23.298 -
  23.299 -rip_disc()
  23.300 -{
  23.301 -	SUGGESTED="cdrkit-isoinfo"
  23.302 -	if ! "$CHECKBOX_FOLDER" ; then SAVE_DISC="/tmp/burn-cd" ; fi	
  23.303 -	if [ -d /var/lib/tazpkg/installed/${SUGGESTED} ]; then
  23.304 -		xterm -geometry 80x16 -title "dd" \
  23.305 -			-e ' echo "RIPPING DISC $DEVICE AT $SAVE_DISC..."
  23.306 -				 COUNT=`isoinfo -d -i $DEVICE | grep "^Volume size is:" | cut -d " " -f 4`
  23.307 -				 BLOCK=`isoinfo -d -i $DEVICE | grep "^Logical block size is:" | cut -d " " -f 5`
  23.308 -				 dd if=$DEVICE of=$SAVE_DISC/image.iso bs=$BLOCK count=$COUNT; sleep 4
  23.309 -				 sleep 2;
  23.310 -				# eject ;
  23.311 -			   '
  23.312 -	else 
  23.313 -		xterm -geometry 80x16 -title "dd" \
  23.314 -			-e '   echo "Though you dont have the cdrkit-isoinfo package installed, \
  23.315 -				          you can still rip but it may be slower."
  23.316 -					echo -n "Would you like to continue (y/N)? : "; read ans
  23.317 -					if [ "$ans" = "y" ]; then 
  23.318 -						echo "RIPPING DISC $DEVICE AT $SAVE_DISC...."
  23.319 -						dd if=$DEVICE of=$SAVE_DISC/image.iso; 
  23.320 -						sleep 2;
  23.321 -						#eject ;
  23.322 -					fi
  23.323 -				'
  23.324 -	fi	
  23.325 -	if ! "$CHECKBOX_FOLDER" ; then 
  23.326 -				ISO_IMAGE="/tmp/burn-cd/image.iso"
  23.327 -				xterm -geometry 80x16 -title "dd" \
  23.328 -			-e ' echo -e " ---Please insert EMPTY DISC at $DEVICE ---\n ---press ENTER to continue..." && read close;'
  23.329 -				burn_iso
  23.330 -	fi
  23.331 -}
  23.332 -
  23.333 -blank_dvd()
  23.334 -{
  23.335 -	xterm -geometry 80x16 -title "growisofs:DVD ERASE" \
  23.336 -		-e "growisofs -Z $DEVICE=/dev/zero"
  23.337 -}
  23.338 -
  23.339 -burn_disc()
  23.340 -{
  23.341 -  	case "$BURN_MODE" in
  23.342 -			audio*)
  23.343 -				burn_audio ;;
  23.344 -			data-cd*)
  23.345 -				burn_cddata ;;
  23.346 -			data-dvd*)
  23.347 -				burn_dvddata;;
  23.348 -			video*)
  23.349 -				burn_dvdvideo;;
  23.350 -			vcd*)
  23.351 -				burn_vcd;;
  23.352 -			svcd*)
  23.353 -				burn_svcd;;			
  23.354 -	esac
  23.355 -		
  23.356 -}
  23.357 -
  23.358 -track_list()
  23.359 -{
  23.360 -	for file in `ls $TMPDIR` ; do
  23.361 -		track_size=`du -m $TMPDIR/$file | awk '{print $1}'`
  23.362 -		echo "$file | $track_size"	
  23.363 -	done
  23.364 -}
  23.365 -
  23.366 -export BIN=$0
  23.367 -# Main GTK interface
  23.368 -MAIN_DIALOG='
  23.369 -<window title="SliTaz - Burnbox" icon-name="drive-optical">
  23.370 -<vbox>
  23.371 -
  23.372 -	<notebook labels=" Burn CD/DVD (Audio,Video,Data)| Backup Disc| Burn ISO | Help/Settings">
  23.373 -	
  23.374 -	<vbox>	
  23.375 -		<tree icon_name="audio-x-generic">
  23.376 -			<width>500</width><height>200</height>
  23.377 -			<variable>TRACKS_LIST</variable>
  23.378 -			<label>Track name (Double-click to remove a track) | Track Size (Mb)</label>
  23.379 -			<input>$BIN track_list</input>
  23.380 -			<action>rm "/tmp/burn-cd/$TRACKS_LIST"</action>
  23.381 -			<action>refresh:TRACKS_LIST</action>
  23.382 -			<action>refresh:TRACKS_SIZE</action>
  23.383 -		</tree>'
  23.384 -		
  23.385 -# Select burn audio-cd, data-cd, dvd-video or vcd/svcd		
  23.386 -MAIN_DIALOG=${MAIN_DIALOG}'
  23.387 -   <frame>
  23.388 -		  <hbox>
  23.389 -		   <text>
  23.390 -				<label> Select Burn type: </label>
  23.391 -			</text>
  23.392 -			<combobox>'
  23.393 -			tmp2="${MAIN_DIALOG}"
  23.394 -			for i in audio-cd data-cd data-dvd video-dvd vcd svcd; do
  23.395 -					[ "$i" = "$BURN_MODE" ] || tmp2="$tmp2<item>$i</item>"
  23.396 -			done
  23.397 -			tmp3='
  23.398 -			<variable>BURN_MODE</variable>						
  23.399 -			</combobox>
  23.400 -			<checkbox>
  23.401 -				<label> Enable decoding video</label>
  23.402 -				<variable>CHECKBOX_DECODE</variable>
  23.403 -				<default>true</default>											
  23.404 -			</checkbox>
  23.405 -			</hbox>
  23.406 -			'
  23.407 -MAIN_DIALOG="$tmp2$tmp3"
  23.408 -# Select, add and burn audio buttons.
  23.409 -MAIN_DIALOG=${MAIN_DIALOG}"
  23.410 -		<hbox>
  23.411 -			<text>
  23.412 -				<label> File:     </label>
  23.413 -			</text>
  23.414 -			<entry accept=\"filename\">
  23.415 -				<label>Select an Audio/Video/data track</label>
  23.416 -				<variable>NEW_TRACK</variable>
  23.417 -			</entry>
  23.418 -			<button>
  23.419 -			    <label>Browse</label>
  23.420 -				<input file stock=\"gtk-open\"></input>
  23.421 -				<action type=\"fileselect\">NEW_TRACK</action>
  23.422 -			</button>
  23.423 -			<button>
  23.424 -				<label>Add</label>
  23.425 -				<input file stock=\"gtk-add\"></input>
  23.426 -				<action>$0 copy_file</action>
  23.427 -				<action>refresh:TRACKS_LIST</action>
  23.428 -				<action>refresh:TRACKS_SIZE</action>				
  23.429 -			</button>
  23.430 -		</hbox>
  23.431 -		<hbox>
  23.432 -			<text>
  23.433 -				<label> Folder:</label>
  23.434 -			</text>
  23.435 -			<entry accept=\"directory\">
  23.436 -				<label>Select an Audio/Video/Data track</label>
  23.437 -				<variable>NEW_DIR</variable>
  23.438 -			</entry>
  23.439 -			<button>
  23.440 -			    <label>Browse</label>
  23.441 -				<input file stock=\"gtk-open\"></input>
  23.442 -				<action type=\"fileselect\">NEW_DIR</action>
  23.443 -			</button>
  23.444 -			<button>
  23.445 -				<label>Add</label>
  23.446 -				<input file stock=\"gtk-add\"></input>
  23.447 -				<action>$0 copy_dir</action>
  23.448 -				<action>refresh:TRACKS_LIST</action>
  23.449 -				
  23.450 -				<action>refresh:TRACKS_SIZE</action>
  23.451 -			</button>
  23.452 -		</hbox>"
  23.453 -
  23.454 -MAIN_DIALOG=${MAIN_DIALOG}"
  23.455 -		<hbox>
  23.456 -			<text>
  23.457 -				<variable>TRACKS_SIZE</variable>
  23.458 -				<input>$0 audio_cd_stats</input>
  23.459 -			</text>
  23.460 -			<button>
  23.461 -				<label>Clean</label>
  23.462 -				<input file stock=\"gtk-clear\"></input>
  23.463 -				<action>rm -rf $TMPDIR/*</action>
  23.464 -				<action>refresh:TRACKS_LIST</action>
  23.465 -				<action>refresh:TRACKS_SIZE</action>
  23.466 -				<action>clear:NEW_TRACK</action>
  23.467 -				<action>clear:NEW_DIR</action>
  23.468 -			</button>
  23.469 -			<button>
  23.470 -				<label>Burn disc</label>
  23.471 -				<input file icon=\"forward\"></input>
  23.472 -				<action>$0 burn_disc</action>
  23.473 -			</button>
  23.474 -		</hbox>
  23.475 -		</frame>
  23.476 -	</vbox> "
  23.477 -
  23.478 -# Backup CD
  23.479 -MAIN_DIALOG=${MAIN_DIALOG}'	
  23.480 -<vbox>	
  23.481 -	
  23.482 -		<text use-markup="true"> 
  23.483 -			<label>
  23.484 -			"
  23.485 -<b>Choose either the Data or the Audio CD backup frame </b>
  23.486 -"
  23.487 -		</label>
  23.488 -		</text> 
  23.489 -	
  23.490 - <frame Data CD/DVD backup >
  23.491 -   <text>
  23.492 -		<label> 
  23.493 -			"  " 
  23.494 -		</label>
  23.495 -	</text>
  23.496 -			<checkbox>
  23.497 -				<label>Save backup on Hard Disk Folder (Unselect to backup on CD disc)</label>
  23.498 -				<variable>CHECKBOX_FOLDER</variable>
  23.499 -				<default>true</default>
  23.500 -				<action>if true enable:SAVE_DISC</action>
  23.501 -				<action>if true enable:OPENBUTTON</action>
  23.502 -				<action>if false disable:SAVE_DISC</action>
  23.503 -				<action>if false disable:OPENBUTTON</action>				
  23.504 -			</checkbox>
  23.505 -			<hbox>
  23.506 -				<text use-markup="true">
  23.507 -					<label>"      Backup Folder Path:"</label>
  23.508 -				</text>
  23.509 -				<entry accept="directory">
  23.510 -				<label>Select a folder to save cloned disc to</label>
  23.511 -					<variable>SAVE_DISC</variable>
  23.512 -				</entry>
  23.513 -				<button>
  23.514 -				    <label>Browse</label>
  23.515 -					<input file stock="gtk-open"></input>
  23.516 -					<variable>OPENBUTTON</variable>
  23.517 -					<action type="fileselect">SAVE_DISC</action>
  23.518 -				</button>	
  23.519 -				</hbox>				
  23.520 -'
  23.521 -# Burn backup button.
  23.522 -MAIN_DIALOG=${MAIN_DIALOG}"
  23.523 -			<hbox>
  23.524 -			<text>
  23.525 -				<label>\"Proceed to backup your data CD: \" 	</label>
  23.526 -			</text>
  23.527 -			<button>
  23.528 -					<label>Backup DataCD</label>
  23.529 -					<variable>DATA_RIP</variable>
  23.530 -					<input file icon=\"forward\"></input>
  23.531 -					<action>$0 rip_disc</action>
  23.532 -				</button>
  23.533 -			</hbox>
  23.534 -			</frame>"			
  23.535 -MAIN_DIALOG=${MAIN_DIALOG}'		
  23.536 -	<frame Audio CD backup>	
  23.537 -		<text>
  23.538 -			<label> 
  23.539 -				"  " 
  23.540 -			</label>
  23.541 -		</text> 			 				
  23.542 -			<hbox>
  23.543 -			<text>
  23.544 -				<label> "Proceed to clone your audio CD:"</label>
  23.545 -			</text>
  23.546 -				<button>					
  23.547 -				<label> Backup AudioCD</label>
  23.548 -				<variable>AUDIO_RIP</variable>
  23.549 -				<input file icon="forward"></input>
  23.550 -				<action>asunder</action>
  23.551 -				</button>
  23.552 -	        </hbox>
  23.553 - </frame>
  23.554 -		
  23.555 -	</vbox>'
  23.556 -	
  23.557 -MAIN_DIALOG=${MAIN_DIALOG}'
  23.558 -	<vbox>
  23.559 -		<text use-markup="true"> 
  23.560 -			<label>
  23.561 -			"			 
  23.562 -			"
  23.563 -		</label>
  23.564 -		</text> 
  23.565 -		<frame Select ISO and burn>		
  23.566 -		<hbox>
  23.567 -		  <text>
  23.568 -		<label> 
  23.569 -			"  	" 
  23.570 -		</label>
  23.571 -		</text>
  23.572 -				<text use-markup="true">
  23.573 -					<label>"<b>ISO path:</b>"</label>
  23.574 -				</text>
  23.575 -				<entry>
  23.576 -					<variable>ISO_IMAGE</variable>
  23.577 -				</entry>
  23.578 -				<button>
  23.579 -				    <label>Browse</label>
  23.580 -					<input file stock="gtk-open"></input>
  23.581 -					<action type="fileselect">ISO_IMAGE</action>
  23.582 -				</button>
  23.583 -			</hbox>
  23.584 -			'
  23.585 -# Burn iso button.
  23.586 -MAIN_DIALOG=${MAIN_DIALOG}"
  23.587 -			<hbox>
  23.588 -				<button>
  23.589 -					<label>Burn ISO</label>
  23.590 -					<input file icon=\"forward\"></input>
  23.591 -					<action>$0 burn_iso</action>
  23.592 -				</button>
  23.593 -			</hbox>
  23.594 -			</frame>
  23.595 -			</vbox>"
  23.596 -
  23.597 -	
  23.598 -
  23.599 -#
  23.600 -#				
  23.601 -# tmp3=	
  23.602 -MAIN_DIALOG=${MAIN_DIALOG}'
  23.603 -	<vbox>
  23.604 -		<frame Information>
  23.605 -		
  23.606 -			<text width_request="250" use-markup="true">
  23.607 -				<label>
  23.608 -"Burnbox burns ISOs, backs up CD/DVDs, burns data CD/DVDs, audio CDs and video CDs (VCD/SVCD)
  23.609 -"
  23.610 -				</label>				
  23.611 -			</text>
  23.612 -			<hbox>
  23.613 -				<text use-markup="true">
  23.614 -					<label> "<b> Please consult HELP file if needed:  </b>"	</label>
  23.615 -				</text>
  23.616 -			  <button>
  23.617 -					<input file icon="help"></input>
  23.618 -					<action> browser file:///usr/share/doc/slitaz-tools/burnbox.html </action>
  23.619 -				</button>
  23.620 -				</hbox>
  23.621 -			
  23.622 -		</frame>
  23.623 -		<frame Settings>
  23.624 -		<text>
  23.625 -				<label>
  23.626 -"Before burning, please verify/change device writer settings below if needed.
  23.627 -"
  23.628 -				</label>
  23.629 -		</text>
  23.630 -		
  23.631 -			<hbox>
  23.632 -				<text use-markup="true">
  23.633 -					<label>"<b>Device:     </b>"</label>
  23.634 -				</text>
  23.635 -				<entry>
  23.636 -					<default>/dev/cdrom</default>
  23.637 -					<variable>DEVICE</variable>
  23.638 -				</entry>
  23.639 -			</hbox>
  23.640 -			<hbox>
  23.641 -				<text use-markup="true">
  23.642 -					<label>"<b>Speed:     </b>"</label>
  23.643 -				</text>
  23.644 -				<entry>
  23.645 -					<input>cat /proc/sys/dev/cdrom/info | grep "drive speed" | cut -f 3</input>
  23.646 -					<variable>SPEED</variable>
  23.647 -				</entry>
  23.648 -			</hbox>
  23.649 -			<hbox>
  23.650 -				<text use-markup="true">
  23.651 -					<label>"<b>Options:  </b>"</label>
  23.652 -				</text>
  23.653 -				<entry>
  23.654 -					<default>-eject -multi</default>
  23.655 -					<variable>OPTIONS</variable>
  23.656 -				</entry>
  23.657 -				<button>
  23.658 -					<input file icon="help"></input>
  23.659 -					<action>xterm -sb -geometry 95x25 -title "wodim help" -e "wodim --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
  23.660 -				</button>
  23.661 -			</hbox>	'
  23.662 -			
  23.663 -	   MAIN_DIALOG=${MAIN_DIALOG}'		
  23.664 -		</frame>
  23.665 -		<frame Blank CD/DVD-RW>
  23.666 -			<hbox>
  23.667 -				<text use-markup="true">
  23.668 -					<label>"<b>Option:   </b>"</label>
  23.669 -				</text>
  23.670 -				<entry>
  23.671 -					<variable>BLANK_OPTS</variable>
  23.672 -					<default>fast</default>
  23.673 -				</entry>
  23.674 -				<button>
  23.675 -					<input file icon="help"></input>
  23.676 -					<action>xterm -geometry 80x16 -title "wodim blank=help" -e "wodim blank=help ; echo -e \"----\nENTER to continue...\" && read close"</action>
  23.677 -				</button>
  23.678 -				<button>
  23.679 -					<label>Blank disc</label>
  23.680 -					<input file icon="forward"></input>
  23.681 -					<action>xterm -title "Wodim" -e "wodim -v -blank=$BLANK_OPTS dev=$DEVICE; sleep 2"</action>
  23.682 -				</button>
  23.683 -			</hbox>
  23.684 -		</frame>
  23.685 -	</vbox>'
  23.686 -export MAIN_DIALOG=${MAIN_DIALOG}'
  23.687 -	
  23.688 -	</notebook>' 
  23.689 -	MAIN_DIALOG=${MAIN_DIALOG}"<hbox>
  23.690 -			<button>				
  23.691 -					<input file icon=\"dialog-information\"></input>
  23.692 -					<label> Check Permissions for Device</label>
  23.693 -					<action>$0 chk_rw_permissions</action>
  23.694 -				</button> 
  23.695 -				"
  23.696 -	MAIN_DIALOG=${MAIN_DIALOG}'
  23.697 -			<button>
  23.698 -			<label>Exit</label>
  23.699 -			<input file icon="exit"></input>
  23.700 -			<action type="exit">Exit</action>
  23.701 -		</button>
  23.702 -	</hbox>
  23.703 -	
  23.704 -</vbox>
  23.705 -</window>
  23.706 -'
  23.707 -
  23.708 -# Script can be called with an arg to exec a function.
  23.709 -if [ -n "$1" ]; then
  23.710 -	$1
  23.711 -else
  23.712 -	mkdir -p $TMPDIR
  23.713 -	gtkdialog --center --program=MAIN_DIALOG >/dev/null
  23.714 -	rm -rf $TMPDIR
  23.715 -fi
  23.716 -
  23.717 -exit 0
    24.1 --- a/tinyutils/mountbox	Sat Apr 28 20:13:13 2012 +0200
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,183 +0,0 @@
    24.4 -#!/bin/sh
    24.5 -# 
    24.6 -# Gtkdialog box for the mount/umount commands. Part of SliTaz tools.
    24.7 -# libmountbox: /usr/lib/slitaz/libmountbox
    24.8 -#
    24.9 -# (C) 2009 - SliTaz GNU/Linux project.
   24.10 -#
   24.11 -VERSION=20090802
   24.12 -# Mountbox is only for root.
   24.13 -if test $(id -u) != 0 ; then
   24.14 -	exec subox mountbox
   24.15 -	exit 0
   24.16 -fi
   24.17 -
   24.18 -# Commom mount point in /mnt
   24.19 -mkdir -p /mnt/harddisk
   24.20 -
   24.21 -# Just basic help.
   24.22 -export HELP='
   24.23 -<window title="Mountbox - Help" icon-name="help">
   24.24 -<vbox>
   24.25 -	<text use-markup="true" width-chars="56">
   24.26 -		<label>"
   24.27 -<b>SliTaz Mountbox - Help</b>"
   24.28 -		</label>
   24.29 -	</text>
   24.30 -	
   24.31 -	<frame English>
   24.32 -		<text wrap="true" use-markup="true">
   24.33 -			<label>
   24.34 -"Mountbox lets you mount devices on mount points. A device 
   24.35 -can be a cdrom, flash key, USB disk or local HD partition.
   24.36 -Mount points are generated from /media and /mnt. Simply
   24.37 -select an unmounted device. Then type or select a folder 
   24.38 -to mount. Then press a button to mount a device.
   24.39 -"
   24.40 -			</label>
   24.41 -		</text>
   24.42 -	</frame>
   24.43 -	<frame Français>
   24.44 -		<text wrap="true" use-markup="true">
   24.45 -			<label>
   24.46 -"Mountbox permet de monter des périphériques (devices)
   24.47 -sur des points de montage. Un device peut être un cdrom,
   24.48 -une clé USB ou un disque dur local. La liste des points
   24.49 -de montage est généré depuis /media te /mnt.
   24.50 -"
   24.51 -			</label>
   24.52 -		</text>
   24.53 -	</frame>
   24.54 -	
   24.55 -	<hbox>
   24.56 -		<button ok>
   24.57 -			<action type="closewindow">HELP</action>
   24.58 -		</button>
   24.59 -	</hbox>
   24.60 -</vbox>
   24.61 -</window>'
   24.62 -
   24.63 -# Mount and umount buttons with fields for device and mount points.
   24.64 -MAIN_DIALOG='
   24.65 -<window title="Mountbox" icon-name="media-flash">
   24.66 -<vbox>
   24.67 -	<frame>
   24.68 -	<tree>
   24.69 -		<width>500</width><height>130</height>
   24.70 -		<variable>DEVICE</variable>
   24.71 -		<label>Umounted dev|Size|System|Type|Label|Boot|Start|End|Blocks|Id|UUID</label>
   24.72 -		<input>/usr/lib/slitaz/libmountbox list-umounted</input>
   24.73 -		<action>/usr/lib/slitaz/libmountbox umounted-fs-infos</action>
   24.74 -		<action>refresh:MOUNTED</action>
   24.75 -		<action>refresh:DEVICE</action>
   24.76 -	</tree>
   24.77 -	</frame>
   24.78 -	<frame>
   24.79 -	<tree>
   24.80 -		<width>500</width><height>110</height>
   24.81 -		<variable>MOUNTED</variable>
   24.82 -		<label>Mounted fs|Size|Used|Available|Use%|Mounted on|Option</label>'
   24.83 -
   24.84 -# /dev/root
   24.85 -RES=`df -h / | grep rootfs`
   24.86 -dev="/dev/root"
   24.87 -SIZE=`echo $RES | cut -d " " -f 2`
   24.88 -USED=`echo $RES | cut -d " " -f 3`
   24.89 -AVAILABLE=`echo $RES | cut -d " " -f 4`
   24.90 -PCT=`echo $RES | cut -d " " -f 5`
   24.91 -MOUNTED_ON=`echo $RES | cut -d " " -f 6`
   24.92 -if [ $SIZE != 0 ]; then
   24.93 -	ROOT_ITEM="
   24.94 -		<item icon=\"drive-harddisk\">$dev | $SIZE | $USED | $AVAILABLE | $PCT | $MOUNTED_ON</item>"
   24.95 -fi
   24.96 -MAIN_DIALOG=${MAIN_DIALOG}${ROOT_ITEM}
   24.97 -
   24.98 -# Now we have rootfs and icons, list all mounted fs.
   24.99 -DEVICE='<input>/usr/lib/slitaz/libmountbox list-mounted</input>
  24.100 -		<action>/usr/lib/slitaz/libmountbox mounted-fs-infos</action>
  24.101 -		<action>refresh:MOUNTED</action>
  24.102 -		<action>refresh:DEVICE</action>
  24.103 -	</tree>
  24.104 -	
  24.105 -	</frame>
  24.106 -	
  24.107 -	<hbox>
  24.108 -		<text use-markup="true" >
  24.109 -			<label>"<b>Mount selected device on:</b>"</label>
  24.110 -		</text>
  24.111 -		<entry accept="directory">
  24.112 -			<default>/media/cdrom</default>
  24.113 -			<variable>MOUNT_POINT</variable>
  24.114 -			</entry>
  24.115 -		<button>
  24.116 -			<label>Browse</label>
  24.117 -			<input file icon="folder-open"></input>
  24.118 -			<action type="fileselect">MOUNT_POINT</action>
  24.119 -		</button>
  24.120 -	</hbox>
  24.121 -	'
  24.122 -
  24.123 -# Get the mount points list.
  24.124 -MAIN_DIALOG=${MAIN_DIALOG}${DEVICE}
  24.125 -
  24.126 -# Actions buttons (mount, umount, eject, etc).
  24.127 -ACTIONS='
  24.128 -		
  24.129 -	<hbox>
  24.130 -		<button>
  24.131 -			<label>Mount</label>
  24.132 -			<input file icon="edit-redo"></input>
  24.133 -			<action>mkdir -p $MOUNT_POINT</action>
  24.134 -			<action>mount $DEVICE $MOUNT_POINT</action>
  24.135 -			<action>refresh:MOUNTED</action>
  24.136 -			<action>refresh:DEVICE</action>
  24.137 -		</button>
  24.138 -		<button>
  24.139 -			<label>Umount</label>
  24.140 -			<input file icon="undo"></input>
  24.141 -			<action>umount $MOUNT_POINT; sleep 1</action>
  24.142 -			<action>refresh:MOUNTED</action>
  24.143 -			<action>refresh:DEVICE</action>
  24.144 -		</button>
  24.145 -		<button>
  24.146 -			<label>Device list</label>
  24.147 -			<input file icon="reload"></input>
  24.148 -			<action>refresh:DEVICE</action>
  24.149 -		</button>
  24.150 -		<button>
  24.151 -			<label>Eject</label>
  24.152 -			<input file icon="media-cdrom"></input>
  24.153 -			<action>eject</action>
  24.154 -		</button>
  24.155 -		<button>
  24.156 -			<label>Loop</label>
  24.157 -			<input file icon="go-jump"></input>
  24.158 -			<action>/usr/lib/slitaz/libmountbox loopmgr</action>
  24.159 -			<action>refresh:MOUNTED</action>
  24.160 -			<action>refresh:DEVICE</action>
  24.161 -		</button>
  24.162 -		<button>
  24.163 -			<label>Crypto</label>
  24.164 -			<input file icon="passwd"></input>
  24.165 -			<action>/usr/lib/slitaz/libmountbox cryptomgr</action>
  24.166 -			<action>refresh:DEVICE</action>
  24.167 -		</button>
  24.168 -		<button help>
  24.169 -			<input file icon="help"></input>
  24.170 -			<action type="launch">HELP</action>
  24.171 -		</button>
  24.172 -		<button>
  24.173 -			<label>Quit</label>
  24.174 -			<input file icon="exit"></input>
  24.175 -			<action type="exit">Exit</action>
  24.176 -		</button>
  24.177 -		
  24.178 -	</hbox>
  24.179 -	
  24.180 -</vbox>
  24.181 -</window>'
  24.182 -
  24.183 -export MAIN_DIALOG=${MAIN_DIALOG}${ACTIONS}
  24.184 -gtkdialog --center --program=MAIN_DIALOG >/dev/null
  24.185 -
  24.186 -exit 0