Skip to content

Commit

Permalink
Replace and rename raspi -> brain
Browse files Browse the repository at this point in the history
  • Loading branch information
puhitaku committed Aug 7, 2022
1 parent 5e5f25b commit 98f5045
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 976 deletions.
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
raspi-config is licensed under the terms of the MIT license reproduced below.
brain-config is licensed under the terms of the MIT license reproduced below.

#####################################################

Copyright (c) 2022 Brain Hackers
Copyright (c) 2012 Alex Bradbury <[email protected]>

Permission is hereby granted, free of charge, to any person
Expand Down
55 changes: 20 additions & 35 deletions raspi-config → brain-config
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,13 @@

INTERACTIVE=True
ASK_TO_REBOOT=0
BLACKLIST=/etc/modprobe.d/raspi-blacklist.conf
BLACKLIST=/etc/modprobe.d/brain-blacklist.conf
CONFIG=/boot/config.txt
# TODO: erase these envs

USER=${SUDO_USER:-$(who -m | awk '{ print $1 }')}

is_pi () {
ARCH=$(dpkg --print-architecture)
if [ "$ARCH" = "armhf" ] || [ "$ARCH" = "arm64" ] ; then
return 0
else
return 1
fi
}

if is_pi ; then
CMDLINE=/boot/cmdline.txt
else
CMDLINE=/proc/cmdline
fi
CMDLINE=/boot/cmdline.txt

calc_wt_size() {
# NOTE: it's tempting to redirect stderr to /dev/null, so supress error
Expand All @@ -50,7 +37,7 @@ configuration of the SHARP Brain. Although it can be run
at any time, some of the options may have difficulties if
you have heavily customised your installation.
$(dpkg -s raspi-config 2> /dev/null | grep Version)\
$(dpkg -s brain-config 2> /dev/null | grep Version)\
" 20 70 1
return 0
}
Expand Down Expand Up @@ -227,11 +214,9 @@ do_wifi_country() {
fi
if hash rfkill 2> /dev/null; then
rfkill unblock wifi
if is_pi ; then
for filename in /var/lib/systemd/rfkill/*:wlan ; do
echo 0 > $filename
done
fi
for filename in /var/lib/systemd/rfkill/*:wlan ; do
echo 0 > $filename
done
fi
if [ "$INTERACTIVE" = True ]; then
whiptail --msgbox "Wireless LAN country set to $COUNTRY" 20 60 1
Expand Down Expand Up @@ -310,11 +295,11 @@ do_ssh() {
fi
}

disable_raspi_config_at_boot() {
if [ -e /etc/profile.d/raspi-config.sh ]; then
rm -f /etc/profile.d/raspi-config.sh
if [ -e /etc/systemd/system/[email protected]/raspi-config-override.conf ]; then
rm /etc/systemd/system/[email protected]/raspi-config-override.conf
disable_brain_config_at_boot() {
if [ -e /etc/profile.d/brain-config.sh ]; then
rm -f /etc/profile.d/brain-config.sh
if [ -e /etc/systemd/system/[email protected]/brain-config-override.conf ]; then
rm /etc/systemd/system/[email protected]/brain-config-override.conf
fi
telinit q
fi
Expand Down Expand Up @@ -468,7 +453,7 @@ do_wifi_ssid_passphrase() {
}

do_finish() {
disable_raspi_config_at_boot
disable_brain_config_at_boot
if [ $ASK_TO_REBOOT -eq 1 ]; then
whiptail --yesno "Would you like to reboot now?" 20 60 2
if [ $? -eq 0 ]; then # yes
Expand Down Expand Up @@ -527,12 +512,12 @@ done

# Everything else needs to be run as root
if [ $(id -u) -ne 0 ]; then
printf "Script must be run as root. Try 'sudo raspi-config'\n"
printf "Script must be run as root. Try 'sudo brain-config'\n"
exit 1
fi

do_system_menu() {
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
FUN=$(whiptail --title "SHARP Brain Software Configuration Tool (brain-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
"S1 Wireless LAN" "Enter SSID and passphrase" \
"S3 Password" "Change password for the '$USER' user" \
"S4 Hostname" "Set name for this computer on a network" \
Expand All @@ -551,7 +536,7 @@ do_system_menu() {
}

do_interface_menu() {
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
FUN=$(whiptail --title "SHARP Brain Software Configuration Tool (brain-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
"I2 SSH" "Enable/disable remote command line access using SSH" \
3>&1 1>&2 2>&3)
RET=$?
Expand All @@ -566,7 +551,7 @@ do_interface_menu() {
}

do_internationalisation_menu() {
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Localisation Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
FUN=$(whiptail --title "SHARP Brain Software Configuration Tool (brain-config)" --menu "Localisation Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
"L1 Locale" "Configure language and regional settings" \
"L2 Timezone" "Configure time zone" \
"L4 WLAN Country" "Set legal wireless channels for your country" \
Expand All @@ -585,7 +570,7 @@ do_internationalisation_menu() {
}

do_advanced_menu() {
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Advanced Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
FUN=$(whiptail --title "SHARP Brain Software Configuration Tool (brain-config)" --menu "Advanced Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
"A1 Expand Filesystem" "Ensures that all of the SD card is available" \
"A4 Network Interface Names" "Enable/disable predictable network i/f names" \
3>&1 1>&2 2>&3)
Expand All @@ -608,16 +593,16 @@ if [ "$INTERACTIVE" = True ]; then
[ -e $CONFIG ] || touch $CONFIG
calc_wt_size
while [ "$USER" = "root" ] || [ -z "$USER" ]; do
if ! USER=$(whiptail --inputbox "raspi-config could not determine the default user.\\n\\nWhat user should these settings apply to?" 20 60 pi 3>&1 1>&2 2>&3); then
if ! USER=$(whiptail --inputbox "brain-config could not determine the default user.\\n\\nWhat user should these settings apply to?" 20 60 pi 3>&1 1>&2 2>&3); then
return 0
fi
done
while true; do
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \
FUN=$(whiptail --title "SHARP Brain Software Configuration Tool (brain-config)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \
"1 System Options" "Configure system settings" \
"5 Localisation Options" "Configure language and regional settings" \
"6 Advanced Options" "Configure advanced settings" \
"9 About raspi-config" "Information about this configuration tool" \
"9 About brain-config" "Information about this configuration tool" \
3>&1 1>&2 2>&3)
RET=$?
if [ $RET -eq 1 ]; then
Expand Down
2 changes: 1 addition & 1 deletion debian/raspi-config.init → debian/brain-config.init
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: raspi-config
# Provides: brain-config
# Required-Start: udev mountkernfs $remote_fs
# Required-Stop:
# Default-Start: S 2 3 4 5
Expand Down
2 changes: 2 additions & 0 deletions debian/brain-config.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
brain-config /usr/bin
usr/
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if [ -e /etc/init.d/switch_cpu_governor ]; then
fi

if dpkg --compare-versions "${2}" lt-nl "20170619"; then
update-rc.d -f raspi-config remove
update-rc.d -f brain-config remove
fi

#DEBHELPER#
File renamed without changes.
2 changes: 1 addition & 1 deletion debian/raspi-config.prerm → debian/brain-config.prerm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /bin/sh
# prerm script for raspi-config
# prerm script for brain-config
#
# see: dh_installdeb(1)

Expand Down
Loading

0 comments on commit 98f5045

Please sign in to comment.