install
是一个随OpenOS附送的软件。对于大多数用户以及大多数电脑而言,安装OpenOS的首选方法便是使用这个install
应用。install
的功能还包括安装软件、运行库以及本mod提供的所有奖励箱软盘的帮助脚本。
要了解有关install
的命令行选项的更多信息,我们推荐通过执行man install
以阅读其man页面,也可以在此处阅读在线版。
install
按以下步骤运行:
首先它会扫描可供候选的安装来源文件系统,即可以被当作安装用软件包的文件系统,例如奖励箱软盘。如果找到了多个候选安装来源,它将会提问用户:
What do you want to install?
下面跟着它找到的可供安装的软盘列表。
下一步是扫描可供候选的安装目标文件系统,即可以作为安装的目标的文件系统,如硬盘。以从奖励箱软盘中向硬盘中安装OpenOS为例,此时的硬盘即为目标文件系统。就像候选安装来源一样,如果install
找到了多个候选安装目标,它也会要求用户选择其中一个:
Where do you want to install to?
下面跟着它找到的可以安装进的硬盘列表。
在继续安装之前,用户会被要求确认安装:
Install OpenOS to /mnt/e03/? [Y/n]
在确认了此步骤后,程序会将奖励箱软盘(对于此样例)中的文件复制到目标文件系统中。要安装的软件中可能会有一个可选的.prop
文件,此文件可以告知install
是否要设定电脑的默认启动文件系统、将其设定为什么标签(若有)以及在安装完成后是否要重启系统。
软件安装软盘还可以提供完全自定义的安装过程,只需在软盘文件系统的根目录下创建一个.install
文件。在确认安装来源与安装目标后,只要.install
文件存在于安装来源文件系统,install
程序就会唤起它。
推荐你查看install
的man页面以获取更详细的细节以及支持参数的完整列表。但是我考虑到有一点最好在这里提一下,奖励箱软盘的标签可以被用于install
的参数——这样可以让搜索候选软盘时仅搜索标签一致的软盘。
install openos
请注意,参数忽略大小写。在同时有多个软件安装软盘可用于安装时,以此方式指定标签可能会使得install
在不询问用户的情况下减少候选项。
Besides installing loot disks (such as openos), It is intended that users can take advantage of the install
program for custom software disks. If you are providing software distributed on a portable filesystem, you can expect install
to be a useful utility. For this documentation we'll assume you are distributing your software via floppy disk, though install
does not distinguish between any filesystem component, floppy or hard disk or other.
The most basic and default way to use install
with your software disk is to do nothing, and it'll just sort of work. install
checks all available filesystems that have any files and considers them candidates for installation. The user is prompted to select what to install, and install
does a very simple copy of all files in that disk to the selected destination. This is actually how OpenOS itself installs.
You have some control over how install behaves by creating a custom .prop and/or a custom .install file at the root of your software distribution disk. The .prop file is expected to be a valid lua table that set optional flags for install
. For example, the openos .prop file contents are: {label = "OpenOS", reboot=true, setlabel=true, setboot=true}
Note that install
's default copy action skips .prop (.prop is not copied).
install
can refer to and label installation options. By default, install
uses the filesystem label (or the filesystem address if no label is set). This label can be helpful for install
and the user experience. The user can actually tell install
what to install from a command line argument before even being prompted about install options. For example, if you type install openos
, and in the chance there were other installation options – install
will only give the openos option for install. It is a way for a user to specifically get what they want before being asked. In addition to this, install
uses the same labelling logic when listing the install options.
You can override the label install
uses by defining the label
table key in your .prop
file. If you want your users to be able to say: install my_cool_stuff
, you'll want to create a .prop file at the root of your software disk that is: {label="my_cool_stuff"}
In the case that you are using install
and also using multiple filesystems and floppies, it might become an annoyance that install
always includes disks as candidate installation sources when you'd really just prefer it ignore it. You can create a .prop file that has {ignore=true}
and the next time install
is run, it won't list that filesystem as a source option.
If you have a more complex set of operations than JUST copying files (or even setting the boot disk, setting labels, or rebooting), for example you might want to limit which files are copied, and where they are copied to (the default copy destination is the root of the target filesystem). Note that a user can control which sub directory are copied and to where using install
arguments, but perhaps you want to make your software disk's installation a bit more supportive of the user, and you might want to configure the install steps yourself.
Once a user has confirmed your software disk as the installation source, install
will check for the existence of a .install
file (please note that preceding dot in the filename, just like with .prop
). IF that file exists, install
does NOT copy any files, but instead it runs your custom .install
as a script (and then does nothing else). Once your .install
script is running you have full control of how to finish the install process.
Your custom .install
script is given in its loaded environment a helpful install
table that contains all the options that the /bin/install
program has been able to learn thus far.
For example, if this was my custom .install
script, in its entirety (yes, NO OTHER INCLUDES):
for k,v in pairs(install) do io.write(k, " -> ", v) end
This would be the output (my filesystem was mounted on /mnt/c2b, and my .prop file had {label="foo"}
)
from -> /mnt/c2b root -> label -> foo to -> // fromDir ->
The user could have also optionally used some command line args, such as: install foo --noreboot --nosetlabel
. In which case I would see those values passed to my installer script.
教程 | 模组特有内容 | 基础电脑 - 编写代码 - 硬盘 - Autorun与Startup自启动脚本 | |
---|---|---|---|
模组制作 | 自定义架构 - IMC 信息 - OC 1.3 中的API改动 - OC 1.4 中的API改动 - 从源码构建并运行 master-MC1.7.10 版本的 OC | ||
程序 | OPPM - install | ||
其它 | 自定义操作系统 - 中文翻译守则 |