From cb349200197b36b61ca16665e0f6fa91453d74e3 Mon Sep 17 00:00:00 2001 From: Dana Lewis Date: Sat, 28 Jan 2017 14:32:19 -0800 Subject: [PATCH 1/2] This is creating a file oref0-runagain.sh to save interactive setup options to more easily run again. --- bin/oref0-setup.sh | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/bin/oref0-setup.sh b/bin/oref0-setup.sh index b43eea1d..612b8764 100755 --- a/bin/oref0-setup.sh +++ b/bin/oref0-setup.sh @@ -249,31 +249,34 @@ fi if [[ ! -z "$ENABLE" ]]; then echo -n ", advanced features $ENABLE"; fi echo -echo "To run again with these same options, use:" -echo -n "oref0-setup --dir=$directory --serial=$serial --cgm=$CGM" +# This section is echoing (commenting) back the options you gave it during the interactive setup script. +# The "| tee -a $directory/oref0-runagain.sh" part is also appending it to a file so you can run it again more easily in the future. + +echo "# To run again with these same options, use:" | tee $directory/oref0-runagain.sh +echo -n "oref0-setup --dir=$directory --serial=$serial --cgm=$CGM" | tee -a $directory/oref0-runagain.sh if [[ ${CGM,,} =~ "shareble" ]]; then - echo -n " --bleserial=$BLE_SERIAL" + echo -n " --bleserial=$BLE_SERIAL" | tee -a $directory/oref0-runagain.sh fi -echo -n " --ns-host=$NIGHTSCOUT_HOST --api-secret=$API_SECRET" +echo -n " --ns-host=$NIGHTSCOUT_HOST --api-secret=$API_SECRET" | tee -a $directory/oref0-runagain.sh if [[ ! -z "$ttyport" ]]; then - echo -n " --tty=$ttyport" + echo -n " --tty=$ttyport" | tee -a $directory/oref0-runagain.sh fi -if [[ "$max_iob" -ne 0 ]]; then echo -n " --max_iob=$max_iob"; fi +if [[ "$max_iob" -ne 0 ]]; then echo -n " --max_iob=$max_iob" | tee -a $directory/oref0-runagain.sh; fi if [[ ! -z "$max_daily_safety_multiplier" ]]; then - echo -n " --max_daily_safety_multiplier=$max_daily_safety_multiplier"; + echo -n " --max_daily_safety_multiplier=$max_daily_safety_multiplier" | tee -a $directory/oref0-runagain.sh fi if [[ ! -z "$current_basal_safety_multiplier" ]]; then - echo -n " --current_basal_safety_multiplier=$current_basal_safety_multiplier"; + echo -n " --current_basal_safety_multiplier=$current_basal_safety_multiplier" | tee -a $directory/oref0-runagain.sh fi if [[ ! -z "$bolussnooze_dia_divisor" ]]; then - echo -n " --bolussnooze_dia_divisor=$bolussnooze_dia_divisor"; + echo -n " --bolussnooze_dia_divisor=$bolussnooze_dia_divisor" | tee -a $directory/oref0-runagain.sh fi if [[ ! -z "$min_5m_carbimpact" ]]; then - echo -n " --min_5m_carbimpact=$min_5m_carbimpact"; + echo -n " --min_5m_carbimpact=$min_5m_carbimpact" | tee -a $directory/oref0-runagain.sh fi -if [[ ! -z "$ENABLE" ]]; then echo -n " --enable='$ENABLE'"; fi -if [[ ! -z "$radio_locale" ]]; then echo -n " --radio_locale='$radio_locale'"; fi -echo; echo +if [[ ! -z "$ENABLE" ]]; then echo -n " --enable='$ENABLE'" | tee -a $directory/oref0-runagain.sh; fi +if [[ ! -z "$radio_locale" ]]; then echo -n " --radio_locale='$radio_locale'" | tee -a $directory/oref0-runagain.sh; fi +echo; echo | tee -a $directory/oref0-runagain.sh read -p "Continue? y/[N] " -r if [[ $REPLY =~ ^[Yy]$ ]]; then From 30c4cf1bec1915921782f20503976326347fbf42 Mon Sep 17 00:00:00 2001 From: Dana Lewis Date: Sat, 28 Jan 2017 14:46:26 -0800 Subject: [PATCH 2/2] This is properly doing a tmp and then later saving it to the directory we created. --- bin/oref0-setup.sh | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/bin/oref0-setup.sh b/bin/oref0-setup.sh index 612b8764..1d7c91b6 100755 --- a/bin/oref0-setup.sh +++ b/bin/oref0-setup.sh @@ -250,33 +250,33 @@ if [[ ! -z "$ENABLE" ]]; then echo -n ", advanced features $ENABLE"; fi echo # This section is echoing (commenting) back the options you gave it during the interactive setup script. -# The "| tee -a $directory/oref0-runagain.sh" part is also appending it to a file so you can run it again more easily in the future. +# The "| tee -a /tmp/oref0-runagain.sh" part is also appending it to a file so you can run it again more easily in the future. -echo "# To run again with these same options, use:" | tee $directory/oref0-runagain.sh -echo -n "oref0-setup --dir=$directory --serial=$serial --cgm=$CGM" | tee -a $directory/oref0-runagain.sh +echo "# To run again with these same options, use:" | tee /tmp/oref0-runagain.sh +echo -n "oref0-setup --dir=$directory --serial=$serial --cgm=$CGM" | tee -a /tmp/oref0-runagain.sh if [[ ${CGM,,} =~ "shareble" ]]; then - echo -n " --bleserial=$BLE_SERIAL" | tee -a $directory/oref0-runagain.sh + echo -n " --bleserial=$BLE_SERIAL" | tee -a /tmp/oref0-runagain.sh fi -echo -n " --ns-host=$NIGHTSCOUT_HOST --api-secret=$API_SECRET" | tee -a $directory/oref0-runagain.sh +echo -n " --ns-host=$NIGHTSCOUT_HOST --api-secret=$API_SECRET" | tee -a /tmp/oref0-runagain.sh if [[ ! -z "$ttyport" ]]; then - echo -n " --tty=$ttyport" | tee -a $directory/oref0-runagain.sh + echo -n " --tty=$ttyport" | tee -a /tmp/oref0-runagain.sh fi -if [[ "$max_iob" -ne 0 ]]; then echo -n " --max_iob=$max_iob" | tee -a $directory/oref0-runagain.sh; fi +if [[ "$max_iob" -ne 0 ]]; then echo -n " --max_iob=$max_iob" | tee -a /tmp/oref0-runagain.sh; fi if [[ ! -z "$max_daily_safety_multiplier" ]]; then - echo -n " --max_daily_safety_multiplier=$max_daily_safety_multiplier" | tee -a $directory/oref0-runagain.sh + echo -n " --max_daily_safety_multiplier=$max_daily_safety_multiplier" | tee -a /tmp/oref0-runagain.sh fi if [[ ! -z "$current_basal_safety_multiplier" ]]; then - echo -n " --current_basal_safety_multiplier=$current_basal_safety_multiplier" | tee -a $directory/oref0-runagain.sh + echo -n " --current_basal_safety_multiplier=$current_basal_safety_multiplier" | tee -a /tmp/oref0-runagain.sh fi if [[ ! -z "$bolussnooze_dia_divisor" ]]; then - echo -n " --bolussnooze_dia_divisor=$bolussnooze_dia_divisor" | tee -a $directory/oref0-runagain.sh + echo -n " --bolussnooze_dia_divisor=$bolussnooze_dia_divisor" | tee -a /tmp/oref0-runagain.sh fi if [[ ! -z "$min_5m_carbimpact" ]]; then - echo -n " --min_5m_carbimpact=$min_5m_carbimpact" | tee -a $directory/oref0-runagain.sh + echo -n " --min_5m_carbimpact=$min_5m_carbimpact" | tee -a /tmp/oref0-runagain.sh fi -if [[ ! -z "$ENABLE" ]]; then echo -n " --enable='$ENABLE'" | tee -a $directory/oref0-runagain.sh; fi -if [[ ! -z "$radio_locale" ]]; then echo -n " --radio_locale='$radio_locale'" | tee -a $directory/oref0-runagain.sh; fi -echo; echo | tee -a $directory/oref0-runagain.sh +if [[ ! -z "$ENABLE" ]]; then echo -n " --enable='$ENABLE'" | tee -a /tmp/oref0-runagain.sh; fi +if [[ ! -z "$radio_locale" ]]; then echo -n " --radio_locale='$radio_locale'" | tee -a /tmp/oref0-runagain.sh; fi +echo; echo | tee -a /tmp/oref0-runagain.sh read -p "Continue? y/[N] " -r if [[ $REPLY =~ ^[Yy]$ ]]; then @@ -291,6 +291,10 @@ else die "Can't init $directory" fi cd $directory || die "Can't cd $directory" + +# Taking the oref0-runagain.sh from tmp to $directory +mv /tmp/oref0-runagain.sh ./ + mkdir -p monitor || die "Can't mkdir monitor" mkdir -p raw-cgm || die "Can't mkdir raw-cgm" mkdir -p cgm || die "Can't mkdir cgm"