Page MenuHomeVyOS Platform

Beep When Fully Booted
Closed, ResolvedPublic

Description

Let's add this to next release!

Beep When Fully Booted

wget http://http.us.debian.org/debian/pool/main/b/beep/beep_1.2.2-24_i386.deb
sudo dpkg -i beep_1.2.2-24_i386.deb
rm beep_1.2.2-24_i386.deb
echo "beep -l 200 -f 750 -n -l 200 -f 1000" | sudo tee -a /etc/init.d/rc.local

Details

Difficulty level
Easy (less than an hour)
Version
-

Event Timeline

syncer triaged this task as Low priority.
syncer added a subscriber: syncer.

@dmbaturin should be no harm from including into 1.1.8 right?

I'll start with 1.2 and backport from there if necessary.

@syncer I think we can remove this task from 1.1.8 backlog, because this is new feature.

Agree, @EwaldvanGeffen can you move it to 1.2.x please

syncer changed the edit policy from "Public (No Login Required)" to "Custom Policy".Aug 21 2017, 12:34 AM
syncer removed a project: VyOS 1.1.x (1.1.8).
syncer set Version to -.
syncer moved this task from Need Triage to Backlog on the VyOS 1.2 Crux board.
syncer removed subscribers: VyOS 1.2 Crux, VyOS 1.1.x.
In T201#14503, @c-po wrote:

any updates on this?

unfortunately no. Please reassign.

c-po mentioned this in Unknown Object (Ponder Answer).May 26 2018, 2:04 PM
hagbard changed the task status from Open to In progress.Jun 6 2018, 4:09 PM

Interface definition is the last piece which needs to be done, should happen this week.

Sorry I got stuck a little.
I have the interface definition written, using the new recommended style. However, create/delete and the such need to be handled in a script.

interface definition: https://github.com/hagbard-01/vyos-1x/blob/current/interface-definitions/beep-on-boot.xml

That creates the following content:

type: txt
help: plays sound via system speaker when you can login
val_help: enable; plays a sound via system speaker when logins are possible
val_help: disable; disable playing a sound when logins are possible
syntax:expression: exec "${vyos_libexec_dir}/validate-value.py --regex \'(enable|disable)\' --value \'$VAR(@)\'"; "Invalid value"
end: sudo sh -c "/bin/systemctl -q $VAR(@) beep"

But I would either need create/update/delete (systemctl enable|disable is then being called), or a way to detect it via script what was called.
I can easily call a script instead of systemctl direclty, but how do I know the user called a create 'set system options beep-if-fully-booted enable' etc.?

I tried to find it our from existing scripts and via printing the environment our, but I just didn't figure it out how to properly detect that.
Can you point me into the right deirection please?

thx,

-h

Create/update/delete are all called implicit by the execution of the given Python script.

Lets take "service dns forwarding" as example, the python script is here https://github.com/vyos/vyos-1x/blob/current/src/conf_mode/dns_forwarding.py and it is invoked from https://github.com/vyos/vyos-1x/blob/current/interface-definitions/dns-forwarding.xml#L8 here.

So when the Python scripts are executed we analyse the current configuration in get_config() then check if it is correct in verify() and generate the new configuration files in generate(). After the configuration is generated we simply activate it in apply() usually be starting the service, or stopping it if there is no configuration at all (deleted). The configuration is always generated completely and there is no "update" anymore.

Maybe this is a help, too
http://blog.vyos.net/vyos-2-dot-0-development-digest-number-5-doing-1-dot-2-x-and-2-dot-0-development-in-parallel

Hope this helps

Thanks Christian, that helps a lot. I was assuming I only need to generate configs if I really write config data int oa local file, so I have something to compare.
Thanks again, still need to play with it a little, but I think I understand now the parts of it.