• Reorganized the scripts into different categories

• Refactored the graphical boot screens to have separate boot and shutdown images
• Changed the reboot and shutdown code to force the display of the splash images.
• Added 'Team Onefinity.ngc' to the installer files
This commit is contained in:
David Carley
2022-07-23 20:04:17 -07:00
parent 15a98972b3
commit 41e2334484
36 changed files with 743 additions and 324 deletions

View File

@@ -1,6 +1,6 @@
include package.json README.md requirements.txt
graft scripts
graft python-packages
graft installer
include scripts/install.sh
graft src/py/bbctrl/http
graft src/py/camotics
include src/avr/bbctrl-avr-firmware.hex

View File

@@ -0,0 +1,659 @@
%
G21 G40 G49 M6 T1
G17
M7
G0Z20.320
G0X0.000Y0.000S16000M3
G0X26.732Y12.863Z5.080
G1Z-3.175F1270.0
G1X21.606Y17.989F2540.0
G1Y12.042
G1X25.676Y12.773
G1X26.732Y12.863
G1X34.154Y9.033
G1X19.066Y24.121
G1Y9.006
G1X26.125Y10.273
G2X27.247Y10.273I0.561J-3.125
G1X34.154Y9.033
G0Z5.080
G0X31.766Y33.993
G1Z-3.175F1270.0
G1X21.606Y44.153F2540.0
G1Y43.784
G1X31.766Y33.624
G1Y33.993
G1X34.306Y35.045
G1X19.066Y50.285
G1Y42.732
G1X34.306Y27.492
G1Y35.045
G0Z5.080
G0X31.766Y60.159
G1Z-3.175F1270.0
G1X21.606Y70.318F2540.0
G1Y69.948
G1X31.766Y59.789
G1Y60.159
G1X34.306Y61.211
G1X19.066Y76.450
G1Y68.896
G1X34.306Y53.657
G1Y61.211
G0Z5.080
G0X31.766Y90.231
G1Z-3.175F1270.0
G1X27.488F2540.0
G1X31.766Y85.954
G1Y90.231
G1X34.306Y92.771
G1X21.356
G1X34.306Y79.822
G1Y92.771
G0Z5.080
G0X61.691Y55.036
G1Z-3.175F1270.0
G1X63.248F2540.0
G1Y88.425
G2X66.423Y91.600I3.175J0.000
G1X77.157
G1Y91.866
G1X47.750
G1Y91.600
G1X58.516
G2X61.691Y88.425I0.000J-3.175
G1Y55.036
G0Z5.080
G0X88.590
G1Z-3.175F1270.0
G1X111.381F2540.0
G1Y55.301
G1X93.321
G2X90.146Y58.476I0.000J3.175
G1Y70.643
G2X93.321Y73.818I3.175J0.000
G1X107.380
G1Y74.084
G1X93.321
G2X90.146Y77.259I0.000J3.175
G1Y88.425
G2X93.321Y91.600I3.175J0.000
G1X110.220
G1Y91.866
G1X88.590
G1Y55.036
G0Z5.080
G0X122.153
G1Z-3.175F1270.0
G1X123.719F2540.0
G1X127.166Y64.004
G2X130.130Y66.040I2.964J-1.139
G1X146.391
G2X149.354Y64.004I0.000J-3.175
G1X152.802Y55.036
G1X154.303
G1X139.687Y91.866
G1X136.769
G1X122.153Y55.036
G0Z5.080
G0X132.680Y66.306
G1Z-3.175F1270.0
G2X129.716Y70.620I0.000J3.175F2540.0
G1X132.098Y76.845
G1X133.063Y79.498
G1X134.092Y82.435
G1X135.189Y85.669
G2X138.196Y87.824I3.007J-1.020
G1X138.325
G2X141.328Y85.679I0.000J-3.175
G1X142.433Y82.457
G1X143.467Y79.518
G1X144.433Y76.851
G1X145.333Y74.451
G1X146.805Y70.620
G2X143.841Y66.306I-2.964J-1.138
G1X132.680
G0Z5.080
G0X167.414Y55.036
G1Z-3.175F1270.0
G1X168.971F2540.0
G1Y73.759
G1X168.947Y76.349
G1X168.876Y79.029
G1X168.757Y81.813
G1X168.589Y84.724
G2X171.759Y88.082I3.170J0.183
G1X172.049
G2X175.085Y85.836I0.000J-3.175
G1X175.677Y83.901
G1X176.359Y81.760
G1X177.102Y79.531
G1X177.877Y77.332
G1X182.870Y63.705
G1X182.369Y65.444
G1X181.521Y68.194
G1X180.648Y70.844
G1X179.742Y73.414
G1X173.050Y91.866
G1X167.414
G1Y55.036
G0Z5.080
G0X186.047
G1Z-3.175F1270.0
G1X186.709F2540.0
G1X189.243Y61.950
G2X186.442Y60.271I-2.800J1.496
G1X186.249
G2X183.614Y61.675I0.000J3.175
G1X186.047Y55.036
G0Z5.080
G0X203.785
G1Z-3.175F1270.0
G1X205.342F2540.0
G1Y91.866
G1X199.644
G1X192.952Y73.323
G1X191.959Y70.488
G1X191.055Y67.759
G1X190.236Y65.128
G1X189.586Y62.886
G1X194.879Y77.332
G1X195.654Y79.531
G1X196.397Y81.760
G1X197.079Y83.901
G1X197.670Y85.836
G2X200.707Y88.082I3.036J-0.928
G1X200.997
G2X204.167Y84.733I0.000J-3.175
G1X203.999Y81.672
G1X203.880Y78.828
G1X203.809Y76.184
G1X203.785Y73.726
G1Y55.036
G0Z5.080
G0X186.055Y18.115
G1Z-3.175F1270.0
G1X186.009Y18.105F2540.0
G1X186.055Y17.999
G1Y18.115
G1X185.846Y20.662
G2X183.925Y20.635I-1.003J3.012
G1X183.850Y20.658
G2X182.792Y21.213I0.918J3.039
G1X182.707Y21.280
G1X182.260Y21.714
G1X182.051Y21.961
G1X181.761Y22.394
G1X181.394Y23.076
G1X181.055Y23.830
G1X173.477Y41.419
G1X172.282
G1Y8.016
G1X172.558
G1Y24.599
G1X172.580Y25.408
G1X172.663Y26.179
G1X172.774Y26.696
G1X172.878Y27.007
G1X173.108Y27.530
G1X173.164Y27.632
G2X173.748Y28.390I2.780J-1.535
G1X173.813Y28.452
G2X175.480Y29.290I2.196J-2.293
G1X175.555Y29.303
G2X177.475Y29.026I0.528J-3.131
G1X177.562Y28.984
G2X178.399Y28.391I-1.391J-2.854
G1X178.498Y28.294
G1X178.838Y27.899
G1X179.037Y27.625
G1X179.285Y27.206
G1X179.505Y26.777
G1X187.630Y8.016
G1X188.570
G1Y41.419
G1X188.294
G1Y25.010
G1X188.271Y24.216
G1X188.177Y23.433
G1X188.086Y23.078
G1X187.917Y22.590
G1X187.870Y22.482
G2X187.362Y21.681I-2.906J1.279
G1X187.306Y21.616
G2X185.911Y20.684I-2.399J2.080
G1X185.846Y20.662
G0Z5.080
G0X174.797Y31.718
G1Z-3.175F1270.0
G1X174.912Y31.742F2540.0
G1X174.797Y32.011
G1Y31.718
G0Z5.080
G0X201.208Y8.016
G1Z-3.175F1270.0
G1X201.483F2540.0
G1Y41.419
G1X201.208
G1Y8.016
G0Z5.080
G0X221.852
G1Z-3.175F1270.0
G1X222.128F2540.0
G1Y35.585
G1X222.152Y36.556
G1X222.239Y37.441
G1X222.338Y37.967
G1X222.494Y38.513
G1X222.648Y38.864
G1X222.990Y39.459
G1X223.068Y39.565
G2X223.987Y40.409I2.564J-1.872
G1X224.094Y40.473
G1X224.660Y40.744
G1X224.991Y40.863
G1X225.495Y40.981
G1X225.981Y41.055
G1X226.840Y41.124
G1X227.808Y41.143
G1X229.857
G1Y41.419
G1X214.122
G1Y41.143
G1X217.128Y41.132
G1X217.865Y41.093
G1X218.540Y41.009
G1X219.037Y40.895
G1X219.329Y40.787
G1X219.958Y40.472
G1X220.109Y40.375
G1X220.711Y39.869
G1X220.827Y39.744
G1X221.305Y39.070
G1X221.385Y38.918
G1X221.658Y38.205
G1X221.703Y38.027
G1X221.790Y37.485
G1X221.837Y36.840
G1X221.852Y35.846
G1Y8.016
G0Z5.080
G0X250.225
G1Z-3.175F1270.0
G1X250.501F2540.0
G1Y16.797
G1X250.516Y17.761
G1X250.567Y18.756
G1X250.681Y19.487
G1X250.826Y20.159
G1X251.009Y20.832
G1X257.512Y41.419
G1X257.222
G1X253.849Y30.875
G1X253.398Y29.763
G1X253.228Y29.421
G1X252.892Y28.886
G1X252.817Y28.790
G2X250.547Y27.571I-2.508J1.947
G1X250.489Y27.567
G2X248.506Y28.080I-0.238J3.166
G1X248.444Y28.121
G2X247.655Y28.861I1.745J2.653
G1X247.590Y28.947
G1X247.304Y29.401
G1X247.150Y29.698
G1X246.888Y30.394
G1X246.668Y31.132
G1X243.420Y41.419
G1X243.133
G1X249.500Y21.400
G1X249.680Y20.918
G1X249.880Y20.269
G1X250.036Y19.612
G1X250.149Y18.936
G1X250.190Y18.463
G1X250.211Y17.912
G1X250.225Y16.513
G1Y8.016
G0Z5.080
G0X159.368
G1Z-3.175F1270.0
G1X159.644F2540.0
G1Y41.419
G1X159.368
G1Y8.016
G0Z5.080
G0X133.203
G1Z-3.175F1270.0
G1X133.478F2540.0
G1Y19.288
G1X133.495Y20.123
G1X133.556Y20.925
G1X133.697Y21.712
G1X133.822Y22.074
G1X134.078Y22.633
G1X134.130Y22.723
G2X135.032Y23.713I2.746J-1.594
G1X135.122Y23.778
G1X135.738Y24.121
G1X136.070Y24.260
G1X136.588Y24.399
G1X137.076Y24.485
G1X137.885Y24.559
G1X138.771Y24.580
G1X145.626
G1Y24.855
G1X139.094
G1X138.075Y24.883
G1X137.539Y24.929
G1X137.029Y24.999
G1X136.489Y25.115
G1X136.122Y25.236
G1X135.630Y25.447
G1X135.480Y25.527
G1X134.777Y26.035
G1X134.681Y26.127
G1X134.136Y26.817
G1X134.084Y26.906
G1X133.828Y27.457
G1X133.702Y27.818
G1X133.557Y28.600
G1X133.495Y29.391
G1X133.478Y30.207
G1Y35.748
G1X133.502Y36.665
G1X133.541Y37.153
G1X133.601Y37.619
G1X133.699Y38.112
G1X133.873Y38.681
G1X134.045Y39.039
G1X134.470Y39.698
G1X134.548Y39.791
G2X135.430Y40.523I2.436J-2.037
G1X135.520Y40.574
G1X136.072Y40.818
G1X136.429Y40.936
G1X137.204Y41.070
G1X137.999Y41.128
G1X138.833Y41.143
G1X146.730
G1Y41.419
G1X133.203
G1Y8.016
G0Z5.080
G0X107.038
G1Z-3.175F1270.0
G1X120.565F2540.0
G1Y8.291
G1X112.934
G1X111.953Y8.315
G1X111.446Y8.353
G1X110.966Y8.412
G1X110.462Y8.507
G1X109.883Y8.676
G1X109.516Y8.848
G1X108.829Y9.284
G1X108.734Y9.363
G2X108.068Y10.127I2.031J2.441
G1X108.003Y10.231
G1X107.733Y10.777
G1X107.609Y11.102
G1X107.485Y11.599
G1X107.405Y12.080
G1X107.334Y12.901
G1X107.313Y13.808
G1Y19.288
G1X107.330Y20.123
G1X107.391Y20.925
G1X107.532Y21.712
G1X107.657Y22.074
G1X107.913Y22.633
G1X107.965Y22.723
G2X108.867Y23.713I2.746J-1.594
G1X108.957Y23.778
G1X109.573Y24.121
G1X109.905Y24.260
G1X110.423Y24.399
G1X110.911Y24.485
G1X111.720Y24.559
G1X112.606Y24.580
G1X119.461
G1Y24.855
G1X112.929
G1X111.910Y24.883
G1X111.374Y24.929
G1X110.863Y24.999
G1X110.323Y25.115
G1X109.957Y25.236
G1X109.464Y25.447
G1X109.315Y25.527
G1X108.612Y26.035
G1X108.516Y26.127
G1X107.971Y26.817
G1X107.919Y26.906
G1X107.663Y27.457
G1X107.536Y27.818
G1X107.392Y28.600
G1X107.330Y29.391
G1X107.313Y30.207
G1Y35.748
G1X107.337Y36.665
G1X107.376Y37.153
G1X107.436Y37.619
G1X107.534Y38.112
G1X107.708Y38.681
G1X107.880Y39.039
G1X108.305Y39.698
G1X108.383Y39.791
G2X109.265Y40.523I2.436J-2.037
G1X109.355Y40.573
G1X109.907Y40.817
G1X110.263Y40.936
G1X111.039Y41.070
G1X111.834Y41.128
G1X112.668Y41.143
G1X120.565
G1Y41.419
G1X107.038
G1Y8.016
G0Z5.080
G0X91.885Y18.115
G1Z-3.175F1270.0
G1X91.839Y18.105F2540.0
G1X91.885Y17.998
G1Y18.115
G1X91.677Y20.662
G2X89.754Y20.635I-1.004J3.012
G1X89.680Y20.658
G2X88.622Y21.213I0.918J3.039
G1X88.537Y21.280
G1X88.090Y21.713
G1X87.881Y21.961
G1X87.591Y22.393
G1X87.224Y23.076
G1X86.885Y23.829
G1X79.307Y41.419
G1X78.112
G1Y8.016
G1X78.388
G1Y24.599
G1X78.409Y25.408
G1X78.493Y26.180
G1X78.604Y26.697
G1X78.709Y27.008
G1X78.939Y27.531
G1X78.995Y27.633
G2X79.578Y28.391I2.779J-1.535
G1X79.643Y28.453
G2X81.310Y29.290I2.196J-2.293
G1X81.385Y29.302
G2X83.305Y29.026I0.529J-3.131
G1X83.392Y28.983
G2X84.229Y28.391I-1.392J-2.854
G1X84.328Y28.294
G1X84.668Y27.899
G1X84.867Y27.625
G1X85.115Y27.206
G1X85.335Y26.777
G1X93.460Y8.016
G1X94.400
G1Y41.419
G1X94.124
G1Y25.009
G1X94.101Y24.216
G1X94.007Y23.432
G1X93.916Y23.078
G1X93.747Y22.590
G1X93.700Y22.482
G2X93.193Y21.681I-2.906J1.279
G1X93.137Y21.617
G2X91.742Y20.684I-2.399J2.079
G1X91.677Y20.662
G0Z5.080
G0X80.627Y31.718
G1Z-3.175F1270.0
G1X80.742Y31.742F2540.0
G1X80.627Y32.010
G1Y31.718
G0Z5.080
G0X56.689Y8.295
G1Z-3.175F1270.0
G1X57.314Y8.143F2540.0
G1X57.985Y8.049
G1X58.710Y8.016
G1X59.435Y8.049
G1X60.106Y8.143
G1X60.731Y8.295
G1X61.320Y8.505
G1X61.883Y8.775
G1X62.429Y9.109
G1X62.964Y9.516
G1X63.493Y10.004
G1X63.980Y10.541
G1X64.387Y11.085
G1X64.721Y11.636
G1X64.989Y12.201
G1X65.197Y12.788
G1X65.348Y13.407
G1X65.441Y14.069
G1X65.474Y14.815
G1X65.465Y35.027
G1X65.401Y35.727
G1X65.278Y36.377
G1X65.098Y36.986
G1X64.861Y37.562
G1X64.563Y38.116
G1X64.197Y38.656
G1X63.755Y39.187
G1X63.241Y39.701
G1X62.710Y40.142
G1X62.170Y40.508
G1X61.616Y40.807
G1X61.040Y41.044
G1X60.431Y41.224
G1X59.781Y41.347
G1X59.081Y41.410
G1X58.339
G1X57.639Y41.347
G1X56.989Y41.224
G1X56.381Y41.044
G1X55.804Y40.807
G1X55.250Y40.508
G1X54.710Y40.142
G1X54.179Y39.701
G1X53.665Y39.187
G1X53.224Y38.656
G1X52.858Y38.116
G1X52.559Y37.562
G1X52.322Y36.986
G1X52.142Y36.377
G1X52.019Y35.727
G1X51.956Y35.027
G1X51.956Y14.417
G1X52.018Y13.732
G1X52.140Y13.093
G1X52.320Y12.491
G1X52.558Y11.916
G1X52.858Y11.359
G1X53.228Y10.812
G1X53.674Y10.272
G1X54.191Y9.750
G1X54.722Y9.303
G1X55.262Y8.933
G1X55.816Y8.632
G1X56.391Y8.393
G1X56.689Y8.295
G0Z5.080
G0X56.804Y8.566
G1Z-3.175F1270.0
G1X56.190Y8.789F2540.0
G1X55.603Y9.076
G1X55.053Y9.420
G1X54.545Y9.814
G1X54.085Y10.247
G1X53.673Y10.711
G1X53.303Y11.209
G1X52.978Y11.746
G1X52.705Y12.317
G1X52.490Y12.915
G1X52.338Y13.530
G1X52.248Y14.154
G1X52.222Y14.705
G1Y34.727
G1X52.247Y35.285
G1X52.335Y35.913
G1X52.485Y36.536
G1X52.699Y37.143
G1X52.975Y37.726
G1X53.308Y38.275
G1X53.691Y38.784
G1X54.116Y39.250
G1X54.583Y39.676
G1X55.091Y40.058
G1X55.640Y40.391
G1X56.223Y40.667
G1X56.831Y40.881
G1X57.453Y41.031
G1X58.082Y41.119
G1X58.710Y41.147
G1X59.339Y41.119
G1X59.967Y41.031
G1X60.590Y40.881
G1X61.197Y40.667
G1X61.780Y40.391
G1X62.329Y40.058
G1X62.837Y39.676
G1X63.304Y39.250
G1X63.730Y38.784
G1X64.112Y38.275
G1X64.445Y37.726
G1X64.721Y37.143
G1X64.935Y36.536
G1X65.086Y35.913
G1X65.173Y35.285
G1X65.198Y34.727
G1Y14.705
G1X65.172Y14.154
G1X65.083Y13.530
G1X64.930Y12.915
G1X64.716Y12.317
G1X64.443Y11.746
G1X64.118Y11.209
G1X63.748Y10.711
G1X63.335Y10.247
G1X62.875Y9.814
G1X62.367Y9.420
G1X61.817Y9.076
G1X61.230Y8.789
G1X60.616Y8.566
G1X59.985Y8.409
G1X59.348Y8.317
G1X58.710Y8.288
G1X58.072Y8.317
G1X57.435Y8.409
G1X56.804Y8.566
G0Z5.080
G0Z20.320
G0X0.000Y0.000
M2
%

View File

@@ -23,9 +23,6 @@ fi
# Reload udev
/etc/init.d/udev restart
# Stop boot splash so it doesn't interfere with X if GPU enabled and to save CPU
plymouth quit
# Start X in /home/pi
cd /home/pi
sudo -u pi startx

BIN
installer/splash/boot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View File

@@ -0,0 +1,8 @@
[Plymouth Theme]
Name=onefinity
Description=Onefinity
ModuleName=script
[script]
ImageDir=/usr/share/plymouth/themes/onefinity
ScriptFile=/usr/share/plymouth/themes/onefinity/onefinity.script

View File

@@ -1,7 +1,12 @@
screenW = Window.GetWidth();
screenH = Window.GetHeight();
image = Image("splash.png");
image = Image("boot.png");
if (Plymouth.GetMode() == "shutdown") {
image = Image("shutdown.png");
}
imageW = image.GetWidth();
imageH = image.GetHeight();

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -1,259 +0,0 @@
#!/bin/bash -e
AP=false
DISABLE=false
SSID=
PASS=
CHANNEL=7
REBOOT=false
WLAN0_CFG=/etc/network/interfaces.d/wlan0
HOSTAPD_CFG=/etc/hostapd/hostapd.conf
DNSMASQ_CFG=/etc/dnsmasq.conf
DHCPCD_CFG=/etc/dhcpcd.conf
WPA_CFG=/etc/wpa_supplicant/wpa_supplicant.conf
function query_config() {
if [ -e $WLAN0_CFG ]; then
SSID=$(grep wpa-ssid $WLAN0_CFG |
sed 's/^[[:space:]]*wpa-ssid "\([^"]*\)"/\1/')
echo "{\"ssid\": \"$SSID\", \"mode\": \"client\"}"
else
if [ -e $HOSTAPD_CFG -a -e /etc/default/hostapd ]; then
SSID=$(grep ^ssid= $HOSTAPD_CFG | sed 's/^ssid=\(.*\)$/\1/')
CHANNEL=$(grep ^channel= $HOSTAPD_CFG |
sed 's/^channel=\(.*\)$/\1/')
echo -n "{\"ssid\": \"$SSID\", "
echo "\"channel\": $CHANNEL, \"mode\": \"ap\"}"
else
echo "{\"mode\": \"disabled\"}"
fi
fi
}
function disable_wifi() {
rm -f $WLAN0_CFG $HOSTAPD_CFG /etc/default/hostapd
}
function configure_wlan0() {
echo "auto wlan0"
echo "allow-hotplug wlan0"
echo "iface wlan0 inet dhcp"
echo " wpa-scan-ssid 1"
echo " wpa-ap-scan 1"
echo " wpa-key-mgmt WPA-PSK"
echo " wpa-proto RSN WPA"
echo " wpa-pairwise CCMP TKIP"
echo " wpa-group CCMP TKIP"
echo " wpa-ssid \"$SSID\""
if [ ${#PASS} -ne 0 ]; then
echo " wpa-psk \"$PASS\""
fi
}
function configure_wpa() {
echo "country=US"
echo "ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev"
echo "update_config=1"
if [ ${#PASS} -eq 0 ]; then
echo "network={"
echo " ssid=\"$SSID\""
echo " key_mgmt=NONE"
echo "}"
fi
}
function configure_dhcpcd() {
echo "hostname"
echo "clientid"
echo "persistent"
echo "option rapid_commit"
echo "option domain_name_servers, domain_name, domain_search, host_name"
echo "option classless_static_routes"
echo "option ntp_servers"
echo "option interface_mtu"
echo "require dhcp_server_identifier"
echo "slaac private"
if $AP; then
echo
echo "interface wlan0"
echo " static ip_address=192.168.43.1/24"
fi
}
function configure_wifi() {
disable_wifi
echo "source-directory /etc/network/interfaces.d" > /etc/network/interfaces
configure_wlan0 > $WLAN0_CFG
configure_wpa > $WPA_CFG
configure_dhcpcd > $DHCPCD_CFG
}
function configure_dnsmasq() {
echo "interface=wlan0"
echo "domain-needed"
echo "bogus-priv"
echo "dhcp-range=192.168.43.2,192.168.43.20,255.255.255.0,12h"
}
function configure_hostapd() {
echo "interface=wlan0"
echo "driver=nl80211"
echo "ssid=$SSID"
echo "hw_mode=g"
echo "channel=$CHANNEL"
echo "wmm_enabled=0"
echo "macaddr_acl=0"
echo "auth_algs=1"
echo "ignore_broadcast_ssid=0"
echo "wpa=2"
echo "wpa_passphrase=$PASS"
echo "wpa_key_mgmt=WPA-PSK"
echo "wpa_pairwise=TKIP"
echo "rsn_pairwise=CCMP"
}
function is_installed() {
dpkg-query -W --showformat='${Status}' $1 |
grep "install ok installed" >/dev/null
if [ $? -eq 0 ]; then echo true; else echo false; fi
}
function configure_ap() {
disable_wifi
# Install packages
(
$(is_installed dnsmasq) &&
$(is_installed hostapd) &&
$(is_installed iptables-persistent)
) || (
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -yq dnsmasq hostapd iptables-persistent
)
configure_dhcpcd > $DHCPCD_CFG
configure_dnsmasq > $DNSMASQ_CFG
configure_hostapd > $HOSTAPD_CFG
echo "DAEMON_CONF=\"/etc/hostapd/hostapd.conf\"" > /etc/default/hostapd
# Enable IP forwarding
sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf
echo 1 > /proc/sys/net/ipv4/ip_forward
# Enable IP masquerading
iptables -t nat -F
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables-save > /etc/iptables/rules.v4
}
function usage() {
echo "Usage: config-wifi [OPTIONS]"
echo
echo "Configure wifi as either a client or access point."
echo
echo "OPTIONS:"
echo
echo " -a Configure access point."
echo " -d Disable wifi."
echo " -r Reboot when done."
echo " -s <SSID> Set SSID."
echo " -p <PASS> Set password."
echo " -c <CHANNEL> Set wifi channel."
echo " -j Report wifi config as JSON data."
echo
}
# Parse args
while [ $# -ne 0 ]; do
case "$1" in
-a) AP=true ;;
-d) DISABLE=true ;;
-r) REBOOT=true; ;;
-s) SSID="$2"; shift ;;
-p) PASS="$2"; shift ;;
-c) CHANNEL="$2"; shift ;;
-j) query_config; exit 0 ;;
-h)
usage
exit 0
;;
*)
usage
echo "Unknown argument '$1'"
exit 1
esac
shift
done
if $DISABLE; then
disable_wifi
else
# Check args
function clean_str() {
echo "$1" | tr -d '\n\r"'
}
SSID=$(clean_str "$SSID")
PASS=$(clean_str "$PASS")
LANG=C LC_ALL=C # For correct string byte length
if [ ${#SSID} -eq 0 -o 32 -lt ${#SSID} ]; then
echo "Invalid or missing SSID '$SSID'"
exit 1
fi
if [ ${#PASS} -ne 0 ]; then
if [ ${#PASS} -lt 8 -o 128 -lt ${#PASS} ]; then
echo "Invalid passsword"
exit 1
fi
fi
echo "$CHANNEL" | grep '^[0-9]\{1,2\}' > /dev/null
if [ $? -ne 0 ]; then
echo "Invalid channel '$CHANNEL'"
exit 1
fi
# Execute
if $AP; then
echo "Configuring Wifi access point"
configure_ap
else
echo "Configuring Wifi"
configure_wifi
fi
fi
if $REBOOT; then nohup reboot & fi

View File

@@ -1,3 +1,3 @@
#!/bin/bash -ex
pip3 download -d python-packages -r requirements.txt
pip3 download -d installer/python-packages -r requirements.txt

View File

@@ -12,39 +12,41 @@ while [ $# -gt 0 ]; do
shift 1
done
if $UPDATE_PY; then
systemctl stop bbctrl
# Update service
rm -f /etc/init.d/bbctrl
cp scripts/bbctrl.service /etc/systemd/system/
cp ./installer/config/bbctrl.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable bbctrl
fi
if $UPDATE_AVR; then
chmod +x ./scripts/avr109-flash.py
./scripts/avr109-flash.py src/avr/bbctrl-avr-firmware.hex
chmod +x ./installer/scripts/avr109-flash.py
./installer/scripts/avr109-flash.py src/avr/bbctrl-avr-firmware.hex
fi
# Update config.txt
./scripts/edit-boot-config max_usb_current=1 config_hdmi_boost=8 hdmi_force_hotplug=1 hdmi_group=2 hdmi_mode=82
./installer/scripts/edit-boot-config \
disable_overscan=1 \
framebuffer_width=1280 \
framebuffer_height=720 \
nohz=on \
dtparam=sd_overclock=100 \
max_usb_current=1 \
config_hdmi_boost=8 \
disable_splash=1 \
hdmi_force_hotplug=1 \
hdmi_group=2 \
hdmi_mode=82
# TODO Enable GPU
#./scripts/edit-boot-config dtoverlay=vc4-kms-v3d
#./scripts/edit-boot-config gpu_mem=16
#./installer/scripts/edit-boot-config \
# dtoverlay=vc4-kms-v3d \
# gpu_mem=16
#chmod ug+s /usr/lib/xorg/Xorg
# Use the full screen resolution
# grep "^framebuffer_width=1280$" /boot/config.txt >/dev/null
# if [ $? -eq 0 ]; then
# mount -o remount,rw /boot &&
# sed -i 's/^\(framebuffer_.*\)$/#\1/g' /boot/config.txt
# mount -o remount,ro /boot
# REBOOT=true
# fi
# Fix camera
grep dwc_otg.fiq_fsm_mask /boot/cmdline.txt >/dev/null
if [ $? -ne 0 ]; then
@@ -73,14 +75,20 @@ sed -i 's/^TimeoutStartSec=.*$/TimeoutStartSec=1/' \
/etc/systemd/system/network-online.target.wants/networking.service
# Change to US keyboard layout
sed -i 's/^XKBLAYOUT="gb"$/XKBLAYOUT="us" # Comment stops change on upgrade/' \
/etc/default/keyboard
sed -i 's/^XKBLAYOUT="gb"$/XKBLAYOUT="us" # Comment stops change on upgrade/' /etc/default/keyboard
# Set the default locale to en_US
grep '^en_US.UTF-8 UTF-8' /etc/locale.gen >/dev/null
if [ $? -ne 0 ]; then
perl -pi -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen
locale-gen en_US.UTF-8
update-locale en_US.UTF-8
fi
# Setup USB stick automount
diff ./scripts/11-automount.rules /etc/udev/rules.d/11-automount.rules \
>/dev/null
diff ./installer/config/11-automount.rules /etc/udev/rules.d/11-automount.rules >/dev/null
if [ $? -ne 0 ]; then
cp ./scripts/11-automount.rules /etc/udev/rules.d/
cp ./installer/config/11-automount.rules /etc/udev/rules.d/
sed -i 's/^\(MountFlags=slave\)/#\1/' \
/lib/systemd/system/systemd-udevd.service
REBOOT=true
@@ -93,28 +101,31 @@ if [ $? -ne 0 ]; then
REBOOT=true
fi
# Set the default locale to en_US
grep '^en_US.UTF-8 UTF-8' /etc/locale.gen >/dev/null
if [ $? -ne 0 ]; then
perl -pi -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen
locale-gen en_US.UTF-8
update-locale en_US.UTF-8
fi
# Install .Xresources & .xinitrc
cp scripts/Xresources ~pi/.Xresources
cp ./installer/config/Xresources ~pi/.Xresources
chown pi:pi ~pi/.Xresources
cp scripts/xinitrc ~pi/.xinitrc
cp ./installer/config/xinitrc ~pi/.xinitrc
chmod +x ~pi/.xinitrc
chown pi:pi ~pi/.xinitrc
#Configure the "ratpoison" window manager
# Configure the "ratpoison" window manager
if [ ! -e ~pi/.ratpoisonrc ]; then
cp scripts/ratpoisonrc ~pi/.ratpoisonrc
cp ./installer/config/ratpoisonrc ~pi/.ratpoisonrc
chmod 644 ~pi/.ratpoisonrc
chown pi:pi ~pi/.ratpoisonrc
fi
# Configure the Plymouth graphical bootloader with the Onefinity theme
if [ ! -e /usr/share/plymouth/themes/onefinity/onefinity.plymouth ]; then
mkdir -p /usr/share/plymouth/themes/onefinity/
cp -av installer/splash/* /usr/share/plymouth/themes/onefinity/
plymouth-set-default-theme -R onefinity
fi
grep 'quiet splash plymouth.ignore-serial-consoles logo.nologo' /boot/cmdline.txt >/dev/null
if [ $? -ne 0 ]; then
echo -n " quiet splash plymouth.ignore-serial-consoles logo.nologo" >> /boot/cmdline.txt
fi
# Install bbserial
MODSRC=src/bbserial/bbserial.ko
MODDST=/lib/modules/$(uname -r)/kernel/drivers/tty/serial/bbserial.ko
@@ -126,7 +137,7 @@ if [ $? -ne 0 ]; then
fi
# Install rc.local
cp scripts/rc.local /etc/
cp ./installer/config/rc.local /etc/
# Install bbctrl
if $UPDATE_PY; then
@@ -135,7 +146,7 @@ if $UPDATE_PY; then
rm -rf /usr/local/lib/python*/dist-packages/bbctrl-*
# Ensure python dependencies are installed
pip3 install --no-index --find-links python-packages -r requirements.txt
pip3 install --no-index --find-links installer/python-packages -r requirements.txt
./setup.py install --force
@@ -146,26 +157,26 @@ if $UPDATE_PY; then
fi
# Expand the file system if necessary
chmod +x ./scripts/resize_root_fs.sh
./scripts/resize_root_fs.sh
chmod +x ./installer/scripts/resize_root_fs.sh
./installer/scripts/resize_root_fs.sh
if [ $? -eq 0 ]; then
REBOOT=true
fi
# Install our logrotate config
cp ./scripts/bbctrl-logrotate /etc/logrotate.d/bbctrl
cp ./installer/config/bbctrl-logrotate /etc/logrotate.d/bbctrl
chown root:root /etc/logrotate.d/bbctrl
# Ensure logrotate runs on every boot (for systems with no network, thus bad clock)
if [ ! -e /etc/cron.d/reboot ]; then
cp ./scripts/cron_d_reboot /etc/cron.d/reboot
cp ./installer/config/cron_d_reboot /etc/cron.d/reboot
mkdir -p /etc/cron.reboot
cp ./scripts/cron_reboot_logrotate /etc/cron.reboot/logrotate
cp ./installer/config/cron_reboot_logrotate /etc/cron.reboot/logrotate
fi
# Delete some cookies that were left behind in older images
chmod +x ./scripts/delete-cookies.py
./scripts/delete-cookies.py
chmod +x ./installer/scripts/delete-cookies.py
./installer/scripts/delete-cookies.py
pkill -HUP chromium # Force Chromium to restart, to see the cookie changes
# Get rid of some old files that were left behind in older images

View File

@@ -29,13 +29,13 @@ setup(
]
},
scripts=[
'scripts/update-bbctrl',
'scripts/upgrade-bbctrl',
'scripts/sethostname',
'scripts/config-wifi',
'scripts/edit-config',
'scripts/edit-boot-config',
'scripts/browser',
'installer/scripts/update-bbctrl',
'installer/scripts/upgrade-bbctrl',
'installer/scripts/sethostname',
'installer/scripts/config-wifi',
'installer/scripts/edit-config',
'installer/scripts/edit-boot-config',
'installer/scripts/browser',
],
install_requires=[
'tornado',

View File

@@ -21,11 +21,17 @@ def call_get_output(cmd):
class RebootHandler(bbctrl.APIHandler):
def put_ok(self):
subprocess.Popen('reboot')
subprocess.Popen(['plymouth', 'show-splash'])
subprocess.Popen(['plymouth', 'change-mode', '--shutdown'])
subprocess.Popen(['killall', 'xinit'])
subprocess.Popen(['reboot'])
class ShutdownHandler(bbctrl.APIHandler):
def put_ok(self):
subprocess.Popen(['plymouth', 'show-splash'])
subprocess.Popen(['plymouth', 'change-mode', '--shutdown'])
subprocess.Popen(['killall', 'xinit'])
subprocess.Popen(['shutdown', '-h', 'now'])

View File

@@ -1,8 +0,0 @@
[Plymouth Theme]
Name=buildbotics
Description=Buildbotics boot splash
ModuleName=script
[script]
ImageDir=/usr/share/plymouth/themes/buildbotics
ScriptFile=/usr/share/plymouth/themes/buildbotics/buildbotics.script

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB