Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Config
Commits
c3ac02bb
Commit
c3ac02bb
authored
May 26, 2017
by
Igor Pecovnik
Browse files
Better handling of overlayroot fs enable / disable
parent
278dc94d
Changes
1
Hide whitespace changes
Inline
Side-by-side
debian-config
View file @
c3ac02bb
...
@@ -243,9 +243,13 @@ while true; do
...
@@ -243,9 +243,13 @@ while true; do
fi
fi
[[
$(
apt-cache search
--names-only
'^linux-'
$(
lsb_release
-cs
)
'-root.*.'
$BOARD
''
|
sed
's/.*(\(.*\))/\1/'
|
awk
'{print $1}'
\
[[
$(
apt-cache search
--names-only
'^linux-'
$(
lsb_release
-cs
)
'-root.*.'
$BOARD
''
|
sed
's/.*(\(.*\))/\1/'
|
awk
'{print $1}'
\
|
wc
-l
)
-gt
1
]]
&&
LIST+
=(
"Switch"
"Switch to alternative kernels"
)
|
wc
-l
)
-gt
1
]]
&&
LIST+
=(
"Switch"
"Switch to alternative kernels"
)
[[
"
$DISTRO
"
==
"Ubuntu"
&&
"
$(
modinfo overlay
>
/dev/null 2>&1
;
echo
$?
)
"
==
"0"
]]
&&
\
if
[[
"
$DISTRO
"
==
"Ubuntu"
&&
"
$(
modinfo overlay
>
/dev/null 2>&1
;
echo
$?
)
"
==
"0"
]]
;
then
LIST+
=(
"Overlayroot"
"Toggle virtual read-only root filesystem"
)
if
[
-n
"
$(
mount |
grep
-w
tmpfs-root
)
"
]
;
then
LIST+
=(
"Overlayroot"
"Disable virtual read-only root filesystem"
)
else
LIST+
=(
"Overlayroot"
"Enable virtual read-only root filesystem"
)
fi
fi
# count number of menu items to adjust window sizee
# count number of menu items to adjust window sizee
LISTLENGHT
=
"
$((
7
+
${#
LIST
[@]
}
/
2
))
"
LISTLENGHT
=
"
$((
7
+
${#
LIST
[@]
}
/
2
))
"
BOXLENGHT
=
${#
LIST
[@]
}
BOXLENGHT
=
${#
LIST
[@]
}
...
@@ -394,11 +398,11 @@ while true; do
...
@@ -394,11 +398,11 @@ while true; do
--no-label
"Cancel"
\
--no-label
"Cancel"
\
--yesno
"
\n
Your system is already virtual read-only.
\n\n
Do you want to disable this feature and reboot?"
9 60
--yesno
"
\n
Your system is already virtual read-only.
\n\n
Do you want to disable this feature and reboot?"
9 60
[[
$?
=
0
]]
&&
overlayroot-chroot
sed
-i
"s/^overlayroot=.*/overlayroot=
\"\"
/"
/etc/overlayroot.conf
&&
\
[[
$?
=
0
]]
&&
overlayroot-chroot
sed
-i
"s/^overlayroot=.*/overlayroot=
\"\"
/"
/etc/overlayroot.conf
&&
\
rm
/etc/update-motd.d/97-overlayroot
&&
reboot
overlayroot-chroot
rm
/etc/update-motd.d/97-overlayroot
&&
reboot
else
else
debconf-apt-progress
--
apt-get
-y
--no-install-recommends
install
overlayroot
debconf-apt-progress
--
apt-get
-y
--no-install-recommends
install
overlayroot
echo
'#!/bin/bash'
>
/etc/update-motd.d/97-overlayroot
echo
'#!/bin/bash'
>
/etc/update-motd.d/97-overlayroot
echo
'echo -e "[\e[0m \e[1mremember: root is in virtual read only mode\e[0m ]
\n"
'
>>
/etc/update-motd.d/97-overlayroot
echo
'
if [ -n "$(mount | grep -w tmpfs-root)" ]; then
echo -e "[\e[0m \e[1mremember: root is in virtual read only mode\e[0m ]
";fi
'
>>
/etc/update-motd.d/97-overlayroot
dialog
--title
"Root overlay"
--backtitle
"
$BACKTITLE
"
--yes-label
"Reboot"
\
dialog
--title
"Root overlay"
--backtitle
"
$BACKTITLE
"
--yes-label
"Reboot"
\
--no-label
"Cancel"
--yesno
"
\n
Enable virtual read-only root and reboot."
7 45
--no-label
"Cancel"
--yesno
"
\n
Enable virtual read-only root and reboot."
7 45
[[
$?
=
0
]]
&&
sed
-i
"s/^overlayroot=.*/overlayroot=
\"
tmpfs
\"
/"
/etc/overlayroot.conf
&&
reboot
[[
$?
=
0
]]
&&
sed
-i
"s/^overlayroot=.*/overlayroot=
\"
tmpfs
\"
/"
/etc/overlayroot.conf
&&
reboot
...
...
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