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
15
Issues
15
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
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
4e7ab745
Commit
4e7ab745
authored
Dec 03, 2010
by
Natanael Copa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lbu: remount LBU_MEDIA as read-write if it was read-only
ref #477
parent
884e9560
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
5 deletions
+29
-5
lbu.in
lbu.in
+29
-5
No files found.
lbu.in
View file @
4e7ab745
#
!/bin/sh
#
lbu
-
utility
to
create
local
backups
.
#
Copyright
(
c
)
2006
Natanael
Copa
#
Copyright
(
c
)
2006
-
2010
Natanael
Copa
<
ncopa
@
alpinelinux
.
org
>
#
May
be
distributed
under
GPL2
VERSION
=@
VERSION
@
...
...
@@ -54,6 +54,9 @@ Common options:
cleanup
()
{
local
i
for
i
in
$
REMOUNT_RO_LIST
;
do
mount
-
o
remount
,
ro
$
i
done
for
i
in
$
UMOUNT_LIST
;
do
umount
$
i
done
...
...
@@ -64,9 +67,30 @@ exit_clean() {
exit
1
}
#
check
if
given
dir
is
not
a
mounted
mountpoint
is_unmounted
()
{
awk
"\$2 ==
\"
$1
\"
{exit 1}"
/
proc
/
mounts
}
mount_once
()
{
if
awk
"\$2 ==
\"
$1
\"
{exit 1}"
/
proc
/
mounts
;
then
mount
$
1
&&
UMOUNT_LIST
=
"$1 $UMOUNT_LIST"
if
is_unmounted
"$1"
;
then
mount
$
1
&&
UMOUNT_LIST
=
"$1 $UMOUNT_LIST"
||
return
1
fi
}
#
check
if
given
dir
is
read
-
only
is_ro
()
{
local
tmpfile
=$(
mktemp
-
p
"$1"
)
[
-
z
"$tmpfile"
]
&&
return
0
rm
-
f
"$tmpfile"
return
1
}
mount_once_rw
()
{
mount_once
"$1"
||
return
1
if
is_ro
"$1"
;
then
REMOUNT_RO_LIST
=
"$1 $REMOUNT_RO_LIST"
mount
-
o
remount
,
rw
"$1"
fi
}
...
...
@@ -385,7 +409,7 @@ cmd_commit() {
#
mount
media
unles
its
already
mounted
mnt
=/
media
/$
media
[
-
d
"$mnt"
]
||
usage
mount_once
"$mnt"
||
die
"failed to mount $mnt"
mount_once
_rw
"$mnt"
||
die
"failed to mount $mnt"
#
find
the
outfile
outfile
=
"$mnt/$(hostname).apkovl.tar.gz"
...
...
@@ -538,7 +562,7 @@ cmd_revert() {
if
[
-
n
"$ENCRYPTION"
];
then
current
=
"$current.$ENCRYPTION"
fi
mount_once
"$mnt"
||
die
"failed to mount $mnt"
mount_once
_rw
"$mnt"
||
die
"failed to mount $mnt"
[
-
f
"$revertto"
]
||
die
"file not found: $revertto"
backup_apkovl
"$current"
vecho
"Reverting to $1"
...
...
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