2013-07-04 08:41:29 +02:00
|
|
|
#!/usr/bin/env bash
|
2023-01-27 08:22:33 +01:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
2009-04-26 15:09:49 +02:00
|
|
|
#
|
|
|
|
# copy-mointpoint.sh - copy recursivly a mountpoint using tar
|
|
|
|
# by Tobias Powalowski <tpowa@archlinux.org>
|
|
|
|
# usage(exitvalue)
|
|
|
|
# outputs a usage message and exits with value
|
2023-01-09 18:28:06 +01:00
|
|
|
_APPNAME=$(basename "${0}")
|
|
|
|
_usage()
|
2009-04-26 15:09:49 +02:00
|
|
|
{
|
2023-02-07 19:35:34 +01:00
|
|
|
echo -e "\e[1mWelcome to \e[36mARCHBOOT\e[0m\e[1m - COPY MOUNTPOINT:\e[0m"
|
|
|
|
echo -e "\e[1m--------------------------------------\e[0m"
|
2009-04-26 15:09:49 +02:00
|
|
|
echo "- Copy mountpoint recursivly from one mountpoint to an other one,"
|
|
|
|
echo " using tar utility."
|
2023-02-07 19:35:34 +01:00
|
|
|
echo -e "- For system copying start with mounted \e[1m/\e[0m and then invoke this script"
|
|
|
|
echo -e " for each additional mountpoint eg. \e[1m/boot\e[0m or \e[1m/home\e[0m."
|
2009-04-26 15:09:49 +02:00
|
|
|
echo ""
|
2023-02-07 19:35:34 +01:00
|
|
|
echo -e "usage: \e[1m${_APPNAME} <oldmountpoint> <newmountpoint>\e[0m"
|
2022-01-21 11:11:50 +01:00
|
|
|
exit "$1"
|
2009-04-26 15:09:49 +02:00
|
|
|
}
|
|
|
|
##################################################
|
|
|
|
if [ $# -ne 2 ]; then
|
2023-01-09 18:28:06 +01:00
|
|
|
_usage 1
|
2009-04-26 15:09:49 +02:00
|
|
|
fi
|
2023-01-09 18:28:06 +01:00
|
|
|
_NEWMOUNTPOINT="${2}"
|
|
|
|
_OLDMOUNTPOINT="${1}"
|
|
|
|
tar -C "${_OLDMOUNTPOINT}" -clpf - . | tar -C "${_NEWMOUNTPOINT}" -vxlspf -
|