Revision d6c82882
Added by Ermal LUÇI over 12 years ago
etc/inc/services.inc | ||
---|---|---|
299 | 299 |
|
300 | 300 |
/* configure DHCPD chroot once */ |
301 | 301 |
$fd = fopen("{$g['tmp_path']}/dhcpd.sh","w"); |
302 |
fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}\n"); |
|
303 |
fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/dev\n"); |
|
304 |
fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/etc\n"); |
|
305 |
fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/usr/local/sbin\n"); |
|
306 |
fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/var/db\n"); |
|
307 |
fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/var/run\n"); |
|
308 |
fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/usr\n"); |
|
309 |
fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/lib\n"); |
|
310 |
fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/run\n"); |
|
311 |
fwrite($fd, "chown -R dhcpd:_dhcp {$g['dhcpd_chroot_path']}/*\n"); |
|
312 |
fwrite($fd, "cp /lib/libc.so.* {$g['dhcpd_chroot_path']}/lib/\n"); |
|
313 |
fwrite($fd, "cp /usr/local/sbin/dhcpd {$g['dhcpd_chroot_path']}/usr/local/sbin/\n"); |
|
314 |
fwrite($fd, "chmod a+rx {$g['dhcpd_chroot_path']}/usr/local/sbin/dhcpd\n"); |
|
315 |
|
|
316 |
$status = `mount | grep "{$g['dhcpd_chroot_path']}/dev"`;
|
|
317 |
if(!trim($status)) |
|
318 |
fwrite($fd, "mount -t devfs devfs {$g['dhcpd_chroot_path']}/dev\n"); |
|
302 |
fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}\n");
|
|
303 |
fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}/dev\n");
|
|
304 |
fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}/etc\n");
|
|
305 |
fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}/usr/local/sbin\n");
|
|
306 |
fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}/var/db\n");
|
|
307 |
fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}/var/run\n");
|
|
308 |
fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}/usr\n");
|
|
309 |
fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}/lib\n");
|
|
310 |
fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}/run\n");
|
|
311 |
fwrite($fd, "/usr/sbin/chown -R dhcpd:_dhcp {$g['dhcpd_chroot_path']}/*\n");
|
|
312 |
fwrite($fd, "/bin/cp /lib/libc.so.* {$g['dhcpd_chroot_path']}/lib/\n");
|
|
313 |
fwrite($fd, "/bin/cp /usr/local/sbin/dhcpd {$g['dhcpd_chroot_path']}/usr/local/sbin/\n");
|
|
314 |
fwrite($fd, "/usr/sbin/chmod a+rx {$g['dhcpd_chroot_path']}/usr/local/sbin/dhcpd\n");
|
|
315 |
|
|
316 |
$status = `/sbin/mount | /usr/bin/grep -v grep | /usr/bin/grep "{$g['dhcpd_chroot_path']}/dev"`;
|
|
317 |
if (!trim($status))
|
|
318 |
fwrite($fd, "/sbin/mount -t devfs devfs {$g['dhcpd_chroot_path']}/dev\n");
|
|
319 | 319 |
fclose($fd); |
320 | 320 |
mwexec("/bin/sh {$g['tmp_path']}/dhcpd.sh"); |
321 | 321 |
|
Also available in: Unified diff
Use full path to commands