Revision 8cd6e269
Added by Viktor Gurov over 3 years ago
src/etc/phpshellsessions/gitsync | ||
---|---|---|
95 | 95 |
if (!function_exists('post_cvssync_commands')) { |
96 | 96 |
function post_cvssync_commands() { |
97 | 97 |
echo "===> Removing FAST-CGI temporary files...\n"; |
98 |
exec("find /tmp -name \"php-fastcgi.socket*\" -exec rm -rf {} \;"); |
|
99 |
exec("find /tmp -name \"*.tmp\" -exec rm -rf {} \;"); |
|
98 |
exec("/usr/bin/find /tmp -name \"php-fastcgi.socket*\" -exec rm -rf {} \;");
|
|
99 |
exec("/usr/bin/find /tmp -name \"*.tmp\" -exec rm -rf {} \;");
|
|
100 | 100 |
|
101 |
exec("rm -rf /tmp/xcache/* 2>/dev/null"); |
|
101 |
exec("/bin/rm -rf /tmp/xcache/* 2>/dev/null");
|
|
102 | 102 |
|
103 | 103 |
echo "===> Upgrading configuration (if needed)...\n"; |
104 | 104 |
convert_config(); |
105 | 105 |
|
106 | 106 |
echo "===> Configuring filter..."; |
107 | 107 |
exec("/etc/rc.filter_configure_sync"); |
108 |
exec("pfctl -f /tmp/rules.debug"); |
|
108 |
exec("/sbin/pfctl -f /tmp/rules.debug");
|
|
109 | 109 |
echo "\n"; |
110 | 110 |
|
111 | 111 |
if (file_exists("/etc/rc.php_ini_setup")) { |
... | ... | |
124 | 124 |
fwrite($fd, "sleep 5\n"); |
125 | 125 |
fwrite($fd, "/usr/local/sbin/pfSctl -c 'service restart webgui'\n"); |
126 | 126 |
fclose($fd); |
127 |
mwexec_bg("sh /tmp/restart_nginx"); |
|
127 |
mwexec_bg("/bin/sh /tmp/restart_nginx");
|
|
128 | 128 |
echo "\n"; |
129 | 129 |
} |
130 | 130 |
} |
... | ... | |
168 | 168 |
|
169 | 169 |
# Remove mainline if exists (older) |
170 | 170 |
if (is_dir("/root/pfsense/mainline")) { |
171 |
exec("rm -rf /root/pfsense/mainline"); |
|
171 |
exec("/bin/rm -rf /root/pfsense/mainline");
|
|
172 | 172 |
} |
173 | 173 |
|
174 | 174 |
# Remove RELENG_1_2 if exists (older) |
175 | 175 |
if (is_dir("/root/pfsense/RELENG_1_2")) { |
176 |
exec("rm -rf /root/pfsense/RELENG_1_2"); |
|
176 |
exec("/bin/rm -rf /root/pfsense/RELENG_1_2");
|
|
177 | 177 |
} |
178 | 178 |
|
179 | 179 |
# Remove HEAD if exists (older) |
180 | 180 |
if (is_dir("/root/pfsense/HEAD")) { |
181 |
exec("rm -rf /root/pfsense/HEAD"); |
|
181 |
exec("/bin/rm -rf /root/pfsense/HEAD");
|
|
182 | 182 |
} |
183 | 183 |
|
184 | 184 |
if (file_exists("/root/cvssync_backup.tgz")) { |
... | ... | |
308 | 308 |
exit(); |
309 | 309 |
} |
310 | 310 |
echo "===> Restoring previous CVSSync backup... Please wait...\n"; |
311 |
exec("tar Uxpf /root/cvssync_backup.tgz -C /"); |
|
311 |
exec("/usr/bin/tar Uxpf /root/cvssync_backup.tgz -C /");
|
|
312 | 312 |
post_cvssync_commands(); |
313 | 313 |
exit(); |
314 | 314 |
} else { |
... | ... | |
318 | 318 |
if ($nobackup == false) { |
319 | 319 |
echo "===> Backing up current pfSense information...\n"; |
320 | 320 |
echo "===> Please wait... "; |
321 |
exec("tar czPf /root/cvssync_backup.tgz --exclude /root --exclude /dev --exclude /tmp --exclude /var/run --exclude /var/empty /"); |
|
321 |
exec("/usr/bin/tar czPf /root/cvssync_backup.tgz --exclude /root --exclude /dev --exclude /tmp --exclude /var/run --exclude /var/empty /");
|
|
322 | 322 |
$size = filesize("/root/cvssync_backup.tgz"); |
323 | 323 |
echo "{$size} bytes.\n\n"; |
324 | 324 |
sleep(5); |
... | ... | |
349 | 349 |
exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && {$GIT_BIN} clean -f -x -d"); |
350 | 350 |
run_cmds($git_cmd); |
351 | 351 |
} else { |
352 |
exec("mkdir -p $CODIR/pfSenseGITREPO"); |
|
352 |
exec("/bin/mkdir -p $CODIR/pfSenseGITREPO");
|
|
353 | 353 |
echo "Executing cd $CODIR/pfSenseGITREPO && {$GIT_BIN} clone $GIT_REPO pfSenseGITREPO\n"; |
354 | 354 |
exec("cd $CODIR/pfSenseGITREPO && {$GIT_BIN} clone " . escapeshellarg($GIT_REPO) . " pfSenseGITREPO"); |
355 | 355 |
if (is_dir("$CODIR/pfSenseGITREPO/pfSense")) { |
356 |
exec("mv $CODIR/pfSenseGITREPO/pfSense $CODIR/pfSenseGITREPO/pfSenseGITREPO"); |
|
356 |
exec("/bin/mv $CODIR/pfSenseGITREPO/pfSense $CODIR/pfSenseGITREPO/pfSenseGITREPO");
|
|
357 | 357 |
} |
358 | 358 |
if (is_dir("$CODIR/pfSenseGITREPO/mainline")) { |
359 |
exec("mv $CODIR/pfSenseGITREPO/mainline $CODIR/pfSenseGITREPO/pfSenseGITREPO"); |
|
359 |
exec("/bin/mv $CODIR/pfSenseGITREPO/mainline $CODIR/pfSenseGITREPO/pfSenseGITREPO");
|
|
360 | 360 |
} |
361 | 361 |
run_cmds($git_cmd); |
362 | 362 |
} |
... | ... | |
412 | 412 |
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/etc/syslog.conf"); |
413 | 413 |
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/root/.shrc"); |
414 | 414 |
@unlink("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/root/.tcshrc"); |
415 |
exec("rm -rf {$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/conf*"); |
|
416 |
exec("rm -rf {$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/cf 2>/dev/null"); |
|
415 |
exec("/bin/rm -rf {$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/conf*");
|
|
416 |
exec("/bin/rm -rf {$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/cf 2>/dev/null");
|
|
417 | 417 |
@chmod("{$CODIR}/pfSenseGITREPO/pfSenseGITREPO/src/tmp", 01777); |
418 | 418 |
|
419 | 419 |
$different_files_array[1] = array(); |
... | ... | |
482 | 482 |
|
483 | 483 |
echo "===> Installing $qty_files_to_copy new files...\n"; |
484 | 484 |
|
485 |
$command = "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO ; tar -cpf - {$tar_options} {$files_to_copy} | (cd / ; tar -Uxpf -)";
|
|
485 |
$command = "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO ; /usr/bin/tar -cpf - {$tar_options} {$files_to_copy} | (cd / ; /usr/bin/tar -Uxpf -)";
|
|
486 | 486 |
|
487 | 487 |
if (!empty($files_to_copy)) { |
488 | 488 |
if(isset($args["--show-command"])) { |
Also available in: Unified diff
Fix full path to executable files. Issue #11941