Skip to content

Commit

Permalink
Don't symlink linux kernel modules.
Browse files Browse the repository at this point in the history
Fixes #22, #21, and #19.
  • Loading branch information
wesbarnett committed Aug 16, 2018
1 parent 39dee2b commit 1dabe29
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 42 deletions.
21 changes: 0 additions & 21 deletions man8/snap-pac.8
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,6 @@ Number of characters to limit length of descriptions used for snapper.
Default is "72".
.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
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
Expand Down
21 changes: 0 additions & 21 deletions scripts/snap-pac
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,6 @@ truncate_description() {
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 trapkill SIGTERM SIGINT

Expand All @@ -97,11 +86,8 @@ read_config "$SNAPPAC_CONFIG_FILE"

readonly DESC_LIMIT=${DESC_LIMIT:-72}
readonly ABORT_ON_FAIL=${ABORT_ON_FAIL:-"no"}
readonly LINK_MODULES=${LINK_MODULES:-"no"}
readonly KERNEL_PACKAGE=${KERNEL_PACKAGE:-"linux"}

mapfile -t packages
kernel_updated=$(package_updated "$KERNEL_PACKAGE")

for CONFIG in $SNAPPER_CONFIGS; do

Expand Down Expand Up @@ -129,14 +115,7 @@ for CONFIG in $SNAPPER_CONFIGS; do
if [[ "$pre_or_post" == "pre" ]]; then
x=$($snapper_cmd "$(truncate_description $PRE_DESCRIPTION)")
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
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")")
printf "==> %s: %s\n" "$CONFIG" "$x"
rm -f "$prefile"
Expand Down

0 comments on commit 1dabe29

Please sign in to comment.