diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index c327c3a3..0a47d035 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -32,13 +32,17 @@ useUpdateVars=false IPv4_address="" IPv6_address="" -# Find the rows and columns -rows=$(tput lines) -columns=$(tput cols) +# Find the rows and columns will default to 80x24 is it can not be detected +screen_size=$(stty size 2>/dev/null || echo 24 80) +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. r=$(( rows / 2 )) c=$(( columns / 2 )) +# Unless the screen is tiny +r=$(( r < 20 ? 20 : r )) +c=$(( c < 70 ? 70 : c )) ######## Undocumented Flags. Shhh ######## skipSpaceCheck=false diff --git a/gravity.sh b/gravity.sh index 03aafabb..f524e587 100755 --- a/gravity.sh +++ b/gravity.sh @@ -187,12 +187,16 @@ gravity_Schwarzchild() { gravity_Blacklist() { # Append blacklist entries if they exist - numBlacklisted=$(wc -l < "${blacklistFile}") - plural=; [[ "$numBlacklisted" != "1" ]] && plural=s + if [[ -f "${blacklistFile}" ]]; then + 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() { @@ -209,15 +213,19 @@ gravity_Whitelist() { done echo " done!" - # Ensure adlist domains are in whitelist.txt + # Ensure adlist domains are in whitelist.txt ${whitelistScript} -nr -q "${urls[@]}" > /dev/null - # Remove anything in whitelist.txt from the Event Horizon - numWhitelisted=$(wc -l < "${whitelistFile}") - plural=; [[ "$numWhitelisted" != "1" ]] && plural=s - echo -n "::: Whitelisting $numWhitelisted domain${plural}..." - grep -F -x -v -f ${whitelistFile} ${piholeDir}/${preEventHorizon} > ${piholeDir}/${eventHorizon} - echo " done!" + if [[ -f "${whitelistFile}" ]]; then + # Remove anything in whitelist.txt from the Event Horizon + numWhitelisted=$(wc -l < "${whitelistFile}") + plural=; [[ "$numWhitelisted" != "1" ]] && plural=s + echo -n "::: Whitelisting $numWhitelisted domain${plural}..." + grep -F -x -v -f ${whitelistFile} ${piholeDir}/${preEventHorizon} > ${piholeDir}/${eventHorizon} + echo " done!" + else + echo "::: Nothing to whitelist!" + fi } gravity_unique() {