Skip to content

Commit d532126

Browse files
committed
General fixes & optimizations
1 parent 16df5bf commit d532126

File tree

4 files changed

+8
-21
lines changed

4 files changed

+8
-21
lines changed

build.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env sh
22
# Installation Archives Builder
3-
# Copyright 2018-2022, VR25
3+
# Copyright 2018-2024, VR25
44
# License: GPLv3+
55
#
66
# usage: $0 [any_random_arg]
@@ -13,7 +13,6 @@
1313

1414
. ./check-syntax.sh || exit $?
1515

16-
1716
set_prop() {
1817
sed -i -e "s/^($1=.*/($1=$2/" -e "s/^$1=.*/$1=$2/" \
1918
${3:-module.prop} 2>/dev/null

install/acc.sh

+1-7
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ case "${1-}" in
498498
;;
499499

500500
-ss::)
501-
sort $dataDir/logs/working-switches.log | nl -s ") " -w 2 -v 1
501+
set_prop_ $1
502502
;;
503503

504504
-sv)
@@ -543,12 +543,6 @@ case "${1-}" in
543543
cat $TMPDIR/ch-switches $_parsed 2>/dev/null > $parsed \
544544
&& sort -u $parsed | sed 's/ $//; /^$/d' > $TMPDIR/ch-switches
545545
fi
546-
if [ -f $TMPDIR/.sw ]; then
547-
while IFS= read line; do
548-
[ -n "$line" ] || continue
549-
! grep -q "$line " $TMPDIR/.sw || sed -i "\|$line|d" $dataDir/logs/write.log
550-
done < $dataDir/logs/write.log
551-
fi
552546
cp -f $logF $logF_ 2>/dev/null
553547
! $daemonWasUp || start-stop-daemon -bx $TMPDIR/.accdt -S --
554548
exit $exitCode

install/batt-interface.sh

+2
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ battCapacity=$batt/capacity
245245
battStatus=$battStatus
246246
currFile=$currFile
247247
curThen=$curThen
248+
idleThreshold=${idleThreshold:-40}
249+
_STI=${_STI:-15}
248250
temp=$temp
249251
voltNow=$voltNow" > $TMPDIR/.batt-interface.sh
250252

install/misc-functions.sh

+4-12
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ at() {
6666
local file=$TMPDIR/schedules/${1/:}
6767
if [ ! -f $file ] && [ $(date +%H%M) -ge ${file##*/} ] && [ $(date +%H) -eq ${1%:*} ]; then
6868
mkdir -p ${file%/*}
69-
touch $file
7069
shift
71-
set -- $(echo "$@" | sed 's/,/\;/g; s|^acc|/dev/acc|g; s| acc| /dev/acc|g')
72-
eval "$@" || :
70+
echo "$@" | sed 's/,/\;/g; s|^acc|/dev/acc|g; s| acc| /dev/acc|g' > $file
71+
. $file || :
7372
elif [ $(date +%H%M) -lt ${file##*/} ]; then
7473
rm $file 2>/dev/null || :
7574
fi
@@ -132,8 +131,6 @@ disable_charging() {
132131

133132
local autoMode=true
134133

135-
# not_charging || {
136-
137134
[[ "${chargingSwitch[*]-}" != *\ -- ]] || autoMode=false
138135

139136
if [[ "${chargingSwitch[0]-}" = */* ]]; then
@@ -161,7 +158,6 @@ disable_charging() {
161158

162159
(set +eux; eval '${runCmdOnPause-}') || :
163160
chDisabledByAcc=true
164-
# }
165161

166162
if [ -n "${1-}" ]; then
167163
case $1 in
@@ -207,8 +203,6 @@ disable_charging() {
207203

208204
enable_charging() {
209205

210-
# ! not_charging || {
211-
212206
[ ! -f $TMPDIR/.sw ] || (. $TMPDIR/.sw; rm $TMPDIR/.sw; flip_sw on) 2>/dev/null || :
213207

214208
if ! $ghostCharging || { $ghostCharging && online; }; then
@@ -232,7 +226,6 @@ enable_charging() {
232226
fi
233227

234228
chDisabledByAcc=false
235-
# }
236229

237230
set_temp_level
238231

@@ -417,9 +410,8 @@ write() {
417410
case "$(grep -E "^(#$2|$2)$" $f 2>/dev/null || :)" in
418411
\#*) blacklisted=true;;
419412
*/*) eval "echo $1 > $2" || i=x;;
420-
*) echo \#$2 >> $f
421-
eval "echo $1 > $2" || i=x
422-
sed -i "s|^#$2$|$2|" $f;;
413+
*) echo $2 >> $f
414+
eval "echo $1 > $2" || i=x;;
423415
esac
424416
else
425417
i=x

0 commit comments

Comments
 (0)