Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dorota Czaplejewicz
librem5-devkit-tools
Commits
86b4db8e
Commit
86b4db8e
authored
Mar 10, 2019
by
Dorota Czaplejewicz
Browse files
base: Expand root in initramfs
Scripts based on cloud-initramfs-growroot
parent
55d8e5bb
Pipeline
#4903
passed with stages
in 3 minutes and 38 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
debian/control
View file @
86b4db8e
...
...
@@ -13,6 +13,7 @@ Architecture: arm64
Depends:
${misc:Depends},
${shlibs:Depends},
cloud-initramfs-growroot,
flash-kernel,
jitterentropy-rngd,
u-boot-tools,
...
...
debian/copyright
View file @
86b4db8e
...
...
@@ -3,6 +3,12 @@ Source: https://code.puri.sm/Librem5/librem5-evk-tools.git
Files: *
Copyright: 2018 Purism SPC
License: GPL-3+
Files: usr/*
Copyright: 2011 Scott Moser <scott.moser@canonical.com>, 2019 Purism SPC
License: GPL-3+
License: GPL-3+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -19,3 +25,4 @@ License: GPL-3+
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
debian/librem5-devkit-base.install
View file @
86b4db8e
etc
/
lib
/
usr
/
debian/librem5-devkit-base.postinst
View file @
86b4db8e
...
...
@@ -23,6 +23,8 @@ case "$1" in
systemctl
enable
serial-getty@ttyGS0
# Mass storage is required for Ethernet+serial over USB via g_multi
truncate
-s
1M /var/lib/mass_storage_dummy
# Enable resize2fs hook
dpkg-trigger update-initramfs
;;
abort-upgrade|abort-remove|abort-deconfigure
)
...
...
debian/librem5-devkit-base.postrm
View file @
86b4db8e
...
...
@@ -24,6 +24,7 @@ case "$1" in
;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear
)
systemctl disable serial-getty@ttyGS0
dpkg-trigger update-initramfs
;;
*
)
...
...
usr/share/initramfs-tools/hooks/resize_rootfs
0 → 100755
View file @
86b4db8e
#!/bin/sh
set
-e
PREREQS
=
""
case
$1
in
prereqs
)
echo
"
${
PREREQS
}
"
;
exit
0
;;
esac
.
/usr/share/initramfs-tools/hook-functions
##
for
pname
in
resize2fs
;
do
fpath
=
$(
which
"
$pname
"
)
&&
copy_exec
"
$fpath
"
||
{
echo
"ERROR: no '
$pname
' in path"
1>&2
;
exit
1
;
}
done
# vi: ts=4 noexpandtab
usr/share/initramfs-tools/scripts/local-bottom/resize_rootfs
0 → 100755
View file @
86b4db8e
#!/bin/sh
set
-e
PREREQS
=
"growroot"
case
$1
in
prereqs
)
echo
"
${
PREREQS
}
"
;
exit
0
;;
esac
.
/scripts/functions
msg
()
{
echo
"resize_rootfs:"
"
$@
"
;
}
fail
()
{
[
$#
-eq
0
]
||
msg
"
$@
"
;
exit
1
;
}
# if a file indicates we should do nothing, then just exit
for
f
in
/var/lib/cloud/instance/root-grown /etc/growroot-disabled
\
/etc/growroot-grown
;
do
[
-f
"
${
rootmnt
}
$f
"
]
&&
exit
0
done
# Get the root device, root filesystem and mount options
if
!
out
=
$(
awk
'$2 == mt { print }'
"mt=
${
rootmnt
}
"
< /proc/mounts
)
;
then
fail
"
${
out
}
"
return
fi
# Need to do it this way, can't use '<<< "${out}"' since RHEL6 doesn't
# seem to understand it
read
_rootdev _rootmnt rootfs opts unused
<<
EOF
${
out
}
EOF
# the filesystem is mounted read-only. Referencing the device leads toan invalid argument
umount
${
rootmnt
}
||
msg
"failed to unmount
${
ROOT
}
."
# this will fail in local-bottom due to the rootfs being mounted and read only
set
+e
out
=
$(
resize2fs
"
${
ROOT
}
"
2>&1
)
set
-e
ret
=
$?
# this is taken from 'mountroot' function
# see /usr/share/initramfs-tools/scripts/local
mount
-t
${
rootfs
}
-o
${
opts
}
${
ROOT
}
${
rootmnt
}
||
fail
"failed to re-mount
${
ROOT
}
. this is bad!"
case
"
$ret
"
in
0
)
msg
"succeeded"
"
$out
"
;;
*
)
msg
"exited '
$ret
'"
"
${
out
}
"
;
exit
1
;;
esac
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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