-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #222 from mlcommons/main
syncing main -> dev (can be avoided if we follow the right order of syncing branches)
- Loading branch information
Showing
7 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"alias": "install-apt-package", | ||
"automation_alias": "script", | ||
"automation_uid": "5b4e0237da074764", | ||
"cache": true, | ||
"category": "Detection or installation of tools and artifacts", | ||
"default_env": { | ||
"CM_CLEAN_DIRS": "bin", | ||
"CM_SUDO": "sudo" | ||
}, | ||
"deps": [ | ||
{ | ||
"tags": "detect,os" | ||
} | ||
], | ||
"new_env_keys": [ | ||
], | ||
"tags": [ | ||
"get", | ||
"install", | ||
"apt-package", | ||
"package" | ||
], | ||
"uid": "3688efcd8f324546", | ||
"variations": { | ||
"package.#": { | ||
"env": { | ||
"CM_APT_PACKAGE_NAME": "#" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from cmind import utils | ||
import os | ||
import re | ||
|
||
def preprocess(i): | ||
|
||
os_info = i['os_info'] | ||
|
||
env = i['env'] | ||
state = i['state'] | ||
package_name = env['CM_APT_PACKAGE_NAME'] | ||
|
||
install_cmd = env.get('CM_HOST_OS_PACKAGE_MANAGER_INSTALL_CMD') | ||
if not install_cmd: | ||
return {'return': 1, 'error': 'Package manager installation command not detected for the given OS'} | ||
|
||
sudo = env.get('CM_SUDO', '') | ||
|
||
env['CM_APT_INSTALL_CMD'] = sudo + ' ' +install_cmd + ' ' + package_name | ||
|
||
if env.get('CM_APT_CHECK_CMD', '') != '' and env['CM_APT_INSTALL_CMD'] != '': | ||
env['CM_APT_INSTALL_CMD'] = f"""{env['CM_APT_CHECK_CMD']} || {env['CM_APT_INSTALL_CMD']}""" | ||
|
||
return {'return':0} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
cmd=${CM_APT_INSTALL_CMD} | ||
echo $cmd | ||
eval $cmd | ||
test $? -eq 0 || exit $? |