mirror of
https://github.com/brain-hackers/brain-config.git
synced 2024-12-22 12:10:07 +09:00
Add rc_gui support
This commit is contained in:
parent
668a8882bb
commit
3f2491246d
47
autologin@.service
Normal file
47
autologin@.service
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# This file is part of systemd.
|
||||||
|
#
|
||||||
|
# systemd is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU Lesser General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Getty on %I
|
||||||
|
Documentation=man:agetty(8) man:systemd-getty-generator(8)
|
||||||
|
Documentation=http://0pointer.de/blog/projects/serial-console.html
|
||||||
|
After=systemd-user-sessions.service plymouth-quit-wait.service
|
||||||
|
After=rc-local.service
|
||||||
|
|
||||||
|
# If additional gettys are spawned during boot then we should make
|
||||||
|
# sure that this is synchronized before getty.target, even though
|
||||||
|
# getty.target didn't actually pull it in.
|
||||||
|
Before=getty.target
|
||||||
|
IgnoreOnIsolate=yes
|
||||||
|
|
||||||
|
# On systems without virtual consoles, don't start any getty. Note
|
||||||
|
# that serial gettys are covered by serial-getty@.service, not this
|
||||||
|
# unit.
|
||||||
|
ConditionPathExists=/dev/tty0
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
# the VT is cleared by TTYVTDisallocate
|
||||||
|
ExecStart=-/sbin/agetty --autologin pi --noclear %I $TERM
|
||||||
|
Type=idle
|
||||||
|
Restart=always
|
||||||
|
RestartSec=0
|
||||||
|
UtmpIdentifier=%I
|
||||||
|
TTYPath=/dev/%I
|
||||||
|
TTYReset=yes
|
||||||
|
TTYVHangup=yes
|
||||||
|
TTYVTDisallocate=yes
|
||||||
|
KillMode=process
|
||||||
|
IgnoreSIGPIPE=no
|
||||||
|
SendSIGHUP=yes
|
||||||
|
|
||||||
|
# Unset locale for the console getty since the console has problems
|
||||||
|
# displaying some internationalized messages.
|
||||||
|
Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=getty.target
|
||||||
|
DefaultInstance=tty1
|
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -1,3 +1,9 @@
|
|||||||
|
raspi-config (20150915) jessie; urgency=medium
|
||||||
|
|
||||||
|
* Add support for rc_gui from spl
|
||||||
|
|
||||||
|
-- Serge Schneider <serge@raspberrypi.org> Tue, 15 Sep 2015 10:23:52 +0100
|
||||||
|
|
||||||
raspi-config (20150706) jessie; urgency=low
|
raspi-config (20150706) jessie; urgency=low
|
||||||
|
|
||||||
* Include io_is_busy in cpufreq settings
|
* Include io_is_busy in cpufreq settings
|
||||||
|
3
debian/raspi-config.install
vendored
3
debian/raspi-config.install
vendored
@ -1 +1,2 @@
|
|||||||
./raspi-config /usr/bin/
|
raspi-config /usr/bin
|
||||||
|
autologin@.service /etc/systemd/system
|
||||||
|
180
raspi-config
180
raspi-config
@ -45,6 +45,7 @@ you have heavily customised your installation.\
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_expand_rootfs() {
|
do_expand_rootfs() {
|
||||||
|
get_init_sys
|
||||||
if [ $SYSTEMD -eq 1 ]; then
|
if [ $SYSTEMD -eq 1 ]; then
|
||||||
ROOT_PART=$(mount | sed -n 's|^/dev/\(.*\) on / .*|\1|p')
|
ROOT_PART=$(mount | sed -n 's|^/dev/\(.*\) on / .*|\1|p')
|
||||||
else
|
else
|
||||||
@ -184,9 +185,13 @@ set_overscan() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_overscan() {
|
do_overscan() {
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --yesno "What would you like to do with overscan" 20 60 2 \
|
whiptail --yesno "What would you like to do with overscan" 20 60 2 \
|
||||||
--yes-button Disable --no-button Enable
|
--yes-button Disable --no-button Enable
|
||||||
RET=$?
|
RET=$?
|
||||||
|
else
|
||||||
|
RET=$1
|
||||||
|
fi
|
||||||
if [ $RET -eq 0 ] || [ $RET -eq 1 ]; then
|
if [ $RET -eq 0 ] || [ $RET -eq 1 ]; then
|
||||||
ASK_TO_REBOOT=1
|
ASK_TO_REBOOT=1
|
||||||
set_overscan $RET;
|
set_overscan $RET;
|
||||||
@ -218,6 +223,7 @@ do_change_timezone() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_change_hostname() {
|
do_change_hostname() {
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --msgbox "\
|
whiptail --msgbox "\
|
||||||
Please note: RFCs mandate that a hostname's labels \
|
Please note: RFCs mandate that a hostname's labels \
|
||||||
may contain only the ASCII letters 'a' through 'z' (case-insensitive),
|
may contain only the ASCII letters 'a' through 'z' (case-insensitive),
|
||||||
@ -225,9 +231,14 @@ the digits '0' through '9', and the hyphen.
|
|||||||
Hostname labels cannot begin or end with a hyphen.
|
Hostname labels cannot begin or end with a hyphen.
|
||||||
No other symbols, punctuation characters, or blank spaces are permitted.\
|
No other symbols, punctuation characters, or blank spaces are permitted.\
|
||||||
" 20 70 1
|
" 20 70 1
|
||||||
|
fi
|
||||||
CURRENT_HOSTNAME=`cat /etc/hostname | tr -d " \t\n\r"`
|
CURRENT_HOSTNAME=`cat /etc/hostname | tr -d " \t\n\r"`
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
NEW_HOSTNAME=$(whiptail --inputbox "Please enter a hostname" 20 60 "$CURRENT_HOSTNAME" 3>&1 1>&2 2>&3)
|
NEW_HOSTNAME=$(whiptail --inputbox "Please enter a hostname" 20 60 "$CURRENT_HOSTNAME" 3>&1 1>&2 2>&3)
|
||||||
|
else
|
||||||
|
NEW_HOSTNAME=$1
|
||||||
|
true
|
||||||
|
fi
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo $NEW_HOSTNAME > /etc/hostname
|
echo $NEW_HOSTNAME > /etc/hostname
|
||||||
sed -i "s/127.0.1.1.*$CURRENT_HOSTNAME/127.0.1.1\t$NEW_HOSTNAME/g" /etc/hosts
|
sed -i "s/127.0.1.1.*$CURRENT_HOSTNAME/127.0.1.1\t$NEW_HOSTNAME/g" /etc/hosts
|
||||||
@ -245,8 +256,13 @@ do_memory_split() { # Memory Split
|
|||||||
CUR_GPU_MEM=$(get_config_var gpu_mem $CONFIG)
|
CUR_GPU_MEM=$(get_config_var gpu_mem $CONFIG)
|
||||||
[ -z "$CUR_GPU_MEM" ] && CUR_GPU_MEM=64
|
[ -z "$CUR_GPU_MEM" ] && CUR_GPU_MEM=64
|
||||||
## ask users what gpu_mem they want
|
## ask users what gpu_mem they want
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
NEW_GPU_MEM=$(whiptail --inputbox "How much memory should the GPU have? e.g. 16/32/64/128/256" \
|
NEW_GPU_MEM=$(whiptail --inputbox "How much memory should the GPU have? e.g. 16/32/64/128/256" \
|
||||||
20 70 -- "$CUR_GPU_MEM" 3>&1 1>&2 2>&3)
|
20 70 -- "$CUR_GPU_MEM" 3>&1 1>&2 2>&3)
|
||||||
|
else
|
||||||
|
NEW_GPU_MEM=$1
|
||||||
|
true
|
||||||
|
fi
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
set_config_var gpu_mem "$NEW_GPU_MEM" $CONFIG
|
set_config_var gpu_mem "$NEW_GPU_MEM" $CONFIG
|
||||||
ASK_TO_REBOOT=1
|
ASK_TO_REBOOT=1
|
||||||
@ -288,6 +304,7 @@ set_memory_split() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_overclock() {
|
do_overclock() {
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --msgbox "\
|
whiptail --msgbox "\
|
||||||
Be aware that overclocking may reduce the lifetime of your
|
Be aware that overclocking may reduce the lifetime of your
|
||||||
Raspberry Pi. If overclocking at a certain level causes
|
Raspberry Pi. If overclocking at a certain level causes
|
||||||
@ -303,6 +320,10 @@ See http://elinux.org/RPi_Overclocking for more information.\
|
|||||||
"Turbo" "1000MHz ARM, 500MHz core, 600MHz SDRAM, 6 overvolt" \
|
"Turbo" "1000MHz ARM, 500MHz core, 600MHz SDRAM, 6 overvolt" \
|
||||||
"Pi2" "1000MHz ARM, 500MHz core, 500MHz SDRAM, 2 overvolt" \
|
"Pi2" "1000MHz ARM, 500MHz core, 500MHz SDRAM, 2 overvolt" \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
|
else
|
||||||
|
OVERCLOCK=$1
|
||||||
|
true
|
||||||
|
fi
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
case "$OVERCLOCK" in
|
case "$OVERCLOCK" in
|
||||||
None)
|
None)
|
||||||
@ -323,6 +344,9 @@ See http://elinux.org/RPi_Overclocking for more information.\
|
|||||||
Pi2)
|
Pi2)
|
||||||
set_overclock Pi2 1000 500 500 2
|
set_overclock Pi2 1000 500 500 2
|
||||||
;;
|
;;
|
||||||
|
Pi2None)
|
||||||
|
set_overclock Medium 900 250 450 0
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
whiptail --msgbox "Programmer error, unrecognised overclock preset" 20 60 2
|
whiptail --msgbox "Programmer error, unrecognised overclock preset" 20 60 2
|
||||||
return 1
|
return 1
|
||||||
@ -337,7 +361,9 @@ set_overclock() {
|
|||||||
set_config_var core_freq $3 $CONFIG &&
|
set_config_var core_freq $3 $CONFIG &&
|
||||||
set_config_var sdram_freq $4 $CONFIG &&
|
set_config_var sdram_freq $4 $CONFIG &&
|
||||||
set_config_var over_voltage $5 $CONFIG &&
|
set_config_var over_voltage $5 $CONFIG &&
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --msgbox "Set overclock to preset '$1'" 20 60 2
|
whiptail --msgbox "Set overclock to preset '$1'" 20 60 2
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
do_ssh() {
|
do_ssh() {
|
||||||
@ -345,16 +371,24 @@ do_ssh() {
|
|||||||
whiptail --msgbox "Initial ssh key generation still running. Please wait and try again." 20 60 2
|
whiptail --msgbox "Initial ssh key generation still running. Please wait and try again." 20 60 2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --yesno "Would you like the SSH server enabled or disabled?" 20 60 2 \
|
whiptail --yesno "Would you like the SSH server enabled or disabled?" 20 60 2 \
|
||||||
--yes-button Enable --no-button Disable
|
--yes-button Enable --no-button Disable
|
||||||
RET=$?
|
RET=$?
|
||||||
|
else
|
||||||
|
RET=$1
|
||||||
|
fi
|
||||||
if [ $RET -eq 0 ]; then
|
if [ $RET -eq 0 ]; then
|
||||||
update-rc.d ssh enable &&
|
update-rc.d ssh enable &&
|
||||||
invoke-rc.d ssh start &&
|
invoke-rc.d ssh start &&
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --msgbox "SSH server enabled" 20 60 1
|
whiptail --msgbox "SSH server enabled" 20 60 1
|
||||||
|
fi
|
||||||
elif [ $RET -eq 1 ]; then
|
elif [ $RET -eq 1 ]; then
|
||||||
update-rc.d ssh disable &&
|
update-rc.d ssh disable &&
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --msgbox "SSH server disabled" 20 60 1
|
whiptail --msgbox "SSH server disabled" 20 60 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
return $RET
|
return $RET
|
||||||
fi
|
fi
|
||||||
@ -367,9 +401,12 @@ do_devicetree() {
|
|||||||
CURRENT_SETTING="disabled"
|
CURRENT_SETTING="disabled"
|
||||||
DEFAULT=--defaultno
|
DEFAULT=--defaultno
|
||||||
fi
|
fi
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --yesno "Would you like the kernel to use Device Tree?" $DEFAULT 20 60 2
|
whiptail --yesno "Would you like the kernel to use Device Tree?" $DEFAULT 20 60 2
|
||||||
RET=$?
|
RET=$?
|
||||||
|
else
|
||||||
|
RET=$1
|
||||||
|
fi
|
||||||
if [ $RET -eq 0 ]; then
|
if [ $RET -eq 0 ]; then
|
||||||
sed $CONFIG -i -e "s/^\(device_tree=\)$/#\1/"
|
sed $CONFIG -i -e "s/^\(device_tree=\)$/#\1/"
|
||||||
sed $CONFIG -i -e "s/^#\(device_tree=.\)/\1/"
|
sed $CONFIG -i -e "s/^#\(device_tree=.\)/\1/"
|
||||||
@ -409,8 +446,12 @@ do_spi() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $DEVICE_TREE = "yes" ]; then
|
if [ $DEVICE_TREE = "yes" ]; then
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --yesno "Would you like the SPI interface to be enabled?" $DEFAULT 20 60 2
|
whiptail --yesno "Would you like the SPI interface to be enabled?" $DEFAULT 20 60 2
|
||||||
RET=$?
|
RET=$?
|
||||||
|
else
|
||||||
|
RET=$1
|
||||||
|
fi
|
||||||
if [ $RET -eq 0 ]; then
|
if [ $RET -eq 0 ]; then
|
||||||
SETTING=on
|
SETTING=on
|
||||||
STATUS=enabled
|
STATUS=enabled
|
||||||
@ -431,7 +472,9 @@ do_spi() {
|
|||||||
if ! grep -q -E "^(device_tree_param|dtparam)=([^,]*,)*spi=[^,]*" $CONFIG; then
|
if ! grep -q -E "^(device_tree_param|dtparam)=([^,]*,)*spi=[^,]*" $CONFIG; then
|
||||||
printf "dtparam=spi=$SETTING\n" >> $CONFIG
|
printf "dtparam=spi=$SETTING\n" >> $CONFIG
|
||||||
fi
|
fi
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --msgbox "The SPI interface $TENSE $STATUS$REBOOT" 20 60 1
|
whiptail --msgbox "The SPI interface $TENSE $STATUS$REBOOT" 20 60 1
|
||||||
|
fi
|
||||||
if [ $SETTING = "off" ]; then
|
if [ $SETTING = "off" ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@ -448,18 +491,26 @@ do_spi() {
|
|||||||
touch $BLACKLIST
|
touch $BLACKLIST
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --yesno "Would you like the SPI kernel module to be loaded by default?" $DEFAULT 20 60 2
|
whiptail --yesno "Would you like the SPI kernel module to be loaded by default?" $DEFAULT 20 60 2
|
||||||
RET=$?
|
RET=$?
|
||||||
|
else
|
||||||
|
RET=$1
|
||||||
|
fi
|
||||||
if [ $RET -eq 0 ]; then
|
if [ $RET -eq 0 ]; then
|
||||||
sed $BLACKLIST -i -e "s/^\(blacklist[[:space:]]*spi[-_]bcm2708\)/#\1/"
|
sed $BLACKLIST -i -e "s/^\(blacklist[[:space:]]*spi[-_]bcm2708\)/#\1/"
|
||||||
modprobe spi-bcm2708
|
modprobe spi-bcm2708
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --msgbox "SPI kernel module will now be loaded by default" 20 60 1
|
whiptail --msgbox "SPI kernel module will now be loaded by default" 20 60 1
|
||||||
|
fi
|
||||||
elif [ $RET -eq 1 ]; then
|
elif [ $RET -eq 1 ]; then
|
||||||
sed $BLACKLIST -i -e "s/^#\(blacklist[[:space:]]*spi[-_]bcm2708\)/\1/"
|
sed $BLACKLIST -i -e "s/^#\(blacklist[[:space:]]*spi[-_]bcm2708\)/\1/"
|
||||||
if ! grep -q "^blacklist spi[-_]bcm2708" $BLACKLIST; then
|
if ! grep -q "^blacklist spi[-_]bcm2708" $BLACKLIST; then
|
||||||
printf "blacklist spi-bcm2708\n" >> $BLACKLIST
|
printf "blacklist spi-bcm2708\n" >> $BLACKLIST
|
||||||
fi
|
fi
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --msgbox "SPI kernel module will no longer be loaded by default" 20 60 1
|
whiptail --msgbox "SPI kernel module will no longer be loaded by default" 20 60 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@ -480,8 +531,12 @@ do_i2c() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $DEVICE_TREE = "yes" ]; then
|
if [ $DEVICE_TREE = "yes" ]; then
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --yesno "Would you like the ARM I2C interface to be enabled?" $DEFAULT 20 60 2
|
whiptail --yesno "Would you like the ARM I2C interface to be enabled?" $DEFAULT 20 60 2
|
||||||
RET=$?
|
RET=$?
|
||||||
|
else
|
||||||
|
RET=$1
|
||||||
|
fi
|
||||||
if [ $RET -eq 0 ]; then
|
if [ $RET -eq 0 ]; then
|
||||||
SETTING=on
|
SETTING=on
|
||||||
STATUS=enabled
|
STATUS=enabled
|
||||||
@ -502,7 +557,9 @@ do_i2c() {
|
|||||||
if ! grep -q -E "^(device_tree_param|dtparam)=([^,]*,)*i2c(_arm)?=[^,]*" $CONFIG; then
|
if ! grep -q -E "^(device_tree_param|dtparam)=([^,]*,)*i2c(_arm)?=[^,]*" $CONFIG; then
|
||||||
printf "dtparam=i2c_arm=$SETTING\n" >> $CONFIG
|
printf "dtparam=i2c_arm=$SETTING\n" >> $CONFIG
|
||||||
fi
|
fi
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --msgbox "The ARM I2C interface $TENSE $STATUS$REBOOT" 20 60 1
|
whiptail --msgbox "The ARM I2C interface $TENSE $STATUS$REBOOT" 20 60 1
|
||||||
|
fi
|
||||||
if [ $SETTING = "off" ]; then
|
if [ $SETTING = "off" ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@ -519,8 +576,12 @@ do_i2c() {
|
|||||||
touch $BLACKLIST
|
touch $BLACKLIST
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --yesno "Would you like the I2C kernel module to be loaded by default?" $DEFAULT 20 60 2
|
whiptail --yesno "Would you like the I2C kernel module to be loaded by default?" $DEFAULT 20 60 2
|
||||||
RET=$?
|
RET=$?
|
||||||
|
else
|
||||||
|
RET=$1
|
||||||
|
fi
|
||||||
if [ $RET -eq 0 ]; then
|
if [ $RET -eq 0 ]; then
|
||||||
sed $BLACKLIST -i -e "s/^\(blacklist[[:space:]]*i2c[-_]bcm2708\)/#\1/"
|
sed $BLACKLIST -i -e "s/^\(blacklist[[:space:]]*i2c[-_]bcm2708\)/#\1/"
|
||||||
sed /etc/modules -i -e "s/^#[[:space:]]*\(i2c[-_]dev\)/\1/"
|
sed /etc/modules -i -e "s/^#[[:space:]]*\(i2c[-_]dev\)/\1/"
|
||||||
@ -529,14 +590,18 @@ do_i2c() {
|
|||||||
fi
|
fi
|
||||||
modprobe i2c-bcm2708
|
modprobe i2c-bcm2708
|
||||||
modprobe i2c-dev
|
modprobe i2c-dev
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --msgbox "I2C kernel module will now be loaded by default" 20 60 1
|
whiptail --msgbox "I2C kernel module will now be loaded by default" 20 60 1
|
||||||
|
fi
|
||||||
elif [ $RET -eq 1 ]; then
|
elif [ $RET -eq 1 ]; then
|
||||||
sed $BLACKLIST -i -e "s/^#\(blacklist[[:space:]]*i2c[-_]bcm2708\)/\1/"
|
sed $BLACKLIST -i -e "s/^#\(blacklist[[:space:]]*i2c[-_]bcm2708\)/\1/"
|
||||||
if ! grep -q "^blacklist i2c[-_]bcm2708" $BLACKLIST; then
|
if ! grep -q "^blacklist i2c[-_]bcm2708" $BLACKLIST; then
|
||||||
printf "blacklist i2c-bcm2708\n" >> $BLACKLIST
|
printf "blacklist i2c-bcm2708\n" >> $BLACKLIST
|
||||||
fi
|
fi
|
||||||
sed /etc/modules -i -e "s/^\(i2c[-_]dev\)/#\1/"
|
sed /etc/modules -i -e "s/^\(i2c[-_]dev\)/#\1/"
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --msgbox "I2C kernel module will no longer be loaded by default" 20 60 1
|
whiptail --msgbox "I2C kernel module will no longer be loaded by default" 20 60 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@ -548,14 +613,21 @@ do_serial() {
|
|||||||
DEFAULT=--defaultno
|
DEFAULT=--defaultno
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --yesno "Would you like a login shell to be accessible over serial?" $DEFAULT 20 60 2
|
whiptail --yesno "Would you like a login shell to be accessible over serial?" $DEFAULT 20 60 2
|
||||||
RET=$?
|
RET=$?
|
||||||
|
else
|
||||||
|
get_init_sys
|
||||||
|
RET=$1
|
||||||
|
fi
|
||||||
if [ $RET -eq 1 ]; then
|
if [ $RET -eq 1 ]; then
|
||||||
if [ $SYSTEMD -eq 0 ]; then
|
if [ $SYSTEMD -eq 0 ]; then
|
||||||
sed -i /etc/inittab -e "s|^.*:.*:respawn:.*ttyAMA0|#&|"
|
sed -i /etc/inittab -e "s|^.*:.*:respawn:.*ttyAMA0|#&|"
|
||||||
fi
|
fi
|
||||||
sed -i /boot/cmdline.txt -e "s/console=ttyAMA0,[0-9]\+ //"
|
sed -i /boot/cmdline.txt -e "s/console=ttyAMA0,[0-9]\+ //"
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --msgbox "Serial is now disabled" 20 60 1
|
whiptail --msgbox "Serial is now disabled" 20 60 1
|
||||||
|
fi
|
||||||
elif [ $RET -eq 0 ]; then
|
elif [ $RET -eq 0 ]; then
|
||||||
if [ $SYSTEMD -eq 0 ]; then
|
if [ $SYSTEMD -eq 0 ]; then
|
||||||
sed -i /etc/inittab -e "s|^#\(.*:.*:respawn:.*ttyAMA0\)|\1|"
|
sed -i /etc/inittab -e "s|^#\(.*:.*:respawn:.*ttyAMA0\)|\1|"
|
||||||
@ -566,7 +638,9 @@ do_serial() {
|
|||||||
if ! grep -q "console=ttyAMA0" /boot/cmdline.txt; then
|
if ! grep -q "console=ttyAMA0" /boot/cmdline.txt; then
|
||||||
sed -i /boot/cmdline.txt -e "s/root=/console=ttyAMA0,115200 root=/"
|
sed -i /boot/cmdline.txt -e "s/root=/console=ttyAMA0,115200 root=/"
|
||||||
fi
|
fi
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --msgbox "Serial is now enabled" 20 60 1
|
whiptail --msgbox "Serial is now enabled" 20 60 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
return $RET
|
return $RET
|
||||||
fi
|
fi
|
||||||
@ -589,11 +663,95 @@ disable_raspi_config_at_boot() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do_boot_behaviour_new() {
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
|
BOOTOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Boot Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \
|
||||||
|
"B1 Console" "Text console, requiring user to login" \
|
||||||
|
"B2 Console Autologin" "Text console, automatically logged in as 'pi' user" \
|
||||||
|
"B3 Desktop" "Desktop GUI, requiring user to login" \
|
||||||
|
"B4 Desktop Autologin" "Desktop GUI, automatically logged in as 'pi' user" \
|
||||||
|
3>&1 1>&2 2>&3)
|
||||||
|
else
|
||||||
|
get_init_sys
|
||||||
|
BOOTOPT=$1
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
case "$BOOTOPT" in
|
||||||
|
B1*)
|
||||||
|
if [ -e /etc/init.d/lightdm ]; then
|
||||||
|
if [ $SYSTEMD -eq 1 ]; then
|
||||||
|
systemctl set-default multi-user.target
|
||||||
|
sudo ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
|
||||||
|
else
|
||||||
|
update-rc.d lightdm disable 2
|
||||||
|
sed /etc/inittab -i -e "s/1:2345:respawn:\/bin\/login -f pi tty1 <\/dev\/tty1 >\/dev\/tty1 2>&1/1:2345:respawn:\/sbin\/getty --noclear 38400 tty1/"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
B2*)
|
||||||
|
if [ -e /etc/init.d/lightdm ]; then
|
||||||
|
if [ $SYSTEMD -eq 1 ]; then
|
||||||
|
systemctl set-default multi-user.target
|
||||||
|
sudo ln -fs /etc/systemd/system/autologin@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
|
||||||
|
else
|
||||||
|
update-rc.d lightdm disable 2
|
||||||
|
sed /etc/inittab -i -e "s/1:2345:respawn:\/sbin\/getty --noclear 38400 tty1/1:2345:respawn:\/bin\/login -f pi tty1 <\/dev\/tty1 >\/dev\/tty1 2>&1/"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
B3*)
|
||||||
|
if [ -e /etc/init.d/lightdm ]; then
|
||||||
|
if [ $SYSTEMD -eq 1 ]; then
|
||||||
|
systemctl set-default graphical.target
|
||||||
|
else
|
||||||
|
update-rc.d lightdm enable 2
|
||||||
|
fi
|
||||||
|
sed /etc/lightdm/lightdm.conf -i -e "s/^autologin-user=pi/#autologin-user=/"
|
||||||
|
disable_raspi_config_at_boot
|
||||||
|
else
|
||||||
|
whiptail --msgbox "Do sudo apt-get install lightdm to allow configuration of boot to desktop" 20 60 2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
B4*)
|
||||||
|
if [ -e /etc/init.d/lightdm ]; then
|
||||||
|
if id -u pi > /dev/null 2>&1; then
|
||||||
|
if [ $SYSTEMD -eq 1 ]; then
|
||||||
|
systemctl set-default graphical.target
|
||||||
|
else
|
||||||
|
update-rc.d lightdm enable 2
|
||||||
|
fi
|
||||||
|
sed /etc/lightdm/lightdm.conf -i -e "s/^#autologin-user=.*/autologin-user=pi/"
|
||||||
|
disable_raspi_config_at_boot
|
||||||
|
else
|
||||||
|
whiptail --msgbox "The pi user has been removed, can't set up boot to desktop" 20 60 2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
whiptail --msgbox "Do sudo apt-get install lightdm to allow configuration of boot to desktop" 20 60 2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
whiptail --msgbox "Programmer error, unrecognised boot option" 20 60 2
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
ASK_TO_REBOOT=1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
do_boot_behaviour() {
|
do_boot_behaviour() {
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
BOOTOPT=$(whiptail --menu "Chose boot option" 20 60 10 \
|
BOOTOPT=$(whiptail --menu "Chose boot option" 20 60 10 \
|
||||||
"Console" "Text console, requiring login (default)" \
|
"Console" "Text console, requiring login (default)" \
|
||||||
"Desktop" "Log in as user 'pi' at the graphical desktop" \
|
"Desktop" "Log in as user 'pi' at the graphical desktop" \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
|
else
|
||||||
|
get_init_sys
|
||||||
|
BOOTOPT=$1
|
||||||
|
true
|
||||||
|
fi
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
case "$BOOTOPT" in
|
case "$BOOTOPT" in
|
||||||
Console)
|
Console)
|
||||||
@ -686,9 +844,13 @@ do_camera() {
|
|||||||
whiptail --msgbox "Your firmware appears to be out of date (no start_x.elf). Please update" 20 60 2
|
whiptail --msgbox "Your firmware appears to be out of date (no start_x.elf). Please update" 20 60 2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
whiptail --yesno "Enable support for Raspberry Pi camera?" 20 60 2 \
|
whiptail --yesno "Enable support for Raspberry Pi camera?" 20 60 2 \
|
||||||
--yes-button Disable --no-button Enable
|
--yes-button Disable --no-button Enable
|
||||||
RET=$?
|
RET=$?
|
||||||
|
else
|
||||||
|
RET=$1
|
||||||
|
fi
|
||||||
if [ $RET -eq 0 ] || [ $RET -eq 1 ]; then
|
if [ $RET -eq 0 ] || [ $RET -eq 1 ]; then
|
||||||
ASK_TO_REBOOT=1
|
ASK_TO_REBOOT=1
|
||||||
set_camera $RET;
|
set_camera $RET;
|
||||||
@ -810,6 +972,10 @@ EOF
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nonint() {
|
||||||
|
$*
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Command line options for non-interactive use
|
# Command line options for non-interactive use
|
||||||
#
|
#
|
||||||
@ -837,6 +1003,10 @@ do
|
|||||||
do_apply_os_config
|
do_apply_os_config
|
||||||
exit $?
|
exit $?
|
||||||
;;
|
;;
|
||||||
|
nonint)
|
||||||
|
INTERACTIVE=False
|
||||||
|
$@
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
# unknown option
|
# unknown option
|
||||||
;;
|
;;
|
||||||
@ -918,13 +1088,14 @@ do_advanced_menu() {
|
|||||||
#
|
#
|
||||||
# Interactive use loop
|
# Interactive use loop
|
||||||
#
|
#
|
||||||
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
get_init_sys
|
get_init_sys
|
||||||
calc_wt_size
|
calc_wt_size
|
||||||
while true; do
|
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 "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \
|
||||||
"1 Expand Filesystem" "Ensures that all of the SD card storage is available to the OS" \
|
"1 Expand Filesystem" "Ensures that all of the SD card storage is available to the OS" \
|
||||||
"2 Change User Password" "Change password for the default user (pi)" \
|
"2 Change User Password" "Change password for the default user (pi)" \
|
||||||
"3 Enable Boot to Desktop/Scratch" "Choose whether to boot into a desktop environment, Scratch, or the command-line" \
|
"3 Boot Options" "Choose whether to boot into a desktop environment or the command line" \
|
||||||
"4 Internationalisation Options" "Set up language and regional settings to match your location" \
|
"4 Internationalisation Options" "Set up language and regional settings to match your location" \
|
||||||
"5 Enable Camera" "Enable this Pi to work with the Raspberry Pi Camera" \
|
"5 Enable Camera" "Enable this Pi to work with the Raspberry Pi Camera" \
|
||||||
"6 Add to Rastrack" "Add this Pi to the online Raspberry Pi Map (Rastrack)" \
|
"6 Add to Rastrack" "Add this Pi to the online Raspberry Pi Map (Rastrack)" \
|
||||||
@ -939,7 +1110,7 @@ while true; do
|
|||||||
case "$FUN" in
|
case "$FUN" in
|
||||||
1\ *) do_expand_rootfs ;;
|
1\ *) do_expand_rootfs ;;
|
||||||
2\ *) do_change_pass ;;
|
2\ *) do_change_pass ;;
|
||||||
3\ *) do_boot_behaviour ;;
|
3\ *) do_boot_behaviour_new ;;
|
||||||
4\ *) do_internationalisation_menu ;;
|
4\ *) do_internationalisation_menu ;;
|
||||||
5\ *) do_camera ;;
|
5\ *) do_camera ;;
|
||||||
6\ *) do_rastrack ;;
|
6\ *) do_rastrack ;;
|
||||||
@ -952,3 +1123,4 @@ while true; do
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user