tiny-slitaz view step1.php @ rev 4

helper: add log.gz in iso image
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Sep 03 10:21:46 2012 +0200 (2012-09-03)
parents 55f97ee147e8
children 577e6e91216d
line source
1 <?php
3 $usedvars = array( "kernel", "modules", "packages", "toconfigure",
4 "continue", "configuring", "tmp_dir" );
6 function set_tmp_dir()
7 {
8 $dir = opendir("/tmp");
9 while (($name = readdir($dir)) !== false) {
10 if (preg_match('/^tiny_webgen/',$name) == 0) continue;
11 if (filemtime("/tmp/$name") > strtotime("-1 hour")) continue;
12 shell_exec("sudo ./helper --remove /tmp/$name");
13 }
14 closedir($dir);
15 if (isset($_POST["tmp_dir"])) return;
16 $_POST["tmp_dir"] = tempnam('','tiny_webgen');
17 if (file_exists($_POST["tmp_dir"])) unlink($_POST["tmp_dir"]);
18 mkdir($_POST["tmp_dir"]);
19 $_POST["tmp_dir"] .= '/';
20 }
22 set_tmp_dir();
24 function post_hidden()
25 {
26 global $usedvars;
27 foreach ($usedvars as $var) {
28 if (isset($_POST[$var]) && $var != "continue" &&
29 $var != "configuring") {
30 ?>
31 <input name="<?php echo $var; ?>" value="<?php echo $_POST[$var]; ?>" type="hidden" />
32 <?php
33 }
34 }
35 }
37 function upload($var, $file = "")
38 {
39 if ($file == "") $file = $var;
40 if (isset($_FILES[$var])) {
41 $tmp_name = $_FILES[$var]['tmp_name'];
42 if (is_uploaded_file($tmp_name)) {
43 move_uploaded_file($tmp_name, $_POST["tmp_dir"].$file);
44 }
45 }
46 }
48 if (isset($_POST['mykernel']) && !isset($_POST['packages'])) {
49 $_POST['kernel'] = "custom";
50 upload("uploadkernel","kernel");
51 }
53 if (!isset($_POST['kernel'])) {
54 shell_exec("sudo ./helper --init");
55 if (isset($_POST['config'])) {
56 upload("uploadconf");
57 }
58 if (!file_exists($_POST["tmp_dir"]."uploadconf")) {
59 ?>
61 <p>
62 The file <u>/etc/packages.conf</u> in the initramfs holds all information
63 to rebuild your Tiny SliTaz system. You should upload your
64 <u>/etc/packages.conf</u> first if you want to upgrade your system only.
65 </p>
67 <form method="post" enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
68 Packages configuration:
69 <input type="file" name="uploadconf" />
70 <input name="config" value="Get config" type="submit" />
71 <?php post_hidden(); ?>
72 </form>
73 <?php
74 }
75 if (isset($_POST['mypackages'])) {
76 upload("uploadpkgs");
77 shell_exec("./helper --pkgs-extract uploadpkgs ".$_POST['tmp_dir']);
78 }
79 if (!file_exists($_POST["tmp_dir"]."uploadpkgs")) {
80 ?>
82 <p>
83 You can upload a tazpkg file (.tazpkg) or a tarball of tazpkg files (.tar).
84 These packages will extend the official packages list and will be chosen when
85 the package names are found to be matching. You can find some examples in the
86 <a href="http://hg.slitaz.org/wok-tiny/file/">Tiny SliTaz repository</a>.
87 </p>
88 <div>
89 <form method="post" enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
90 Additional packages:
91 <input type="file" name="uploadpkgs" />
92 <input name="mypackages" value="Get packages" type="submit" />
93 <?php post_hidden(); ?>
94 </form>
95 </div>
96 <p>
97 <?php
98 }
99 ?>
100 </p>
102 <a name="kernel"></a>
103 <h2>Linux kernel</h2>
105 <p>
106 You can upload a custom kernel or use an official one.
107 Your kernel should have an embedded initramfs with busybox like
108 <a href="dist/rootfs.cpio" title="See CONFIG_INITRAMFS_SOURCE">this one</a>.
109 </p>
111 <div>
112 <form method="post" enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
113 Custom kernel (bzImage file):
114 <input type="file" name="uploadkernel" />
115 <input name="mykernel" value="Get kernel" type="submit" />
116 <?php post_hidden(); ?>
117 </form>
118 </div>
120 <div>
121 <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post" name="kernels">
122 <?php
123 echo shell_exec("./helper --list-kernels ".$_POST["tmp_dir"]);
124 post_hidden();
125 ?>
126 <p>
127 </p>
129 <div align="center">
130 <input name="continue" value="Continue" type="submit" />
131 </div>
132 </form>
133 </div>
134 <?php
135 }
136 ?>