Basically, just use "os.system(str)". For example:
import os
cmd = 'ls'
os.system(cmd)
However, when we need to be root, e.g., running "sudo apt-get update", troubles come out, since a UI application started in N800 menu gives you no chance to input a password for background command "sudo" (in fact, we don't have the default password for maemo neither).
One way of gaining root permission in XTerminal is simply run "sudo gainroot" after install "becomeroot" package. But it does not work in UI application because an application and the command line it starts run in different processes.
To solve the problem, we need to add a line to file "postinst.ex" in debian directry, and change its name into "postinst".
Line 4 is what we add. It makes the script "run-standalone.sh" which starts all applications run well without being asked any passwords even "sudo" executed.
case "$1" in
configure)
echo -e "\n"user ALL = NOPASSWD: /usr/bin/run-standalone.sh >> /etc/sudoers
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
Actually, whatever we want to be executed can be added into the file "postinst", and then it will run during installation. Problems that cannot be worked out by codes may be solved easily here, like modifying files as root, etc.
分享到:
相关推荐
Oracle PL/SQL 执行操作系统命令是一个关键功能,特别是在数据库管理员需要与操作系统进行交互时。开源的PLSQL软件包为数据库用户提供了这样的能力,允许他们在Oracle数据库环境中直接执行操作系统级别的任务,如...
If you ever wanted to open a new worksheet without using built-in commands or create a custom, fully automated form to gather data and store the results in a worksheet, you’ve picked up the right ...
DB Query Analyzer 7.01 allows usersto define monthly or weekly SQL executing plans. Here I will show you how the powerful function works.
The shell is a fundamental tool in Linux, allowing users to interact with the operating system through commands. This chapter teaches readers how to: - **Understanding the Command Line**: Basic ...
狗狗 一个很酷的多用途趣味机器人,带有用于趣味,实用程序,审核,图像,动物等的命令! 指令 适度 姓名 描述 Usgae 例子 别名 禁止 禁止用户访问服务器 !!禁令[提及或ID] [原因] ...清除提供的邮件数量,但数量
《Executing SOA: A Practical Guide for the Service-Oriented Architect》是Norbert Bieberstein、Robert G. Laird、Dr. Keith Jones与Tilak Mitra四位资深SOA实践者共同编著的一本深入探讨服务导向架构(SOA)...
their evaluation cannot alter the state of the corresponding executing system). OCL expressions can be used to specify operations / actions that, when executed, do alter the state of the system. UML ...
Describing the UNIX System in a strictly linear fashion, without any forward references to terms that haven't been described yet, is nearly impossible (and would probably be boring). This chapter ...
AWS_Dynamic_Tasks_Executing_System • 这是一个基于AWS 的多客户端动态任务执行系统。 • 使用AWS SQS 作为任务队列提交和检索任务,使用AWS DynamoDB 解决重复问题,并通过AWS S3 实现数据持久化。 • 基于SQS ...
memory, process, and logical structures involved in establishing a database connection, creating a session, and executing SQL commands...
This book strives to create programmers who understand all elements of computer systems and will be able to engage in any application of the field–from fixing faulty software, to writing more ...
maven settings.xml 解决在项目新建时报错 Error executing Maven. 2 problems were encountered while building the effective settings。下载这个,注意54行的目录,修改成自己的项目目录,直接覆盖原来的\conf...
Sub Task 1: Create a console application, "child", which keeps printing out "The child is talking at [system time]" (in a loop, one per 1s). Sub Task 2: Create another console application, "parent". ...
The Oracle Application/System Development track contains the tasks and steps relating to the development of custom or tool code to support interfaces, conversions, extensions, reports, and integration...