OpenWrt scripts run after startup

Source: Internet
Author: User

OpenWrt The system starts, run the/etc/preinit script first
to Newifi y1s for example, and then swipe in the Pandorabox firmware

#!/bin/sh # Copyright (c) 2006 Openwrt.org # Copyright (c) Vertical Communications [-z] $P Reinit "] && exec/sbin/init export path=/bin:/sbin:/usr/bin:/usr/sbin pi_ifname= pi_ip=192.168.1.1 Pi_broadcas t=192.168.1.255 pi_netmask=255.255.255.0 fs_failsafe_ifname= fs_failsafe_ip=192.168.1.1 fs_failsafe_broadcast= 192.168.1.255 fs_failsafe_netmask=255.255.255.0 fs_failsafe_wait_timeout=2 pi_suppress_stderr= "y" pi_init_suppress _stderr= "y" pi_init_path= "/bin:/sbin:/usr/bin:/usr/sbin" pi_init_cmd= "/sbin/init". /lib/functions.sh. /lib/functions/preinit.sh. /lib/functions/system.sh boot_hook_init preinit_essential boot_hook_init preinit_main boot_hook_init failsafe boot_ Hook_init Initramfs boot_hook_init preinit_mount_root for Pi_source_file in/lib/preinit/*; Do. $pi _source_file done Boot_run_hook preinit_essential pi_mount_skip_next=false pi_jffs2_mount_success=false pi_ Failsafe_net_message=false Boot_run_hook Preinit_main 

As you can see from the script,
/lib/functions.sh
/lib/functions/preinit.sh
/lib/functions/system.sh
These three scripts provide function functions for preinit call execution.
The PreInit script executes the initialization of a series of shell scripts
Directory under the/lib/preinit/directory

[Root@pandorabox:/lib/preinit] #ls
01_reset_esw_port.sh         40_run_failsafe_hook
02_default_set_state         50_indicate_regular_preinit
03_preinit_do_ralink.sh      70_initramfs_test
10_indicate_failsafe         80_mount_root
10_indicate_preinit          99_10_failsafe_login
10_sysinfo                   99_10_run_init
30_failsafe_wait
[root@pandorabox:/lib/preinit]#

These scripts can be modified as required
OpenWrt These scripts into five types of hooks:

Preinit_essential
Preinit_main
Failsafe
Initramfs
Preinit_mount_root

Execute these scripts by name

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.