Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eepm
Commits
1c65cc7d
Commit
1c65cc7d
authored
May 07, 2023
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epm play common.sh: move functions
parent
47b4cd3a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
69 deletions
+74
-69
common.sh
play.d/common.sh
+74
-69
No files found.
play.d/common.sh
View file @
1c65cc7d
...
...
@@ -9,26 +9,54 @@ fatal()
exit
1
}
[
-n
"
$BIGTMPDIR
"
]
||
[
-d
"/var/tmp"
]
&&
BIGTMPDIR
=
"/var/tmp"
||
BIGTMPDIR
=
"/tmp"
cd_to_temp_dir
()
{
PKGDIR
=
$(
mktemp
-d
--tmpdir
=
$BIGTMPDIR
)
trap
"rm -fr
$PKGDIR
"
EXIT
cd
$PKGDIR
||
fatal
}
# check if <arg> is a real command
is_command
()
{
epm tool which
"
$1
"
>
/dev/null
}
eget
()
.
$(
dirname
$0
)
/common-outformat.sh
check_tty
#__showcmd_shifted()
#{
# local s="$1"
# shift
# shift $s
# showcmd "$*"
#}
# add to all epm calls
EPM
=
"
$(
epm tool which epm
)
"
||
fatal
epm
()
{
epm tool eget
"
$@
"
#if [ "$1" = "tool" ] ; then
# __showcmd_shifted 1 "$@"
if
[
"
$1
"
!=
"print"
]
&&
[
"
$1
"
!=
"tool"
]
&&
[
"
$1
"
!=
"status"
]
;
then
showcmd
"
$(
basename
$EPM
)
$*
"
fi
$EPM
"
$@
"
}
[
-n
"
$BIGTMPDIR
"
]
||
[
-d
"/var/tmp"
]
&&
BIGTMPDIR
=
"/var/tmp"
||
BIGTMPDIR
=
"/tmp"
cd_to_temp_dir
()
eget
()
{
PKGDIR
=
$(
mktemp
-d
--tmpdir
=
$BIGTMPDIR
)
trap
"rm -fr
$PKGDIR
"
EXIT
cd
$PKGDIR
||
fatal
epm tool eget
"
$@
"
}
is_supported_arch
()
{
local
i
...
...
@@ -63,7 +91,7 @@ print_product_alt()
get_pkgvendor
()
{
epm print field Vendor
for
package
$1
epm print field Vendor
for
package
"
$1
"
}
# arg: minimal require of libstdc++ version
...
...
@@ -124,7 +152,44 @@ check_alternative_pkgname()
done
}
# support direct run the script
is_repacked_package
()
{
local
pkg
=
"
$1
"
[
-n
"
$pkg
"
]
||
pkg
=
"
$PKGNAME
"
[
-n
"
$pkg
"
]
||
return
0
#fatal "is_repacked_package() is called without package name"
# actually only for ALT
[
"
$(
epm print info
-s
)
"
=
"alt"
]
||
return
0
epm status
--installed
$pkg
||
return
0
[
-n
"
$force
"
]
&&
return
0
if
epm status
--original
$pkg
;
then
echo
"Package
$pkg
is already installed from ALT repository."
return
1
fi
if
epm status
--certified
$pkg
;
then
# allow install/update if we agreed with their package
return
0
fi
if
epm status
--thirdparty
$pkg
;
then
echo
"Package
$pkg
is already installed, packaged by vendor
$(
epm print field Vendor
for
$pkg
)
."
return
1
fi
if
!
epm status
--repacked
$pkg
;
then
echo
"Package
$pkg
is already installed (possible, manually packed)."
return
1
fi
return
0
}
# support for direct run a play script
if
[
-x
"../bin/epm"
]
;
then
export
PATH
=
"
$(
realpath
../bin
)
:
$PATH
"
fi
...
...
@@ -224,66 +289,6 @@ esac
is_supported_arch
"
$(
epm print info
-a
)
"
||
fatal
"Only '
$SUPPORTEDARCHES
' architectures is supported"
.
$(
dirname
$0
)
/common-outformat.sh
check_tty
__showcmd_shifted
()
{
local
s
=
"
$1
"
shift
shift
$s
showcmd
"
$*
"
}
# add to all epm calls
EPM
=
"
$(
epm tool which epm
)
"
||
fatal
epm
()
{
#if [ "$1" = "tool" ] ; then
# __showcmd_shifted 1 "$@"
if
[
"
$1
"
!=
"print"
]
&&
[
"
$1
"
!=
"tool"
]
&&
[
"
$1
"
!=
"status"
]
;
then
showcmd
"
$(
basename
$EPM
)
$*
"
fi
$EPM
"
$@
"
}
is_repacked_package
()
{
local
pkg
=
"
$1
"
[
-n
"
$pkg
"
]
||
pkg
=
"
$PKGNAME
"
[
-n
"
$pkg
"
]
||
return
0
#fatal "is_repacked_package() is called without package name"
# actually only for ALT
[
"
$(
epm print info
-s
)
"
=
"alt"
]
||
return
0
epm status
--installed
$pkg
||
return
0
[
-n
"
$force
"
]
&&
return
0
if
epm status
--original
$pkg
;
then
echo
"Package
$pkg
is already installed from ALT repository."
return
1
fi
if
epm status
--certified
$pkg
;
then
# allow install/update if we agreed with their package
return
0
fi
if
epm status
--thirdparty
$pkg
;
then
echo
"Package
$pkg
is already installed, packaged by vendor
$(
epm print field Vendor
for
$pkg
)
."
return
1
fi
if
!
epm status
--repacked
$pkg
;
then
echo
"Package
$pkg
is already installed (possible, manually packed)."
return
1
fi
return
0
}
# skip install if there is package installed not via epm play
is_repacked_package
$REPOPKGNAME
||
exit
0
...
...
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