2013-07-04 08:41:29 +02:00
|
|
|
#!/usr/bin/env bash
|
2023-08-11 17:19:18 +02:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2024-08-01 10:06:03 +02:00
|
|
|
# copy-mointpoint.sh - copy recursivly a mountpoint using tar
|
|
|
|
# by Tobias Powalowski <tpowa@archlinux.org>
|
2009-04-26 15:09:49 +02:00
|
|
|
# usage(exitvalue)
|
|
|
|
# outputs a usage message and exits with value
|
2024-07-30 21:33:26 +02:00
|
|
|
. /usr/lib/archboot/common.sh
|
2023-01-09 18:28:06 +01:00
|
|
|
_usage()
|
2009-04-26 15:09:49 +02:00
|
|
|
{
|
2024-08-01 10:30:36 +02:00
|
|
|
echo -e "\e[1m\e[36mArchboot\e[m\e[1m - Copy Mountpoint\e[m"
|
|
|
|
echo -e "\e[1m--------------------------\e[m"
|
2024-08-01 10:04:43 +02:00
|
|
|
echo "- Copy mountpoint recursivly from <oldmountpoint> to <newmountpoint>,"
|
|
|
|
echo -e " using the \e[1mtar\e[m utility."
|
2023-02-07 20:19:31 +01:00
|
|
|
echo -e "- For system copying start with mounted \e[1m/\e[m and then invoke this script"
|
|
|
|
echo -e " for each additional mountpoint eg. \e[1m/boot\e[m or \e[1m/home\e[m."
|
2009-04-26 15:09:49 +02:00
|
|
|
echo ""
|
2024-08-01 10:04:43 +02:00
|
|
|
echo -e "Usage: \e[1m${_BASENAME} <oldmountpoint> <newmountpoint>\e[m"
|
2023-04-24 07:02:39 +02:00
|
|
|
exit 0
|
2009-04-26 15:09:49 +02:00
|
|
|
}
|
|
|
|
##################################################
|
|
|
|
if [ $# -ne 2 ]; then
|
2023-04-24 07:02:39 +02:00
|
|
|
_usage
|
2009-04-26 15:09:49 +02:00
|
|
|
fi
|
2023-01-09 18:28:06 +01:00
|
|
|
_NEWMOUNTPOINT="${2}"
|
|
|
|
_OLDMOUNTPOINT="${1}"
|
2023-03-14 21:55:25 +01:00
|
|
|
tar -C "${_OLDMOUNTPOINT}" --hard-dereference -clpf - . | tar -C "${_NEWMOUNTPOINT}" -vxlspf -
|