Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
Apply Upstream Pull Requests
Browse files Browse the repository at this point in the history
Fixed expanding filesystem in Jessie - https://github.com/asb/raspi-
config/pull/36
add systemd service - asb#50
  • Loading branch information
riptidewave93 committed May 21, 2015
1 parent 3a5d753 commit 898cb63
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 16 deletions.
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Source: raspi-config
Section: unknown
Priority: extra
Maintainer: Alex Bradbury <asb@asbradbury.org>
Build-Depends: debhelper (>= 8.0.0)
Build-Depends: debhelper (>= 8.0.0), dh-systemd
Standards-Version: 3.9.2
Homepage: https://github.com/asb/raspi-config
#Vcs-Git: git://git.debian.org/collab-maint/raspi-config.git
Expand Down
22 changes: 14 additions & 8 deletions debian/raspi-config.init
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@
# Description:
### END INIT INFO

. /lib/lsb/init-functions

case "$1" in
start)
log_daemon_msg "Checking if shift key is held down"
timeout 1 thd --dump /dev/input/event* | grep -q "LEFTSHIFT\|RIGHTSHIFT"
do_start() {
timeout 1 thd --dump /dev/input/event* 2>&1 | grep -q "LEFTSHIFT\|RIGHTSHIFT"
if [ $? -eq 0 ]; then
printf " Yes. Not enabling ondemand scaling governor"
log_end_msg 0
else
printf " No. Switching to ondemand scaling governor"
SYS_CPUFREQ_GOVERNOR=/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
Expand All @@ -27,8 +22,19 @@ case "$1" in
echo 100000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
fi
log_end_msg 0
fi
}

case "$1" in
start)
. /lib/lsb/init-functions
log_daemon_msg "Checking if shift key is held down"
do_start
log_end_msg 0
;;
systemd-start)
echo "Checking if shift key is held down"
do_start
;;
*)
echo "Usage: $0 start" >&2
Expand Down
13 changes: 13 additions & 0 deletions debian/raspi-config.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Switch to ondemand cpu governor (unless shift key is pressed)
DefaultDependencies=no
Before=sysinit.target
After=udev.service mountkernfs.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/etc/init.d/raspi-config systemd-start

[Install]
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
#export DH_VERBOSE=1

%:
dh $@
dh $@ --with systemd
12 changes: 6 additions & 6 deletions raspi-config
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ you have heavily customised your installation.\
}

do_expand_rootfs() {
if ! [ -h /dev/root ]; then
whiptail --msgbox "/dev/root does not exist or is not a symlink. Don't know how to expand" 20 60 2
if ! [ -h /dev/disk/by-label/root ]; then
whiptail --msgbox "/dev/disk/by-label/root does not exist or is not a symlink. Don't know how to expand" 20 60 2
return 0
fi

ROOT_PART=$(readlink /dev/root)
PART_NUM=${ROOT_PART#mmcblk0p}
ROOT_PART=$(readlink /dev/disk/by-label/root)
PART_NUM=${ROOT_PART#../../mmcblk0p}
if [ "$PART_NUM" = "$ROOT_PART" ]; then
whiptail --msgbox "/dev/root is not an SD card. Don't know how to expand" 20 60 2
whiptail --msgbox "/dev/disk/by-label/root is not an SD card. Don't know how to expand" 20 60 2
return 0
fi

Expand Down Expand Up @@ -97,7 +97,7 @@ cat <<\EOF > /etc/init.d/resize2fs_once &&
case "$1" in
start)
log_daemon_msg "Starting resize2fs_once" &&
resize2fs /dev/root &&
resize2fs /dev/disk/by-label/root &&
rm /etc/init.d/resize2fs_once &&
update-rc.d resize2fs_once remove &&
log_end_msg $?
Expand Down

0 comments on commit 898cb63

Please sign in to comment.