Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
09ddd39b
Commit
09ddd39b
authored
Apr 17, 2010
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Distribution to other users then pwrp
parent
10baa8b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
31 deletions
+78
-31
src/exp/com/src/os_linux/pwr_pkg.sh
src/exp/com/src/os_linux/pwr_pkg.sh
+8
-8
wb/lib/wb/src/wb_pkg.cpp
wb/lib/wb/src/wb_pkg.cpp
+39
-20
wb/lib/wb/src/wb_pkg.h
wb/lib/wb/src/wb_pkg.h
+31
-3
No files found.
src/exp/com/src/os_linux/pwr_pkg.sh
View file @
09ddd39b
...
...
@@ -24,7 +24,7 @@ pkg_install_func ()
if
[
$1
==
${
1
##*/
}
]
;
then
# Add path
pkg
=
"
/home/pwrp
/
$1
"
pkg
=
"
$HOME
/
$1
"
else
pkg
=
$1
fi
...
...
@@ -61,7 +61,7 @@ pkg_list_func ()
# Extract datfile from package
if
[
$1
==
${
1
##*/
}
]
;
then
# Add path
pkg
=
"
/home/pwrp
/
$1
"
pkg
=
"
$HOME
/
$1
"
else
pkg
=
$1
fi
...
...
@@ -114,7 +114,7 @@ pkg_listfiles_func ()
# Extract datfile from package
if
[
$1
==
${
1
##*/
}
]
;
then
# Add path
pkg
=
"
/home/pwrp
/
$1
"
pkg
=
"
$HOME
/
$1
"
else
pkg
=
$1
fi
...
...
@@ -185,7 +185,7 @@ pkg_brief_func ()
do
if
[
$file
==
${
file
##*/
}
]
;
then
# Add path
pkg
=
"
/home/pwrp
/
$file
"
pkg
=
"
$HOME
/
$file
"
else
pkg
=
$file
fi
...
...
@@ -229,11 +229,11 @@ pkg_brief_func ()
pkg_dir_func
()
{
if
[
-z
$1
]
;
then
allpkg
=
`
ls
/home/pwrp
/pwrp_pkg_
*
.tgz
`
allpkg
=
`
ls
$HOME
/pwrp_pkg_
*
.tgz
`
else
if
[
$1
==
${
1
##*/
}
]
;
then
# Add path
pattern
=
"
/home/pwrp
/*
$1
*"
pattern
=
"
$HOME
/*
$1
*"
elif
[
${
1
:0:1
}
==
"/"
]
;
then
pattern
=
$1
*
else
...
...
@@ -252,11 +252,11 @@ pkg_dir_func()
pkg_dirbrief_func
()
{
if
[
-z
"
$1
"
]
;
then
allpkg
=
`
ls
/home/pwrp
/pwrp_pkg_
*
.tgz
`
allpkg
=
`
ls
$HOME
/pwrp_pkg_
*
.tgz
`
else
if
[
"
$1
"
==
"
${
1
##*/
}
"
]
;
then
# Add path
pattern
=
"
/home/pwrp
/*
$1
*"
pattern
=
"
$HOME
/*
$1
*"
elif
[
${
1
:0:1
}
==
"/"
]
;
then
pattern
=
$1
*
else
...
...
wb/lib/wb/src/wb_pkg.cpp
View file @
09ddd39b
...
...
@@ -469,7 +469,7 @@ void pkg_node::fetchFiles( bool distribute)
of <<
"cd $pwrp_load" << endl <<
"ftp -vin " << m_name << " << EOF &>$pwrp_tmp/ftp_" << m_name << ".log" << endl <<
"user
pwrp
pwrp" << endl <<
"user
" << m_user << "
pwrp" << endl <<
"binary" << endl <<
"put " << pkg_name << endl <<
"quit" << endl <<
...
...
@@ -485,12 +485,13 @@ void pkg_node::fetchFiles( bool distribute)
throw
wb_error_str
(
"Unable to open file"
);
ofu
<<
"dir=$HOME"
<<
endl
<<
"cd /tmp"
<<
endl
<<
"echo
\"
-- Unpack package "
<<
pkg_name
<<
"
\"
"
<<
endl
<<
"tar -xzf
/home/pwrp
/"
<<
pkg_name
<<
endl
<<
"tar -xzf
$dir
/"
<<
pkg_name
<<
endl
<<
"echo
\"
-- Move files to target directories
\"
"
<<
endl
<<
"if [ ! -e
/home/pwrp
/.ssh ]; then"
<<
endl
<<
" mkdir
/home/pwrp
/.ssh"
<<
endl
<<
"if [ ! -e
$dir
/.ssh ]; then"
<<
endl
<<
" mkdir
$dir
/.ssh"
<<
endl
<<
"fi"
<<
endl
;
for
(
int
i
=
0
;
i
<
(
int
)
m_filelist
.
size
();
i
++
)
...
...
@@ -504,23 +505,41 @@ void pkg_node::fetchFiles( bool distribute)
// Change owner to root of plc, to make modification of thread prio possible
ofu
<<
"nname=`eval uname -n`"
<<
endl
<<
"tst=`eval sudo -l | grep
\"
ALL
\"
`"
<<
endl
<<
"if [
\"
$tst
\"
!=
\"\"
]; then"
<<
endl
<<
" sudo chown root $pwrp_exe/plc_$nname_*"
<<
endl
<<
" sudo chmod g+w $pwrp_exe/plc_$nname_*"
<<
endl
<<
" sudo chmod u+s $pwrp_exe/plc_$nname_*"
<<
endl
<<
"if [
\"
$USER
\"
==
\"
root
\"
]; then"
<<
endl
<<
" chown root $pwrp_exe/plc_$nname_*"
<<
endl
<<
" chmod g+w $pwrp_exe/plc_$nname_*"
<<
endl
<<
" chmod u+s $pwrp_exe/plc_$nname_*"
<<
endl
<<
"else"
<<
endl
<<
" tst=`eval sudo -l | grep
\"
ALL
\"
`"
<<
endl
<<
" if [
\"
$tst
\"
!=
\"\"
]; then"
<<
endl
<<
" sudo chown root $pwrp_exe/plc_$nname_*"
<<
endl
<<
" sudo chmod g+w $pwrp_exe/plc_$nname_*"
<<
endl
<<
" sudo chmod u+s $pwrp_exe/plc_$nname_*"
<<
endl
<<
" fi"
<<
endl
<<
"fi"
<<
endl
;
// Group should not have write access to .rhosts file
ofu
<<
"if [
\"
$tst
\"
!=
\"\"
]; then"
<<
endl
<<
" if [ -e /home/pwrp/.rhosts ]; then"
<<
endl
<<
" sudo chown pwrp /home/pwrp/.rhosts"
<<
endl
<<
" sudo chmod g-w /home/pwrp/.rhosts"
<<
endl
<<
"if [ -e $dir/.rhosts ]; then"
<<
endl
<<
" if [
\"
$USER
\"
==
\"
root
\"
]; then"
<<
endl
<<
" chown "
<<
m_user
<<
" $dir/.rhosts"
<<
endl
<<
" chmod g-w $dir/.rhosts"
<<
endl
<<
" else"
<<
endl
<<
" if [
\"
$tst
\"
!=
\"\"
]; then"
<<
endl
<<
" sudo chown "
<<
m_user
<<
" $dir/.rhosts"
<<
endl
<<
" sudo chmod g-w $dir/.rhosts"
<<
endl
<<
" fi"
<<
endl
<<
" fi"
<<
endl
<<
" if [ -e /home/pwrp/.ssh/authorized_keys ]; then"
<<
endl
<<
" sudo chown pwrp /home/pwrp/.ssh/authorized_keys"
<<
endl
<<
" sudo chmod g-w /home/pwrp/.ssh/authorized_keys"
<<
endl
<<
"fi"
<<
endl
<<
"if [ -e $dir/.ssh/authorized_keys ]; then"
<<
endl
<<
" if [
\"
$USER
\"
==
\"
root
\"
]; then"
<<
endl
<<
" chown "
<<
m_user
<<
" $dir/.ssh/authorized_keys"
<<
endl
<<
" chmod g-w $dir/.ssh/authorized_keys"
<<
endl
<<
" else"
<<
endl
<<
" if [
\"
$tst
\"
!=
\"\"
]; then"
<<
endl
<<
" sudo chown "
<<
m_user
<<
" $dir/.ssh/authorized_keys"
<<
endl
<<
" sudo chmod g-w $dir/.ssh/authorized_keys"
<<
endl
<<
" fi"
<<
endl
<<
" fi"
<<
endl
<<
"fi"
<<
endl
;
...
...
@@ -604,19 +623,19 @@ void pkg_node::copyPackage( char *pkg_name)
of
<<
"cd $pwrp_load"
<<
endl
<<
"ftp -vin "
<<
bootnodes
[
i
]
<<
" << EOF &>$pwrp_tmp/ftp_"
<<
bootnodes
[
i
]
<<
".log"
<<
endl
<<
"user
pwrp
pwrp"
<<
endl
<<
"user
"
<<
m_user
<<
"
pwrp"
<<
endl
<<
"binary"
<<
endl
<<
"put "
<<
pkg_name
<<
endl
<<
"quit"
<<
endl
<<
"EOF"
<<
endl
<<
"rsh -l
pwrp
"
<<
bootnodes
[
i
]
<<
"
\\
$pwr_exe/pwr_pkg.sh -i "
<<
pkg_name
<<
endl
;
"rsh -l
"
<<
m_user
<<
"
"
<<
bootnodes
[
i
]
<<
"
\\
$pwr_exe/pwr_pkg.sh -i "
<<
pkg_name
<<
endl
;
}
else
{
// Use scp and SSH
of
<<
"cd $pwrp_load"
<<
endl
<<
"scp "
<<
pkg_name
<<
"
pwrp
@"
<<
bootnodes
[
i
]
<<
":"
<<
endl
<<
"ssh
pwrp
@"
<<
bootnodes
[
i
]
<<
"
\\
$pwr_exe/pwr_pkg.sh -i "
<<
pkg_name
<<
endl
;
"scp "
<<
pkg_name
<<
"
"
<<
m_user
<<
"
@"
<<
bootnodes
[
i
]
<<
":"
<<
endl
<<
"ssh
"
<<
m_user
<<
"
@"
<<
bootnodes
[
i
]
<<
"
\\
$pwr_exe/pwr_pkg.sh -i "
<<
pkg_name
<<
endl
;
}
of
.
close
();
...
...
wb/lib/wb/src/wb_pkg.h
View file @
09ddd39b
...
...
@@ -115,16 +115,33 @@ class pkg_node {
bool
m_valid
;
int
m_errors
;
int
m_warnings
;
char
m_user
[
80
];
public:
pkg_node
(
char
*
name
)
:
m_opsys
(
pwr_mOpSys__
),
m_bus
(
0
),
m_dstatus
(
0
),
m_valid
(
false
),
m_errors
(
0
),
m_warnings
(
0
)
{
strcpy
(
m_name
,
name
);
strcpy
(
m_bootnode
,
"-"
);}
{
strncpy
(
m_name
,
name
,
sizeof
(
m_name
));
strcpy
(
m_user
,
"pwrp"
);
strcpy
(
m_bootnode
,
"-"
);
}
pkg_node
(
char
*
name
,
pwr_mOpSys
opsys
,
int
bus
,
pwr_tMask
dstatus
,
char
*
bootnode
)
:
m_opsys
(
opsys
),
m_bus
(
bus
),
m_dstatus
(
dstatus
),
m_valid
(
true
),
m_errors
(
0
),
m_warnings
(
0
)
{
strcpy
(
m_name
,
name
);
strcpy
(
m_bootnode
,
bootnode
);}
{
char
*
s
;
strncpy
(
m_user
,
bootnode
,
sizeof
(
m_user
));
if
(
(
s
=
strchr
(
m_user
,
'@'
)))
{
*
s
=
0
;
strncpy
(
m_bootnode
,
s
+
1
,
sizeof
(
m_bootnode
));
}
else
{
strcpy
(
m_user
,
"pwrp"
);
strcpy
(
m_bootnode
,
bootnode
);
}
strncpy
(
m_name
,
name
,
sizeof
(
m_name
));
}
char
*
name
()
{
return
m_name
;}
pwr_mOpSys
opsys
()
{
return
m_opsys
;}
int
bus
()
{
return
m_bus
;}
...
...
@@ -134,7 +151,18 @@ class pkg_node {
void
setOpsys
(
pwr_mOpSys
opsys
)
{
m_opsys
=
opsys
;}
void
setBus
(
int
bus
)
{
m_bus
=
bus
;}
void
setDStatus
(
pwr_tMask
dstatus
)
{
m_dstatus
=
dstatus
;}
void
setBootnode
(
char
*
bootnode
)
{
strcpy
(
m_bootnode
,
bootnode
);}
void
setBootnode
(
char
*
bootnode
)
{
char
*
s
;
strncpy
(
m_user
,
bootnode
,
sizeof
(
m_user
));
if
(
(
s
=
strchr
(
m_user
,
'@'
)))
{
*
s
=
0
;
strncpy
(
m_bootnode
,
s
+
1
,
sizeof
(
m_bootnode
));
}
else
{
strcpy
(
m_user
,
"pwrp"
);
strcpy
(
m_bootnode
,
bootnode
);
}
}
void
setValid
()
{
m_valid
=
true
;}
void
push_back
(
pkg_pattern
&
pattern
)
{
pattern
.
node
(
this
);
...
...
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