Merge branch 'screen_detection' into development

This commit is contained in:
Eric Warnke 2016-10-26 12:26:29 -04:00
commit 53131b1449
2 changed files with 27 additions and 15 deletions

View file

@ -32,13 +32,17 @@ useUpdateVars=false
IPv4_address="" IPv4_address=""
IPv6_address="" IPv6_address=""
# Find the rows and columns # Find the rows and columns will default to 80x24 is it can not be detected
rows=$(tput lines) screen_size=$(stty size 2>/dev/null || echo 24 80)
columns=$(tput cols) rows=$(echo $screen_size | awk '{print $1}')
columns=$(echo $screen_size | awk '{print $2}')
# Divide by two so the dialogs take up half of the screen, which looks nice. # Divide by two so the dialogs take up half of the screen, which looks nice.
r=$(( rows / 2 )) r=$(( rows / 2 ))
c=$(( columns / 2 )) c=$(( columns / 2 ))
# Unless the screen is tiny
r=$(( r < 20 ? 20 : r ))
c=$(( c < 70 ? 70 : c ))
######## Undocumented Flags. Shhh ######## ######## Undocumented Flags. Shhh ########
skipSpaceCheck=false skipSpaceCheck=false

View file

@ -187,12 +187,16 @@ gravity_Schwarzchild() {
gravity_Blacklist() { gravity_Blacklist() {
# Append blacklist entries if they exist # Append blacklist entries if they exist
numBlacklisted=$(wc -l < "${blacklistFile}") if [[ -f "${blacklistFile}" ]]; then
plural=; [[ "$numBlacklisted" != "1" ]] && plural=s numBlacklisted=$(wc -l < "${blacklistFile}")
plural=; [[ "$numBlacklisted" != "1" ]] && plural=s
echo -n "::: BlackListing $numBlacklisted domain${plural}..."
cat ${blacklistFile} >> ${piholeDir}/${eventHorizon}
echo " done!"
else
echo "::: Nothing to blacklist!"
fi
echo -n "::: BlackListing $numBlacklisted domain${plural}..."
cat ${blacklistFile} >> ${piholeDir}/${eventHorizon}
echo " done!"
} }
gravity_Whitelist() { gravity_Whitelist() {
@ -209,15 +213,19 @@ gravity_Whitelist() {
done done
echo " done!" echo " done!"
# Ensure adlist domains are in whitelist.txt # Ensure adlist domains are in whitelist.txt
${whitelistScript} -nr -q "${urls[@]}" > /dev/null ${whitelistScript} -nr -q "${urls[@]}" > /dev/null
# Remove anything in whitelist.txt from the Event Horizon if [[ -f "${whitelistFile}" ]]; then
numWhitelisted=$(wc -l < "${whitelistFile}") # Remove anything in whitelist.txt from the Event Horizon
plural=; [[ "$numWhitelisted" != "1" ]] && plural=s numWhitelisted=$(wc -l < "${whitelistFile}")
echo -n "::: Whitelisting $numWhitelisted domain${plural}..." plural=; [[ "$numWhitelisted" != "1" ]] && plural=s
grep -F -x -v -f ${whitelistFile} ${piholeDir}/${preEventHorizon} > ${piholeDir}/${eventHorizon} echo -n "::: Whitelisting $numWhitelisted domain${plural}..."
echo " done!" grep -F -x -v -f ${whitelistFile} ${piholeDir}/${preEventHorizon} > ${piholeDir}/${eventHorizon}
echo " done!"
else
echo "::: Nothing to whitelist!"
fi
} }
gravity_unique() { gravity_unique() {