Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
alpine-conf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
18
Issues
18
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpine
alpine-conf
Commits
3c506aa5
Commit
3c506aa5
authored
Oct 28, 2010
by
Natanael Copa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setup-bootable: use stat to calculate needed disk space
parent
a3dd3912
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
setup-bootable.in
setup-bootable.in
+10
-5
No files found.
setup-bootable.in
View file @
3c506aa5
...
...
@@ -136,11 +136,16 @@ fi
rm
-rf
"
$destdir
"
/.new
"
$destdir
"
/.old
# check that we have the space we need
needed_space
=
$(
cd
"
$srcdir
"
&&
du
-s
-c
boot apks syslinux.cfg .alpine-release |
awk
'$2 == "total" {print $1}'
)
[
-n
"
$verbose
"
]
&&
echo
"Needed space:
$needed_space
kB"
available_space
=
$(
df
-k
"
$destdir
"
|
tail
-n
1 |
awk
'{print $4}'
)
[
-n
"
$verbose
"
]
&&
echo
"Available space:
$available_space
kB"
# we calculate on MB since shell arthimetic gets problems with big disks
# and bytes.
needed_space
=
$(
cd
"
$srcdir
"
&&
du
-m
-s
-c
boot apks syslinux.cfg .alpine-release |
awk
'$2 == "total" {print $1}'
)
[
-n
"
$verbose
"
]
&&
echo
"Needed space:
$needed_space
MiB"
free_blocks
=
$(
stat
-f
-c
"%f"
"
$destdir
"
)
block_size
=
$(
stat
-f
-c
"%s"
"
$destdir
"
)
blocks_per_mb
=
$((
1024
*
1024
/
$block_size
))
available_space
=
$((
$free_blocks
/
$blocks_per_mb
))
[
-n
"
$verbose
"
]
&&
echo
"Available space:
$available_space
MiB"
[
$available_space
-lt
$needed_space
]
&&
die
"Not enough space on
$destdir
. Aborting."
# copy the files to .new
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment