Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHIP computer PiHole install script not detecting / FS #602

Closed
CDeeRON opened this issue Jul 30, 2016 · 13 comments
Closed

CHIP computer PiHole install script not detecting / FS #602

CDeeRON opened this issue Jul 30, 2016 · 13 comments
Assignees

Comments

@CDeeRON
Copy link
Contributor

CDeeRON commented Jul 30, 2016

Expected Behaviour:

existingFreeBytes=$(df -k / 2>&1 | awk '{print $4}' | head -2 | tail -1)
3206688

Actual Behaviour:

existingFreeBytes=$(df -lk / 2>&1 | awk '{print $4}' | head -2 | tail -1)
systems

Steps to reproduce this issue:

Install Pi-hole on CHIP computer

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@AzureMarker
Copy link
Contributor

Can you specify what the issue is?

@CDeeRON
Copy link
Contributor Author

CDeeRON commented Jul 31, 2016

The install script isn't picking up / fs on CHIP computer.

Sent from my iPhone

On Jul 31, 2016, at 14:32, Mcat12 notifications@github.com wrote:

Can you specify what the issue is?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@dschaper
Copy link
Member

Okay, so root free space is coming back as a string and not an actual value. I'll add that to the list.

@Fourdee
Copy link
Contributor

Fourdee commented Aug 10, 2016

@dschaper @Mcat12
Try this, as an alternative. It will find the line in df that has a / at the end of that line. RootFS being the only entry to have this AFAIK.

df -Pk | grep -m1 '\/$' | awk '{print $4}'

Example result:

root@DietPi:~# df -Pk
Filesystem     1024-blocks   Used Available Capacity Mounted on
/dev/mmcblk0p2   120091852 984744 119090724       1% /
udev                 10240      0     10240       0% /dev
tmpfs               351888   5724    346164       2% /run
tmpfs               879716      0    879716       0% /dev/shm
tmpfs                 5120      0      5120       0% /run/lock
tmpfs               879716      0    879716       0% /sys/fs/cgroup
tmpfs                10240   1168      9072      12% /DietPi
tmpfs                20480     16     20464       1% /var/log
tmpfs               879716      0    879716       0% /tmp
/dev/mmcblk0p1      130798  46780     84018      36% /boot

root@DietPi:~# df -Pk | grep -m1 '\/$'
/dev/mmcblk0p2   120091852 984744 119090724       1% /

root@DietPi:~# df -Pk | grep -m1 '\/$' | awk '{print $4}'
119090724

I think the only situation where this might not work, is if the user has manually mounted every folder in / (eg: /boot /root /usretc), if thats even possible.

@CDeeRON
Copy link
Contributor Author

CDeeRON commented Aug 11, 2016

@Fourdee

chip@chip:~$ df -k
Filesystem     1K-blocks   Used Available Use% Mounted on
udev               10240      0     10240   0% /dev
tmpfs             101584  14984     86600  15% /run
ubi0:rootfs      3777124 650964   3126160  18% /
tmpfs             253956      0    253956   0% /dev/shm
tmpfs               5120      4      5116   1% /run/lock
tmpfs             253956      0    253956   0% /sys/fs/cgroup
tmpfs              50792      0     50792   0% /run/user/1000
chip@chip:~$ df -Pk | grep -m1 '\/$' | awk '{print $4}'
3126160

@CDeeRON
Copy link
Contributor Author

CDeeRON commented Aug 11, 2016

not sure -P is needed though...thoughts?

@Fourdee
Copy link
Contributor

Fourdee commented Aug 12, 2016

@CDeeRON

not sure -P is needed though...thoughts?

Nope, its not needed. Its an attempt to "standardize" the output:

root@DietPi-XU4:~# df --help | grep '\-P'
  -P, --portability     use the POSIX output format

-P' --portability'
Use the POSIX output format. This is like the default format except for the following:

  • The information about each filesystem is always printed on exactly one line; a mount device is never put on a line by itself. This means that if the mount device name is more than 20 characters long (e.g., for some network mounts), the columns are misaligned.
  • Non-integer values are rounded up, instead of being rounded down or rounded to the nearest integer.
  • The labels in the header output line are changed to conform to POSIX.

http://askubuntu.com/questions/55702/df-h-command-puts-line-breaks-in-output-how-do-i-fix

@CDeeRON
Copy link
Contributor Author

CDeeRON commented Aug 12, 2016

@Fourdee would you mind creating a PR with your change? I prefer yours over the one I came up with...haha I already closed my PR.

@Fourdee
Copy link
Contributor

Fourdee commented Aug 12, 2016

@CDeeRON
Yep, development branch?

@CDeeRON
Copy link
Contributor Author

CDeeRON commented Aug 12, 2016

yeah

@Fourdee
Copy link
Contributor

Fourdee commented Aug 12, 2016

Also added,
if existingFreeBytes is invalid int, added option to override:
image

@CDeeRON
Copy link
Contributor Author

CDeeRON commented Aug 12, 2016

Nice

Sent from my iPhone

On Aug 12, 2016, at 07:49, Dan notifications@github.com wrote:

if existingFreeBytes is invalid int, added option to override:


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@dschaper
Copy link
Member

Bug should be resolved in released code. Please notify if this is not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants