Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-camogm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-apps-camogm
Commits
1fc31f1d
Commit
1fc31f1d
authored
May 09, 2018
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added CORS header 1
parent
bd6af7c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
52 deletions
+54
-52
camogm_interface.php
src/camogmgui/camogm_interface.php
+54
-52
No files found.
src/camogmgui/camogm_interface.php
View file @
1fc31f1d
...
@@ -79,15 +79,15 @@ $start_str = "camogm -n " . $cmd_pipe . " -p " . $cmd_port;
...
@@ -79,15 +79,15 @@ $start_str = "camogm -n " . $cmd_pipe . " -p " . $cmd_port;
function
check_camogm_running
(){
function
check_camogm_running
(){
global
$start_str
;
global
$start_str
;
$camogm_running
=
false
;
$camogm_running
=
false
;
exec
(
'ps | grep "camogm"'
,
$arr
);
exec
(
'ps | grep "camogm"'
,
$arr
);
$check
=
implode
(
"<br/>"
,
$arr
);
$check
=
implode
(
"<br/>"
,
$arr
);
if
(
strstr
(
$check
,
$start_str
)){
if
(
strstr
(
$check
,
$start_str
)){
$camogm_running
=
true
;
$camogm_running
=
true
;
}
}
return
$camogm_running
;
return
$camogm_running
;
}
}
...
@@ -96,13 +96,13 @@ if ($cmd == "run_camogm")
...
@@ -96,13 +96,13 @@ if ($cmd == "run_camogm")
if
(
isset
(
$_GET
[
'state_file'
])){
if
(
isset
(
$_GET
[
'state_file'
])){
$state_file
=
$_GET
[
'state_file'
];
$state_file
=
$_GET
[
'state_file'
];
}
}
if
(
!
check_camogm_running
())
{
if
(
!
check_camogm_running
())
{
echo
"camogm is not running, starting
\n
"
;
echo
"camogm is not running, starting
\n
"
;
$start_str
=
$start_str
.
" -s "
.
$state_file
;
$start_str
=
$start_str
.
" -s "
.
$state_file
;
// clean
// clean
exec
(
"rm "
.
$cmd_pipe
);
exec
(
"rm "
.
$cmd_pipe
);
exec
(
"rm "
.
$cmd_state
);
exec
(
"rm "
.
$cmd_state
);
...
@@ -121,7 +121,7 @@ if ($cmd == "run_camogm")
...
@@ -121,7 +121,7 @@ if ($cmd == "run_camogm")
fprintf
(
$fcmd
,
"debuglev=
$debuglev
"
);
fprintf
(
$fcmd
,
"debuglev=
$debuglev
"
);
fclose
(
$fcmd
);
fclose
(
$fcmd
);
}
}
// set fast recording mode if there is at least one suitable partition or revert to legacy 'mov' mode
// set fast recording mode if there is at least one suitable partition or revert to legacy 'mov' mode
$partitions
=
get_raw_dev
();
$partitions
=
get_raw_dev
();
if
(
!
empty
(
$partitions
))
{
if
(
!
empty
(
$partitions
))
{
...
@@ -151,23 +151,23 @@ else if ($cmd == "status")
...
@@ -151,23 +151,23 @@ else if ($cmd == "status")
$fcmd
=
fopen
(
$cmd_pipe
,
"w"
);
$fcmd
=
fopen
(
$cmd_pipe
,
"w"
);
fprintf
(
$fcmd
,
"xstatus=%s
\n
"
,
$pipe
);
fprintf
(
$fcmd
,
"xstatus=%s
\n
"
,
$pipe
);
fclose
(
$fcmd
);
fclose
(
$fcmd
);
$status
=
file_get_contents
(
$pipe
);
$status
=
file_get_contents
(
$pipe
);
}
else
{
}
else
{
$status
=
"<?xml version='1.0'?><camogm_state>
\n
<state>"
.
$camogm_running
.
"</state>
\n
</camogm_state>"
;
$status
=
"<?xml version='1.0'?><camogm_state>
\n
<state>"
.
$camogm_running
.
"</state>
\n
</camogm_state>"
;
}
}
header
(
"Content-Type: text/xml"
);
header
(
"Content-Type: text/xml"
);
header
(
"Content-Length: "
.
strlen
(
$status
)
.
"
\n
"
);
header
(
"Content-Length: "
.
strlen
(
$status
)
.
"
\n
"
);
header
(
"Pragma: no-cache
\n
"
);
header
(
"Pragma: no-cache
\n
"
);
printf
(
"%s"
,
$status
);
printf
(
"%s"
,
$status
);
}
}
else
if
(
$cmd
==
"run_status"
)
else
if
(
$cmd
==
"run_status"
)
{
{
if
(
check_camogm_running
())
$camogm_running
=
"on"
;
if
(
check_camogm_running
())
$camogm_running
=
"on"
;
else
$camogm_running
=
"off"
;
else
$camogm_running
=
"off"
;
$status
=
"<?xml version='1.0'?><camogm_state>
\n
<state>"
.
$camogm_running
.
"</state>
\n
</camogm_state>"
;
$status
=
"<?xml version='1.0'?><camogm_state>
\n
<state>"
.
$camogm_running
.
"</state>
\n
</camogm_state>"
;
header
(
"Content-Type: text/xml"
);
header
(
"Content-Type: text/xml"
);
...
@@ -180,10 +180,10 @@ else if ($cmd=="get_hdd_space"){
...
@@ -180,10 +180,10 @@ else if ($cmd=="get_hdd_space"){
$mountpoint
=
$_GET
[
'mountpoint'
];
$mountpoint
=
$_GET
[
'mountpoint'
];
else
else
$mountpoint
=
'/mnt/sda1'
;
$mountpoint
=
'/mnt/sda1'
;
if
(
is_dir
(
$mountpoint
))
$res
=
disk_free_space
(
$mountpoint
);
if
(
is_dir
(
$mountpoint
))
$res
=
disk_free_space
(
$mountpoint
);
else
$res
=
0
;
else
$res
=
0
;
xml_header
();
xml_header
();
echo
"<command>"
.
$cmd
.
"</command>"
;
echo
"<command>"
.
$cmd
.
"</command>"
;
echo
"<"
.
$cmd
.
">"
;
echo
"<"
.
$cmd
.
">"
;
...
@@ -195,7 +195,7 @@ else if ($cmd=="get_hdd_space"){
...
@@ -195,7 +195,7 @@ else if ($cmd=="get_hdd_space"){
else
if
(
$cmd
==
"mount"
)
{
// mount media like HDD
else
if
(
$cmd
==
"mount"
)
{
// mount media like HDD
if
(
isset
(
$_GET
[
'partition'
]))
if
(
isset
(
$_GET
[
'partition'
]))
$partition
=
$_GET
[
'partition'
];
$partition
=
$_GET
[
'partition'
];
else
else
$partition
=
'/dev/sda1'
;
$partition
=
'/dev/sda1'
;
//$partition = '/dev/hda1';
//$partition = '/dev/hda1';
...
@@ -203,7 +203,7 @@ else if ($cmd=="mount") { // mount media like HDD
...
@@ -203,7 +203,7 @@ else if ($cmd=="mount") { // mount media like HDD
$mountpoint
=
$_GET
[
'mountpoint'
];
$mountpoint
=
$_GET
[
'mountpoint'
];
else
else
$mountpoint
=
'/mnt/sda1'
;
$mountpoint
=
'/mnt/sda1'
;
exec
(
'mkdir '
.
$mountpoint
);
exec
(
'mkdir '
.
$mountpoint
);
//exec('mkdir /mnt/sda1');
//exec('mkdir /mnt/sda1');
exec
(
'mount '
.
$partition
.
" "
.
$mountpoint
);
exec
(
'mount '
.
$partition
.
" "
.
$mountpoint
);
...
@@ -247,7 +247,7 @@ else if ($cmd=="set_quality") {
...
@@ -247,7 +247,7 @@ else if ($cmd=="set_quality") {
echo
elphel_get_P_value
(
$sensor_port
,
ELPHEL_QUALITY
);
echo
elphel_get_P_value
(
$sensor_port
,
ELPHEL_QUALITY
);
echo
"</"
.
$cmd
.
">"
;
echo
"</"
.
$cmd
.
">"
;
xml_footer
();
xml_footer
();
}
}
else
if
(
$cmd
==
"get_quality"
)
{
else
if
(
$cmd
==
"get_quality"
)
{
$sensor_port
=
$_GET
[
'sensor_port'
];
$sensor_port
=
$_GET
[
'sensor_port'
];
...
@@ -265,7 +265,7 @@ else if ($cmd=="set_parameter") {
...
@@ -265,7 +265,7 @@ else if ($cmd=="set_parameter") {
//elphel_skip_frames($sensor_port,1);
//elphel_skip_frames($sensor_port,1);
$thisFrameNumber
=
elphel_get_frame
(
$sensor_port
);
$thisFrameNumber
=
elphel_get_frame
(
$sensor_port
);
if
(
isset
(
$_GET
[
'pframe'
]))
{
if
(
isset
(
$_GET
[
'pframe'
]))
{
$pframe
=
intval
(
$_GET
[
'pframe'
]);
$pframe
=
intval
(
$_GET
[
'pframe'
]);
}
else
{
}
else
{
...
@@ -354,11 +354,11 @@ else if ($cmd=="list_partitions"){
...
@@ -354,11 +354,11 @@ else if ($cmd=="list_partitions"){
else
else
{
{
$fcmd
=
fopen
(
$cmd_pipe
,
"w"
);
$fcmd
=
fopen
(
$cmd_pipe
,
"w"
);
xml_header
();
xml_header
();
echo
"<command>"
.
$cmd
.
"</command>"
;
echo
"<command>"
.
$cmd
.
"</command>"
;
echo
"<"
.
$cmd
.
">"
;
echo
"<"
.
$cmd
.
">"
;
switch
(
$cmd
)
switch
(
$cmd
)
{
{
case
"start"
:
case
"start"
:
...
@@ -367,14 +367,14 @@ else
...
@@ -367,14 +367,14 @@ else
case
"stop"
:
case
"stop"
:
fprintf
(
$fcmd
,
"stop;
\n
"
);
fprintf
(
$fcmd
,
"stop;
\n
"
);
exec
(
'sync'
);
exec
(
'sync'
);
break
;
break
;
case
"exit"
:
case
"exit"
:
fprintf
(
$fcmd
,
"exit;
\n
"
);
fprintf
(
$fcmd
,
"exit;
\n
"
);
exec
(
'sync'
);
exec
(
'sync'
);
break
;
break
;
case
"file_rename"
:
case
"file_rename"
:
// Now requires full path (like "/mnt/sda1/test1.mov") for file_old
// Now requires full path (like "/mnt/sda1/test1.mov") for file_old
// and either a full path or just a filename for file_new
// and either a full path or just a filename for file_new
if
((
!
isset
(
$_GET
[
'file_old'
]))
||
(
!
isset
(
$_GET
[
'file_new'
])))
{
if
((
!
isset
(
$_GET
[
'file_old'
]))
||
(
!
isset
(
$_GET
[
'file_new'
])))
{
echo
"wrong arguments"
;
echo
"wrong arguments"
;
break
;
break
;
...
@@ -382,7 +382,7 @@ else
...
@@ -382,7 +382,7 @@ else
$old_name
=
$_GET
[
'file_old'
];
$old_name
=
$_GET
[
'file_old'
];
$new_name
=
$_GET
[
'file_new'
];
$new_name
=
$_GET
[
'file_new'
];
if
(
!
strrpos
(
$new_name
,
"/"
))
{
if
(
!
strrpos
(
$new_name
,
"/"
))
{
$new_name
=
substr
(
$old_name
,
0
,
strrpos
(
$old_name
,
"/"
)
+
1
)
.
$new_name
;
$new_name
=
substr
(
$old_name
,
0
,
strrpos
(
$old_name
,
"/"
)
+
1
)
.
$new_name
;
}
}
...
@@ -391,7 +391,7 @@ else
...
@@ -391,7 +391,7 @@ else
echo
"filenames match"
;
echo
"filenames match"
;
break
;
break
;
}
}
if
(
file_exists
(
$new_name
))
{
if
(
file_exists
(
$new_name
))
{
echo
"file_new already exists"
;
echo
"file_new already exists"
;
break
;
break
;
...
@@ -401,8 +401,8 @@ else
...
@@ -401,8 +401,8 @@ else
break
;
break
;
}
}
// no errors found, so do the rename
// no errors found, so do the rename
if
(
rename
(
$old_name
,
$new_name
))
if
(
rename
(
$old_name
,
$new_name
))
echo
"done"
;
echo
"done"
;
else
else
echo
"undefined error"
;
echo
"undefined error"
;
...
@@ -421,7 +421,7 @@ else
...
@@ -421,7 +421,7 @@ else
if
(
!
strpos
(
$arr1
[
$i
],
"mtdblock"
)
&&
!
strpos
(
$arr1
[
$i
],
"ram"
))
{
if
(
!
strpos
(
$arr1
[
$i
],
"mtdblock"
)
&&
!
strpos
(
$arr1
[
$i
],
"ram"
))
{
$temp
=
$arr1
[
$i
];
$temp
=
$arr1
[
$i
];
while
(
strstr
(
$temp
,
" "
))
{
while
(
strstr
(
$temp
,
" "
))
{
$temp
=
str_replace
(
chr
(
9
),
" "
,
$temp
);
$temp
=
str_replace
(
chr
(
9
),
" "
,
$temp
);
$temp
=
str_replace
(
" "
,
" "
,
$temp
);
$temp
=
str_replace
(
" "
,
" "
,
$temp
);
}
}
if
(
preg_match_all
(
'/ +[a-z]{3,3}[0-9]{1,1}$/'
,
$temp
,
$available_partitons
)
>
0
)
{
if
(
preg_match_all
(
'/ +[a-z]{3,3}[0-9]{1,1}$/'
,
$temp
,
$available_partitons
)
>
0
)
{
...
@@ -466,7 +466,7 @@ else
...
@@ -466,7 +466,7 @@ else
echo
"<filesystem>"
.
$filesystem
.
"</filesystem>"
;
echo
"<filesystem>"
.
$filesystem
.
"</filesystem>"
;
$filesystem
=
""
;
$filesystem
=
""
;
}
else
{
}
else
{
echo
"<filesystem>none</filesystem>"
;
echo
"<filesystem>none</filesystem>"
;
}
}
echo
"</item>"
;
echo
"</item>"
;
}
}
...
@@ -485,7 +485,7 @@ else
...
@@ -485,7 +485,7 @@ else
case
"is_hdd_mounted"
:
case
"is_hdd_mounted"
:
if
(
isset
(
$_GET
[
'partition'
]))
if
(
isset
(
$_GET
[
'partition'
]))
$partition
=
$_GET
[
'partition'
];
$partition
=
$_GET
[
'partition'
];
else
else
$partition
=
'/dev/sda1'
;
$partition
=
'/dev/sda1'
;
//$partition = '/dev/hda1';
//$partition = '/dev/hda1';
...
@@ -499,10 +499,10 @@ else
...
@@ -499,10 +499,10 @@ else
break
;
break
;
case
"create_symlink"
:
case
"create_symlink"
:
//exec('ln -s /mnt/sda1 /mnt/flash/html/hdd');
//exec('ln -s /mnt/sda1 /mnt/flash/html/hdd');
if
(
isset
(
$_GET
[
'mountpoint'
]))
$mountpoint
=
$_GET
[
'mountpoint'
];
if
(
isset
(
$_GET
[
'mountpoint'
]))
$mountpoint
=
$_GET
[
'mountpoint'
];
else
$mountpoint
=
"/mnt/sda1"
;
else
$mountpoint
=
"/mnt/sda1"
;
exec
(
"rm /www/pages/hdd"
);
exec
(
"rm /www/pages/hdd"
);
exec
(
"ln -sf
$mountpoint
/www/pages/hdd"
);
exec
(
"ln -sf
$mountpoint
/www/pages/hdd"
);
break
;
break
;
...
@@ -512,7 +512,7 @@ else
...
@@ -512,7 +512,7 @@ else
// echo "the path is not set";
// echo "the path is not set";
// break;
// break;
// }
// }
//
//
// if (is_dir($path)) {
// if (is_dir($path)) {
// $files = scandir($path);
// $files = scandir($path);
// foreach ($files as $file){
// foreach ($files as $file){
...
@@ -522,7 +522,7 @@ else
...
@@ -522,7 +522,7 @@ else
// echo "directory not found";
// echo "directory not found";
// break;
// break;
// }
// }
//
//
// break;
// break;
case
"list_files"
:
case
"list_files"
:
if
(
!
file_exists
(
'/www/pages/hdd'
))
{
if
(
!
file_exists
(
'/www/pages/hdd'
))
{
...
@@ -530,7 +530,7 @@ else
...
@@ -530,7 +530,7 @@ else
break
;
break
;
}
}
$dir
=
$_GET
[
"dir"
];
$dir
=
$_GET
[
"dir"
];
if
(
isset
(
$dir
)
&&
(
$dir
!=
""
)
&&
(
$dir
!=
"/./"
)
&&
(
$dir
!=
"/"
))
// show "one level up" item if we are not in "home" directory
if
(
isset
(
$dir
)
&&
(
$dir
!=
""
)
&&
(
$dir
!=
"/./"
)
&&
(
$dir
!=
"/"
))
// show "one level up" item if we are not in "home" directory
{
{
echo
"<file>"
;
echo
"<file>"
;
...
@@ -540,7 +540,7 @@ else
...
@@ -540,7 +540,7 @@ else
$file_pos_of_second_last_slash
=
strrpos
(
$file_remove_last_slash
,
"/"
);
$file_pos_of_second_last_slash
=
strrpos
(
$file_remove_last_slash
,
"/"
);
$up_file
=
substr
(
$dir
,
0
,
$file_pos_of_second_last_slash
+
1
);
$up_file
=
substr
(
$dir
,
0
,
$file_pos_of_second_last_slash
+
1
);
while
(
strpos
(
$up_file
,
"//"
))
{
while
(
strpos
(
$up_file
,
"//"
))
{
$up_file
=
str_replace
(
"//"
,
"/"
,
$up_file
);
$up_file
=
str_replace
(
"//"
,
"/"
,
$up_file
);
}
}
if
(
$up_file
==
""
)
if
(
$up_file
==
""
)
echo
"<path>/</path>"
;
echo
"<path>/</path>"
;
...
@@ -550,18 +550,18 @@ else
...
@@ -550,18 +550,18 @@ else
echo
"<date>0</date>"
;
echo
"<date>0</date>"
;
echo
"</file>"
;
echo
"</file>"
;
}
}
if
(
$handle
=
opendir
(
'/www/pages/hdd/'
.
$dir
))
{
if
(
$handle
=
opendir
(
'/www/pages/hdd/'
.
$dir
))
{
while
(
$file
=
readdir
(
$handle
))
while
(
$file
=
readdir
(
$handle
))
{
{
if
(
$file
!=
"."
&&
$file
!=
".."
)
if
(
$file
!=
"."
&&
$file
!=
".."
)
{
{
echo
"<file>"
;
echo
"<file>"
;
echo
"<type>"
;
echo
"<type>"
;
if
(
is_dir
(
"/www/pages/hdd/"
.
$dir
.
$file
))
if
(
is_dir
(
"/www/pages/hdd/"
.
$dir
.
$file
))
echo
"dir"
;
echo
"dir"
;
else
else
echo
$extension
=
substr
(
$file
,
strrpos
(
$file
,
'.'
)
+
1
,
strlen
(
$file
));
echo
$extension
=
substr
(
$file
,
strrpos
(
$file
,
'.'
)
+
1
,
strlen
(
$file
));
echo
"</type>"
;
echo
"</type>"
;
echo
"<name>"
.
$file
.
"</name>"
;
echo
"<name>"
.
$file
.
"</name>"
;
echo
"<path>"
.
substr
(
$dir
,
1
)
.
$file
.
"</path>"
;
echo
"<path>"
.
substr
(
$dir
,
1
)
.
$file
.
"</path>"
;
...
@@ -585,7 +585,7 @@ else
...
@@ -585,7 +585,7 @@ else
fprintf
(
$fcmd
,
"prefix=%s;
\n
"
,
$prefix
);
fprintf
(
$fcmd
,
"prefix=%s;
\n
"
,
$prefix
);
setcookie
(
"directory"
,
$prefix
);
setcookie
(
"directory"
,
$prefix
);
break
;
break
;
case
"set_debuglev"
:
case
"set_debuglev"
:
$debuglev
=
$_GET
[
'debuglev'
];
$debuglev
=
$_GET
[
'debuglev'
];
fprintf
(
$fcmd
,
"debuglev=%s;
\n
"
,
$debuglev
);
fprintf
(
$fcmd
,
"debuglev=%s;
\n
"
,
$debuglev
);
...
@@ -610,7 +610,7 @@ else
...
@@ -610,7 +610,7 @@ else
$start_after_timestamp
=
$_GET
[
'start_after_timestamp'
];
$start_after_timestamp
=
$_GET
[
'start_after_timestamp'
];
// Allow setting start timestamp as relative time with "p3" = plus 3 second
// Allow setting start timestamp as relative time with "p3" = plus 3 second
// This allows triggering recording in the future without first reading current camera time
// This allows triggering recording in the future without first reading current camera time
if
(
substr
(
$start_after_timestamp
,
0
,
1
)
==
"p"
)
{
if
(
substr
(
$start_after_timestamp
,
0
,
1
)
==
"p"
)
{
$start_after_timestamp
=
elphel_get_fpga_time
()
+
substr
(
$start_after_timestamp
,
1
)
;
$start_after_timestamp
=
elphel_get_fpga_time
()
+
substr
(
$start_after_timestamp
,
1
)
;
//echo "now: ".elphel_get_fpga_time()." relative: ".$start_after_timestamp; //debug
//echo "now: ".elphel_get_fpga_time()." relative: ".$start_after_timestamp; //debug
}
}
...
@@ -634,9 +634,9 @@ else
...
@@ -634,9 +634,9 @@ else
if
(
$audio_hardware
==
""
)
if
(
$audio_hardware
==
""
)
echo
"no Audio Hardware detected"
;
echo
"no Audio Hardware detected"
;
else
else
{
{
$message
=
substr
(
$audio_hardware
,
strpos
(
$audio_hardware
,
"],"
)
+
2
);
$message
=
substr
(
$audio_hardware
,
strpos
(
$audio_hardware
,
"],"
)
+
2
);
$message
=
substr
(
$message
,
1
,
strpos
(
$message
,
"["
)
-
2
);
$message
=
substr
(
$message
,
1
,
strpos
(
$message
,
"["
)
-
2
);
echo
$message
;
echo
$message
;
}
}
break
;
break
;
...
@@ -671,8 +671,10 @@ else
...
@@ -671,8 +671,10 @@ else
}
}
function
xml_header
()
{
function
xml_header
()
{
header
(
"Content-type: text/xml"
);
header
(
"Content-type: text/xml"
);
header
(
"Pragma: no-cache
\n
"
);
header
(
"Pragma: no-cache
\n
"
);
// allow CORS: needed for multi cams unified control
header
(
'Access-Control-Allow-Origin: *'
);
echo
"<?xml version=
\"
1.0
\"
encoding=
\"
iso-8859-1
\"
?>
\n
"
;
echo
"<?xml version=
\"
1.0
\"
encoding=
\"
iso-8859-1
\"
?>
\n
"
;
echo
"<camogm_interface>
\n
"
;
echo
"<camogm_interface>
\n
"
;
}
}
...
@@ -702,7 +704,7 @@ function get_partitions()
...
@@ -702,7 +704,7 @@ function get_partitions()
/** Get a list of disk devices which have file system and can be mounted. This function
/** Get a list of disk devices which have file system and can be mounted. This function
* uses 'blkid' command from busybox.
* uses 'blkid' command from busybox.
*/
*/
function
get_mnt_dev
()
function
get_mnt_dev
()
{
{
$partitions
=
get_partitions
();
$partitions
=
get_partitions
();
...
@@ -721,7 +723,7 @@ function get_mnt_dev()
...
@@ -721,7 +723,7 @@ function get_mnt_dev()
$i
++
;
$i
++
;
}
}
}
}
return
array
(
"devices"
=>
$devices
,
"types"
=>
$fs_types
);
return
array
(
"devices"
=>
$devices
,
"types"
=>
$fs_types
);
}
}
...
@@ -730,12 +732,12 @@ function get_raw_dev()
...
@@ -730,12 +732,12 @@ function get_raw_dev()
{
{
$j
=
0
;
$j
=
0
;
$ret
=
get_mnt_dev
();
$ret
=
get_mnt_dev
();
$devices
=
$ret
[
"devices"
];
$devices
=
$ret
[
"devices"
];
$types
=
$ret
[
"types"
];
$types
=
$ret
[
"types"
];
$names
=
get_partitions
();
$names
=
get_partitions
();
// filter out partitions with file system
// filter out partitions with file system
$i
=
0
;
$i
=
0
;
$raw_devices
=
array
();
$raw_devices
=
array
();
...
@@ -751,7 +753,7 @@ function get_raw_dev()
...
@@ -751,7 +753,7 @@ function get_raw_dev()
$i
++
;
$i
++
;
}
}
}
}
//special case
//special case
if
(
count
(
$raw_devices
)
>
1
)
{
if
(
count
(
$raw_devices
)
>
1
)
{
foreach
(
$raw_devices
as
$k
=>
$v
){
foreach
(
$raw_devices
as
$k
=>
$v
){
...
@@ -769,7 +771,7 @@ function get_state_path()
...
@@ -769,7 +771,7 @@ function get_state_path()
{
{
global
$default_state
;
global
$default_state
;
$prefix
=
'/tmp/rootfs.ro'
;
$prefix
=
'/tmp/rootfs.ro'
;
if
(
file_exists
(
$prefix
))
{
if
(
file_exists
(
$prefix
))
{
$ret
=
$prefix
.
$default_state
;
$ret
=
$prefix
.
$default_state
;
}
else
{
}
else
{
...
@@ -783,7 +785,7 @@ function get_state_path()
...
@@ -783,7 +785,7 @@ function get_state_path()
function
write_cmd_pipe
(
$cmd_str
)
function
write_cmd_pipe
(
$cmd_str
)
{
{
global
$cmd_pipe
;
global
$cmd_pipe
;
$fcmd
=
fopen
(
$cmd_pipe
,
'w'
);
$fcmd
=
fopen
(
$cmd_pipe
,
'w'
);
if
(
$fcmd
!==
false
)
{
if
(
$fcmd
!==
false
)
{
fprintf
(
$fcmd
,
$cmd_str
);
fprintf
(
$fcmd
,
$cmd_str
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment