Simplify some stuff

This commit is contained in:
Mattia Basaglia 2014-12-21 19:31:10 +01:00
parent cdd11d8b15
commit 0b068d2a1f
2 changed files with 13 additions and 11 deletions

View file

@ -106,7 +106,7 @@ $(BINDIR):
install: $(OUT_ALL) install: $(OUT_ALL)
install: $(DATADIR) install: $(DATADIR)
install: $(BINDIR) install: $(BINDIR)
$(INSTALL_DIR) $(MAKEFILE_DIR)rendered $(DATADIR) $(INSTALL_DIR) $(OUT_DIR) $(DATADIR)
$(INSTALL_FILE) $(MAKEFILE_DIR)systempony $(BINDIR) $(INSTALL_FILE) $(MAKEFILE_DIR)systempony $(BINDIR)
uninstall: uninstall:
@ -116,5 +116,6 @@ uninstall:
#touch output files to avoid re-generations (eg: after cloning) #touch output files to avoid re-generations (eg: after cloning)
touchput: touchput:
find $(MAKEFILE_DIR)rendered -exec touch {} \; find $(PONY_DIR) -name '*.txt' -exec touch {} \;
find $(MAKEFILE_DIR)rendered -name '*.png' -exec touch {} \; find $(OUT_DIR) -exec touch {} \;
find $(OUT_DIR) -name '*.png' -exec touch {} \;

View file

@ -28,7 +28,7 @@ function ponyget_RAM()
local ramtable=$(free -m) local ramtable=$(free -m)
local used_M=$(echo "$ramtable" | sed -n 3p | sed -r "s/ +/\t/g" | cut -f 3) local used_M=$(echo "$ramtable" | sed -n 3p | sed -r "s/ +/\t/g" | cut -f 3)
local total_M=$(echo "$ramtable" | sed -n 2p | sed -r "s/ +/\t/g" | cut -f 2) local total_M=$(echo "$ramtable" | sed -n 2p | sed -r "s/ +/\t/g" | cut -f 2)
local percent=$(echo "$used_M * 100 / $total_M " | bc) let percent="$used_M * 100 / $total_M"
local color="32"; local color="32";
if [ "$percent" -gt 66 ] if [ "$percent" -gt 66 ]
@ -201,19 +201,20 @@ then
lines=$(cat "$ponyfile" | wc -l) # cat to avoid printing file name lines=$(cat "$ponyfile" | wc -l) # cat to avoid printing file name
let info_index=0 let info_index=0
let start_line=($lines-${#INFO[@]})/2 let start_line=($lines-${#INFO[@]})/2
for (( l=1; $l <= $lines; l++ ))
let l=1
while IFS= read -r line
do do
line=$(sed -n "$l{p;q}" "$ponyfile" )
echo -n "$line"
if [ $info_index -lt ${#INFO[@]} -a $l -ge $start_line ] if [ $info_index -lt ${#INFO[@]} -a $l -ge $start_line ]
then then
# TODO take in consideration $COLUMNS # TODO take in consideration $COLUMNS
printf " \x1b[31;1m%-${maxkeyl}s\x1b[0m: %s" "${INFO[$info_index]}" "${infoval[$info_index]}" printf "%s \x1b[31;1m%-${maxkeyl}s\x1b[0m: %s\n" "$line" "${INFO[$info_index]}" "${infoval[$info_index]}"
let info_index++ let info_index++
else else
echo -ne "\x1b[0m" echo -n "$line"
echo -e "\x1b[0m"
fi fi
echo let l++
done done < "$ponyfile"
fi fi