From 1e7a3d8c5b52d1174b933a39c10ad5b04ce617ce Mon Sep 17 00:00:00 2001 From: Andreas Hechenberger Date: Wed, 13 Jan 2021 23:00:01 +0100 Subject: [PATCH] adds an example for automated answers This commit provides an example in the README.md file for providing the answers which are asked in the raspberrypi.sh up front. This allows an user to run the script automated and without any interaction. --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 44f5ebb..f2216e2 100644 --- a/README.md +++ b/README.md @@ -53,3 +53,25 @@ fixuppm2.sh, cut/paste this line into the terminal window on your device ````bash bash -c "$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror_scripts/master/fixuppm2.sh)" ```` + +## run script with automated answers + +For example, to use the above scripts in an Ansible environment, it may be useful to answer the question up front and then let the script do its work. + +* requirement is the `expect` package which you should find in most linux distributions + * example: `sudo apt install expect` for debian baste distributions + +``` +#!/usr/bin/expect -f + +set timeout -1 +spawn raspberry.sh + +expect "Do you want use pm2 for auto starting of your MagicMirror (y/N)?" +send -- "Y\r" + +expect "Do you want to disable the screen saver? (y/N)?" +send -- "Y\r" + +expect eof +``` \ No newline at end of file