smarter install (hopefully) allows to pre-set hostname

updated config and advanced for phone viewing
This commit is contained in:
mcguirepr89
2022-01-29 13:04:35 -05:00
parent 31f2edbd2a
commit c813031feb
5 changed files with 174 additions and 37 deletions
+20 -14
View File
@@ -14,7 +14,7 @@
width: calc(50% - 70px);
}
.second {
width: calc(50% - 30px);
width: calc(50% - 70px);
}
.
/* Clear floats after the columns */
@@ -62,17 +62,19 @@ input {
font-size:large;
}
@media screen and (max-width: 800px) {
h2 {
margin-bottom:0px;
h2,h3 {
text-align:center;
} form {
text-align:left;
margin-left:0px;
}
}
form {
margin:0;
}
.column {
float: none;
width: 100%;
}
input, label {
width: 100%;
{
}
</style>
</head>
@@ -83,9 +85,9 @@ input {
<form action="write_advanced.php" method="POST">
<?php
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
} ?>
<h3>Defaults</h3>
<label for="full_disk">Full Disk Behavior: </label>
@@ -106,7 +108,7 @@ if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
<label for="ice_pwd">Live Audio Stream: </label>
<input name="ice_pwd" type="text" value="<?php print($config['ICE_PWD']);?>" required/><br>
</div>
<div class="column first">
<div class="column second">
<h3>Custom URLs</h3>
<label for="birdnetpi_url">BirdNET-Pi URL: </label>
<input name="birdnetpi_url" type="text" value="<?php print($config['BIRDNETPI_URL']);?>" /><br>
@@ -123,13 +125,13 @@ if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
<input name="sensitivity" type="text" value="<?php print($config['SENSITIVITY']);?>" required/><br>
<br><br>
<button type="submit" class="block"><?php
@session_start();
@session_start();
if(isset($_SESSION['success'])){
echo "Success!";
unset($_SESSION['success']);
echo "Success!";
unset($_SESSION['success']);
} else {
echo "Update Settings";
echo "Update Settings";
}
?></button>
<br>
@@ -137,6 +139,10 @@ if(isset($_SESSION['success'])){
<form action="config.php" style="margin:0;">
<button type="submit" class="block">Basic Settings</button>
</form>
<br>
<form action="index.html" style="margin:0;">
<button type="submit" class="block">Tools</button>
</form>
</div>
</div>
</body>
+15 -6
View File
@@ -52,6 +52,7 @@ form {
text-align:left;
margin-left:20px;
}
h2 {
margin-bottom:0px;
}
@@ -70,6 +71,9 @@ input {
font-size:large;
}
@media screen and (max-width: 800px) {
select {
width:100%;
}
h2 {
margin-bottom:0px;
text-align:center;
@@ -79,9 +83,12 @@ input {
margin-left:0px;
}
.column {
float: none;
width: 100%;
}
float: none;
width: 100%;
}
input, label {
width:100%;
{
}
</style>
</head>
@@ -106,7 +113,7 @@ if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
<input name="pushed_app_key" type="text" value="<?php print($config['PUSHED_APP_KEY']);?>" /><br>
<label for="pushed_app_secret">Pushed App Secret: </label>
<input name="pushed_app_secret" type="text" value="<?php print($config['PUSHED_APP_SECRET']);?>" /><br>
<label for"language">Database Language: </label>
<label for="language">Database Language: </label>
<select name="language">
<option value="none">Select your language</option>
<option value="labels_af.txt">Afrikaans</option>
@@ -150,11 +157,13 @@ if(isset($_SESSION['success'])){
echo "Update Settings";
}
?></button>
<br>
</form>
<form action="advanced.php">
<form action="advanced.php" class="form2">
<button type="submit" class="block">Advanced Settings</button>
</form>
<form action="index.html" class="form2">
<button type="submit" class="block">Tools</button>
</form>
</div>
</div>
</body>
+136
View File
@@ -0,0 +1,136 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
' Calibri', 'Trebuchet MS', 'sans-serif';
box-sizing: border-box;
}
body {
width: 50%;
margin-left: auto;
margin-right: auto;
background-color: rgb(119, 196, 135);
}
a {
text-decoration: none;
}
.block {
display: block;
width:100%;
border: none;
padding: 10px 10px;
font-size: medium;
cursor: pointer;
text-align: center;
}
select {
font-size:large;
width: 60%;
}
select option {
font-size:large;
}
form {
text-align:left;
padding:10px;
}
h1, h2 {
margin-bottom:0px;
}
h3 {
margin-left: -10px;
}
label {
float:left;
width:40%;
font-weight:bold;
}
input {
width:60%;
text-align:center;
font-size:large;
}
.center {
display: block;
margin-left: auto;
margin-right: auto;
}
@media screen and (max-width: 800px) {
h1, h2 {
text-align:center;
}
form {
text-align:left;
margin-left:0px;
}
select, body, button, input, label {
width:100%;
{
}
</style>
</head>
<h1 style="text-align:center;">Welcome!</h1>
<img class="center" alt="Can't Load Logo" src="../red-cardinal.png"/>
<body style="background-color: rgb(119, 196, 135);">
<form action="write_config.php" method="POST">
<p style="font-size:large">Thank you for installing BirdNET-Pi!
to get started, fill out the Required sections below.</p>
<h2>Required</h2>
<label for="latitude">Latitude: </label>
<input name="latitude" type="text" value="" required/><br>
<label for="longitude">Longitude: </label>
<input name="longitude" type="text" value="" required/><br>
<h2>Optional Services</h2>
<p>The services below are not required, but they are pretty cool.</p>
<label for="birdweather_id">BirdWeather ID: </label>
<input name="birdweather_id" type="text" value="" /><br>
<p>app.BirdWeather.com is a weather map for bird sounds. Stations around the world supply audio and video streams to BirdWeather where they are then analyzed by BirdNET and compared to eBird Grid data. BirdWeather catalogues the detections and visualizations so that you can listen to, view, and read about the birds in various regions across the globe! Pretty cool!</p>
<label for="pushed_app_key">Pushed App Key: </label>
<input name="pushed_app_key" type="text" value="" /><br>
<label for="pushed_app_secret">Pushed App Secret: </label>
<input name="pushed_app_secret" type="text" value="" /><br>
<p>Pushed.co is used to offer New Species notifications. Sorry Android users, but the Pushed.co Application is only for iOS.</p>
<label for="language">Database Language: </label>
<select name="language">
<option value="none">Select your language</option>
<option value="labels_af.txt">Afrikaans</option>
<option value="labels_ca.txt">Catalan</option>
<option value="labels_cs.txt">Czech</option>
<option value="labels_zh.txt">Chinese</option>
<option value="labels_hr.txt">Croatian</option>
<option value="labels_da.txt">Danish</option>
<option value="labels_nl.txt">Dutch</option>
<option value="labels_en.txt">English</option>
<option value="labels_et.txt">Estonian</option>
<option value="labels_fi.txt">Finnish</option>
<option value="labels_fr.txt">French</option>
<option value="labels_de.txt">German</option>
<option value="labels_hu.txt">Hungarian</option>
<option value="labels_is.txt">Icelandic</option>
<option value="labels_id.txt">Indonesia</option>
<option value="labels_it.txt">Italian</option>
<option value="labels_ja.txt">Japanese</option>
<option value="labels_lv.txt">Latvian</option>
<option value="labels_lt.txt">Lithuania</option>
<option value="labels_no.txt">Norwegian</option>
<option value="labels_pl.txt">Polish</option>
<option value="labels_pt.txt">Portugues</option>
<option value="labels_ru.txt">Russian</option>
<option value="labels_sk.txt">Slovak</option>
<option value="labels_sl.txt">Slovenian</option>
<option value="labels_es.txt">Spanish</option>
<option value="labels_sv.txt">Swedish</option>
<option value="labels_th.txt">Thai</option>
<option value="labels_uk.txt">Ukrainian</option>
</select>
<br><br>
</body>
<footer>
<button type="submit" class="block">I Am Finished!</button>
</footer>
</form>
+2 -2
View File
@@ -12,7 +12,7 @@ gotty_url="https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_a
config_file="$(dirname ${my_dir})/birdnet.conf"
set_hostname() {
if [ "$(hostname)" != "birdnetpi" ];then
if [ "$(hostname)" == "raspberrypi" ];then
echo "Setting hostname to 'birdnetpi'"
hostnamectl set-hostname birdnetpi
sed -i 's/raspberrypi/birdnetpi/g' /etc/hosts
@@ -326,7 +326,7 @@ ExecStart=/bin/bash -c "/usr/bin/avahi-publish -a -R %I $(hostname -I |cut -d' '
[Install]
WantedBy=multi-user.target
EOF
systemctl enable avahi-alias@birdnetpi.local.service
systemctl enable avahi-alias@$(hostname).local.service
}
install_spectrogram_service() {
+1 -15
View File
@@ -11,24 +11,12 @@ nomachine_url="https://download.nomachine.com/download/7.7/Arm/nomachine_7.7.4_1
gotty_url="https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_arm.tar.gz"
config_file="$(dirname ${my_dir})/birdnet.conf"
set_hostname() {
if [ "$(hostname)" != "birdnetpi" ];then
echo "Setting hostname to 'birdnetpi'"
hostnamectl set-hostname birdnetpi
sed -i 's/raspberrypi/birdnetpi/g' /etc/hosts
fi
}
install_ftpd() {
if ! [ -f /etc/ftpuseres ];then
apt -y install ftpd
fi
}
update_system() {
apt update && apt -y upgrade
}
install_scripts() {
echo "Installing BirdNET-Pi scripts to /usr/local/bin"
ln -sf ${my_dir}/* /usr/local/bin/
@@ -331,7 +319,7 @@ ExecStart=/bin/bash -c "/usr/bin/avahi-publish -a -R %I $(hostname -I |cut -d' '
[Install]
WantedBy=multi-user.target
EOF
systemctl enable avahi-alias@birdnetpi.local.service
systemctl enable avahi-alias@$(hostname).local.service
}
install_spectrogram_service() {
@@ -514,8 +502,6 @@ install_cleanup_cron() {
}
install_selected_services() {
set_hostname
update_system
install_scripts
install_birdnet_analysis