Don't symlink linux kernel modules.

Fixes #22, #21, and #19.
This commit is contained in:
Wes Barnett 2018-08-16 07:17:24 -04:00
parent 39dee2be1f
commit 1dabe290b6
No known key found for this signature in database
GPG key ID: E4B5E45AA3B8C5C3
2 changed files with 0 additions and 42 deletions

View file

@ -57,27 +57,6 @@ Number of characters to limit length of descriptions used for snapper.
Default is "72". Default is "72".
.RE .RE
\fBLINK_MODULES=\fR\fB\fIyes\fR\fR\fB or \fR\fB\fIno\fR\fR
.RS 4
When set to "yes" this, if the \fIlinux\fR package (or another package
specified by KERNEL_PACKAGE; see below) is updated, then a
symlink will be created in the kernel modules directory for the
currently running kernel to same directory in the pre snapshot of the
"root" configuration. This is so that the kernel modules will still be
available for use before a reboot is required. snap-pac will also
delete all symlinks in the kernel modules directory if this is set
to "yes", in order to clean up the directory.
Default is "no".
.RE
\fBKERNEL_PACKAGE=\fR\fB\fIstring\fR\fR
.RS 4
Used to trigger module linking if LINK_MODULES is set to "yes".
Default is "linux".
.RE
The following are possible settings used on each specific snapper The following are possible settings used on each specific snapper
configuration you have. To use them, first create the folder configuration you have. To use them, first create the folder
\fI/etc/snap-pac\fR if it does not already exist. Then create a file \fI/etc/snap-pac\fR if it does not already exist. Then create a file

View file

@ -75,17 +75,6 @@ truncate_description() {
fi fi
} }
package_updated() {
check="$1"
for x in ${packages[@]}; do
if [[ "$x" == "$check" ]]; then
echo "yes"
return
fi
done
echo "no"
}
trap 'traperror ${LINENO} $? "$BASH_COMMAND" $BASH_LINENO "${FUNCNAME[@]}"' ERR trap 'traperror ${LINENO} $? "$BASH_COMMAND" $BASH_LINENO "${FUNCNAME[@]}"' ERR
trap trapkill SIGTERM SIGINT trap trapkill SIGTERM SIGINT
@ -97,11 +86,8 @@ read_config "$SNAPPAC_CONFIG_FILE"
readonly DESC_LIMIT=${DESC_LIMIT:-72} readonly DESC_LIMIT=${DESC_LIMIT:-72}
readonly ABORT_ON_FAIL=${ABORT_ON_FAIL:-"no"} readonly ABORT_ON_FAIL=${ABORT_ON_FAIL:-"no"}
readonly LINK_MODULES=${LINK_MODULES:-"no"}
readonly KERNEL_PACKAGE=${KERNEL_PACKAGE:-"linux"}
mapfile -t packages mapfile -t packages
kernel_updated=$(package_updated "$KERNEL_PACKAGE")
for CONFIG in $SNAPPER_CONFIGS; do for CONFIG in $SNAPPER_CONFIGS; do
@ -129,14 +115,7 @@ for CONFIG in $SNAPPER_CONFIGS; do
if [[ "$pre_or_post" == "pre" ]]; then if [[ "$pre_or_post" == "pre" ]]; then
x=$($snapper_cmd "$(truncate_description $PRE_DESCRIPTION)") x=$($snapper_cmd "$(truncate_description $PRE_DESCRIPTION)")
printf "==> %s: $(echo $x | tee "$prefile")\n" "$CONFIG" printf "==> %s: $(echo $x | tee "$prefile")\n" "$CONFIG"
if [[ "$LINK_MODULES" == "yes" && "$CONFIG" == "root" ]]; then
find /usr/lib/modules -xtype l -delete
fi
elif [[ -f $prefile && "$pre_or_post" == "post" ]]; then elif [[ -f $prefile && "$pre_or_post" == "post" ]]; then
if [[ "$LINK_MODULES" == "yes" && "$kernel_updated" == "yes" && "$CONFIG" == "root" ]]; then
printf "==> Symlinking old kernel modules...\n"
ln -sv /.snapshots/$(<$prefile)/snapshot/usr/lib/modules/$(uname -r) /usr/lib/modules/
fi
x=$($snapper_cmd "$(truncate_description $POST_DESCRIPTION)" --pre-number "$(< "$prefile")") x=$($snapper_cmd "$(truncate_description $POST_DESCRIPTION)" --pre-number "$(< "$prefile")")
printf "==> %s: %s\n" "$CONFIG" "$x" printf "==> %s: %s\n" "$CONFIG" "$x"
rm -f "$prefile" rm -f "$prefile"