forked from mirrored-repos/manjaro-tools
remove nspawn
This commit is contained in:
parent
3efef3f0b1
commit
9b252b0be7
5 changed files with 204 additions and 250 deletions
2
PKGBUILD
2
PKGBUILD
|
@ -12,7 +12,7 @@ makedepends=('git')
|
|||
provides=('devtools' 'arch-install-scripts' 'manjaro-tools')
|
||||
conflicts=('devtools' 'arch-install-scripts' 'manjaro-tools')
|
||||
backup=('etc/manjaro-tools/manjaro-tools.conf')
|
||||
source=("git+$url.git")
|
||||
source=("git+$url.git#branch=devel")
|
||||
sha256sums=('SKIP')
|
||||
|
||||
pkgver() {
|
||||
|
|
|
@ -15,13 +15,13 @@ if [[ -r @libdir@/messages.sh ]];then
|
|||
source @libdir@/messages.sh
|
||||
fi
|
||||
|
||||
if [[ -r @libdir@/build-api.sh ]];then
|
||||
source @libdir@/build-api.sh
|
||||
fi
|
||||
# if [[ -r @libdir@/build-api.sh ]];then
|
||||
# source @libdir@/build-api.sh
|
||||
# fi
|
||||
|
||||
manjaro_tools_conf='@sysconfdir@/manjaro-tools.conf'
|
||||
|
||||
if [[ -f ${manjaro_tools_conf} ]]; then
|
||||
if [[ -r ${manjaro_tools_conf} ]]; then
|
||||
source ${manjaro_tools_conf}
|
||||
fi
|
||||
|
||||
|
@ -31,13 +31,43 @@ else
|
|||
profiledir='@sysconfdir@/sets'
|
||||
fi
|
||||
|
||||
create_set(){
|
||||
msg "Creating [${profiledir}/${name}.set] ..."
|
||||
if [[ -f ${profiledir}/${name}.set ]];then
|
||||
msg2 "Backing up ${profiledir}/${name}.set.orig"
|
||||
mv "${profiledir}/${name}.set" "${profiledir}/${name}.set.orig"
|
||||
fi
|
||||
local list=$(find * -maxdepth 0 -type d | sort)
|
||||
for item in ${list[@]};do
|
||||
cd $item
|
||||
if [[ -f PKGBUILD ]];then
|
||||
msg2 "Adding ${item##*/}"
|
||||
echo ${item##*/} >> ${profiledir}/${name}.set || break
|
||||
fi
|
||||
cd ..
|
||||
done
|
||||
}
|
||||
|
||||
remove_set(){
|
||||
msg "Removing [${profiledir}/${name}.set] ..."
|
||||
rm ${profiledir}/${name}.set
|
||||
}
|
||||
|
||||
show_set(){
|
||||
local list=$(cat ${profiledir}/${name}.set)
|
||||
msg "Content of [${profiledir}/${name}.set] ..."
|
||||
for item in ${list[@]}; do
|
||||
msg2 "$item"
|
||||
done
|
||||
}
|
||||
|
||||
run(){
|
||||
if ${create};then
|
||||
create_set
|
||||
elif ${remove};then
|
||||
remove_set
|
||||
elif ${display};then
|
||||
display_set
|
||||
show_set
|
||||
else
|
||||
msg "Available sets: ${profiles}"
|
||||
exit 1
|
||||
|
|
279
bin/mkchroot.in
279
bin/mkchroot.in
|
@ -18,206 +18,145 @@ if [[ -r @libdir@/mount-api.sh ]];then
|
|||
source @libdir@/mount-api.sh
|
||||
fi
|
||||
|
||||
CHROOT_VERSION='v3'
|
||||
# if [[ -r @libdir@/build-api.sh ]];then
|
||||
# source @libdir@/build-api.sh
|
||||
# fi
|
||||
|
||||
RUN=''
|
||||
NOCOPY='n'
|
||||
# CMD=''
|
||||
# NOCOPY='n'
|
||||
|
||||
working_dir=''
|
||||
chrootdir=''
|
||||
branch='stable'
|
||||
|
||||
APPNAME=$(basename "${0}")
|
||||
|
||||
# check for systemd running on build system
|
||||
if [[ -d /run/systemd ]];then
|
||||
nosystemd=false
|
||||
else
|
||||
nosystemd=true
|
||||
fi
|
||||
|
||||
# usage: usage <exitvalue>
|
||||
usage() {
|
||||
echo "Usage: ${APPNAME} [options] working-dir [package-list | app]"
|
||||
echo ' options:'
|
||||
echo ' -r <app> Run "app" within the context of the chroot'
|
||||
echo ' -u Update the chroot via pacman'
|
||||
echo ' -C <file> Location of a pacman config file'
|
||||
echo ' -M <file> Location of a makepkg config file'
|
||||
echo ' -S <file> Location of a pacman-mirrors config file'
|
||||
echo ' -n Do not copy config files into the chroot'
|
||||
echo ' -c <dir> Set pacman cache'
|
||||
echo ' -b <branch> Set repository branch'
|
||||
echo ' -h This message'
|
||||
exit 1
|
||||
echo "Usage: ${APPNAME} [options] working-dir [package-list | app]"
|
||||
echo ' options:'
|
||||
echo ' -r <app> Run "app" within the context of the chroot'
|
||||
# echo ' -u Update the chroot via pacman'
|
||||
echo ' -C <file> Location of a pacman config file'
|
||||
echo ' -M <file> Location of a makepkg config file'
|
||||
echo ' -S <file> Location of a pacman-mirrors config file'
|
||||
# echo ' -n Do not copy config files into the chroot'
|
||||
echo ' -c <dir> Set pacman cache'
|
||||
echo ' -b <branch> Set repository branch'
|
||||
echo ' -h This message'
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts 'r:ufnhC:M:S:c:b:' arg; do
|
||||
case "${arg}" in
|
||||
r) RUN="$OPTARG" ;;
|
||||
u) RUN='pacman -Syu --noconfirm' ;;
|
||||
C) pac_conf="$OPTARG" ;;
|
||||
M) makepkg_conf="$OPTARG" ;;
|
||||
n) NOCOPY='y' ;;
|
||||
c) cache_dir="$OPTARG" ;;
|
||||
b) branch="$OPTARG" ;;
|
||||
S) mirrors_conf="$OPTARG" ;;
|
||||
h|?) usage ;;
|
||||
*) error "invalid argument '${arg}'"; usage ;;
|
||||
esac
|
||||
# orig_argv=("$@")
|
||||
|
||||
while getopts 'hC:M:S:c:b:' arg; do
|
||||
case "${arg}" in
|
||||
# r) CMD="$OPTARG" ;;
|
||||
# u) CMD='pacman -Syu --noconfirm' ;;
|
||||
C) pac_conf="$OPTARG" ;;
|
||||
M) makepkg_conf="$OPTARG" ;;
|
||||
# n) NOCOPY='y' ;;
|
||||
c) cache_dir="$OPTARG" ;;
|
||||
b) branch="$OPTARG" ;;
|
||||
S) mirrors_conf="$OPTARG" ;;
|
||||
h|?) usage ;;
|
||||
*) error "invalid argument '${arg}'"; usage ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if (( $EUID != 0 )); then
|
||||
die 'This script must be run as root.'
|
||||
fi
|
||||
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
if [[ -z $RUN ]] && (( $# < 2 )); then
|
||||
die 'You must specify a directory and one or more packages.'
|
||||
elif (( $# < 1 )); then
|
||||
die 'You must specify a directory.'
|
||||
# check_root "$0" "${orig_argv[@]}"
|
||||
|
||||
if (( $EUID != 0 )); then
|
||||
die 'This script must be run as root.'
|
||||
fi
|
||||
|
||||
working_dir="$(readlink -f ${1})"
|
||||
|
||||
(( $# < 2 )) && die 'You must specify a directory and one or more packages.'
|
||||
|
||||
# if [[ -z $CMD ]] && (( $# < 2 )); then
|
||||
# die 'You must specify a directory and one or more packages.'
|
||||
# elif (( $# < 1 )); then
|
||||
# die 'You must specify a directory.'
|
||||
# fi
|
||||
|
||||
chrootdir="$(readlink -f ${1})"
|
||||
shift 1
|
||||
|
||||
[[ -z $working_dir ]] && die 'Please specify a working directory.'
|
||||
[[ -z $chrootdir ]] && die 'Please specify a working directory.'
|
||||
|
||||
if [[ -z $cache_dir ]]; then
|
||||
cache_dirs=($(pacman -v $cache_conf 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g'))
|
||||
else
|
||||
cache_dirs=(${cache_dir})
|
||||
fi
|
||||
|
||||
# Get host mirror
|
||||
host_mirror=$(pacman -Sddp extra/devtools 2>/dev/null | sed -E "s#(.*/)(.*/)extra/.*#\1${branch}/\$repo/\$arch#")
|
||||
if echo "${host_mirror}" | grep -q 'file://'; then
|
||||
host_mirror_path=$(echo "${host_mirror}" | sed -E 's#file://(/.*)/\$repo/\$arch#\1#g')
|
||||
fi
|
||||
|
||||
# {{{ functions
|
||||
build_mount_args() {
|
||||
local p
|
||||
declare -g mount_args=()
|
||||
|
||||
if [[ -n $host_mirror_path ]]; then
|
||||
printf -v p '%q' "$host_mirror_path"
|
||||
mount_args+=(--bind-ro="$p")
|
||||
fi
|
||||
|
||||
printf -v p '%q' "${cache_dirs[0]}"
|
||||
mount_args+=(--bind="$p")
|
||||
|
||||
for cache_dir in ${cache_dirs[@]:1}; do
|
||||
printf -v p '%q' "$cache_dir"
|
||||
mount_args+=(--bind-ro="$p")
|
||||
done
|
||||
get_cache_dirs(){
|
||||
local cache_dirs
|
||||
if [[ -z ${cache_dir} ]]; then
|
||||
cache_dirs=($(pacman -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g'))
|
||||
else
|
||||
cache_dirs=("${cache_dir}")
|
||||
fi
|
||||
echo ${cache_dirs[@]}
|
||||
}
|
||||
|
||||
copy_hostconf () {
|
||||
cp -a /etc/pacman.d/gnupg "${working_dir}/etc/pacman.d"
|
||||
echo "Server = ${host_mirror}" > ${working_dir}/etc/pacman.d/mirrorlist
|
||||
sed -i -e "s|^.*Branch=.*|Branch=${branch}|" ${working_dir}/etc/pacman-mirrors.conf
|
||||
|
||||
if [[ -n $pac_conf && $NOCOPY = 'n' ]]; then
|
||||
cp ${pac_conf} ${working_dir}/etc/pacman.conf
|
||||
fi
|
||||
cp -a /etc/pacman.d/gnupg "${chrootdir}/etc/pacman.d"
|
||||
|
||||
[[ -n $pac_conf ]] && cp $pac_conf "${chrootdir}/etc/pacman.conf"
|
||||
[[ -n $makepkg_conf ]] && cp $makepkg_conf "${chrootdir}/etc/makepkg.conf"
|
||||
[[ -n $mirrors_conf ]] && cp ${mirrors_conf} "${chrootdir}/etc/pacman-mirrors.conf"
|
||||
|
||||
host_mirror=$(echo "$host_mirror" | sed -E "s#/branch/#/${branch}/#")
|
||||
echo "Server = $host_mirror" >"${chrootdir}/etc/pacman.d/mirrorlist"
|
||||
sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n $(get_cache_dirs))|g" -i "${chrootdir}/etc/pacman.conf"
|
||||
|
||||
if [[ -n $makepkg_conf && $NOCOPY = 'n' ]]; then
|
||||
cp ${makepkg_conf} ${working_dir}/etc/makepkg.conf
|
||||
fi
|
||||
|
||||
if [[ -n $mirrors_conf && $NOCOPY = 'n' ]]; then
|
||||
cp ${mirrors_conf} ${working_dir}/etc/pacman-mirrors.conf
|
||||
sed -i -e "s|^.*Branch=.*|Branch=${branch}|" ${working_dir}/etc/pacman-mirrors.conf
|
||||
fi
|
||||
|
||||
sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" -i ${working_dir}/etc/pacman.conf
|
||||
}
|
||||
|
||||
chroot_lock () {
|
||||
# Only reopen the FD if it wasn't handed to us
|
||||
if [[ $(readlink -f /dev/fd/9) != "${working_dir}.lock" ]]; then
|
||||
exec 9>"${working_dir}.lock"
|
||||
fi
|
||||
# Only reopen the FD if it wasn't handed to us
|
||||
if [[ $(readlink -f /dev/fd/9) != "${chrootdir}.lock" ]]; then
|
||||
exec 9>"${chrootdir}.lock"
|
||||
fi
|
||||
|
||||
# Lock the chroot. Take note of the FD number.
|
||||
if ! flock -n 9; then
|
||||
stat_busy "Locking chroot"
|
||||
flock 9
|
||||
stat_done
|
||||
fi
|
||||
# Lock the chroot. Take note of the FD number.
|
||||
if ! flock -n 9; then
|
||||
stat_busy "Locking chroot"
|
||||
flock 9
|
||||
stat_done
|
||||
fi
|
||||
}
|
||||
|
||||
chroot_run() {
|
||||
local dir=$1
|
||||
shift
|
||||
if ${nosystemd};then
|
||||
chroot "${dir}" "${@}"
|
||||
else
|
||||
systemd-nspawn -D "${dir}" "${mount_args[@]}" -- ${@} 2>/dev/null
|
||||
fi
|
||||
}
|
||||
mk_chroot(){
|
||||
if [[ -e ${chrootdir} ]]; then
|
||||
die "Working directory '${chrootdir}' already exists"
|
||||
fi
|
||||
|
||||
# }}}
|
||||
mkdir -p "${chrootdir}"
|
||||
|
||||
if [[ "$(stat -f -c %T "${chrootdir}")" == btrfs ]]; then
|
||||
rmdir "${chrootdir}"
|
||||
if ! btrfs subvolume create "${chrootdir}"; then
|
||||
die "Couldn't create subvolume for '${chrootdir}'"
|
||||
fi
|
||||
chmod 0755 "${chrootdir}"
|
||||
fi
|
||||
|
||||
chroot_lock
|
||||
|
||||
pacargs=("${cache_dirs[@]/#/--cachedir=}")
|
||||
if [[ -n $pac_conf ]]; then
|
||||
pacargs+=("--config=${pac_conf}")
|
||||
fi
|
||||
|
||||
if ! basestrap -GMcd "${chrootdir}" "${pacargs[@]}" "$@"; then
|
||||
die 'Failed to install all packages'
|
||||
fi
|
||||
|
||||
printf '%s.UTF-8 UTF-8\n' en_US de_DE > "${chrootdir}/etc/locale.gen"
|
||||
chroot "${chrootdir}" locale-gen
|
||||
echo 'LANG=C' > "${chrootdir}/etc/locale.conf"
|
||||
|
||||
copy_hostconf
|
||||
|
||||
echo "${version}" > "${chrootdir}/.manjaro-chroot"
|
||||
}
|
||||
|
||||
umask 0022
|
||||
|
||||
if [[ -n $RUN ]]; then
|
||||
# run chroot {{{
|
||||
#Sanity check
|
||||
if [[ ! -f "${working_dir}/.manjaro-chroot" ]]; then
|
||||
die "'${working_dir}' does not appear to be a Manjaro chroot."
|
||||
elif [[ $(cat "${working_dir}/.manjaro-chroot") != ${CHROOT_VERSION} ]]; then
|
||||
die "'${working_dir}' is not compatible with ${APPNAME} version ${CHROOT_VERSION}. Please rebuild."
|
||||
fi
|
||||
|
||||
chroot_lock
|
||||
if ${nosystemd};then
|
||||
api_fs_mount "${working_dir}"
|
||||
track_mount /etc/resolv.conf "${working_dir}/etc/resolv.conf" --bind
|
||||
track_mount ${cache_dirs[0]} "${working_dir}/${cache_dirs[0]}" --bind
|
||||
else
|
||||
build_mount_args
|
||||
fi
|
||||
copy_hostconf
|
||||
|
||||
chroot_run "${working_dir}" ${RUN}
|
||||
|
||||
# }}}
|
||||
else
|
||||
# {{{ build chroot
|
||||
if [[ -e $working_dir ]]; then
|
||||
die "Working directory '${working_dir}' already exists"
|
||||
fi
|
||||
|
||||
mkdir -p "${working_dir}"
|
||||
|
||||
if [[ "$(stat -f -c %T "${working_dir}")" == btrfs ]]; then
|
||||
rmdir "${working_dir}"
|
||||
if ! btrfs subvolume create "${working_dir}"; then
|
||||
die "Couldn't create subvolume for '${working_dir}'"
|
||||
fi
|
||||
chmod 0755 "${working_dir}"
|
||||
fi
|
||||
|
||||
chroot_lock
|
||||
|
||||
pacargs=("${cache_dirs[@]/#/--cachedir=}")
|
||||
if [[ -n $pac_conf ]]; then
|
||||
pacargs+=("--config=${pac_conf}")
|
||||
fi
|
||||
|
||||
if ! basestrap -GMcd "${working_dir}" "${pacargs[@]}" "$@"; then
|
||||
die 'Failed to install all packages'
|
||||
fi
|
||||
|
||||
printf '%s.UTF-8 UTF-8\n' en_US de_DE > "${working_dir}/etc/locale.gen"
|
||||
chroot_run "${working_dir}" locale-gen
|
||||
echo 'LANG=C' > "${working_dir}/etc/locale.conf"
|
||||
|
||||
copy_hostconf
|
||||
|
||||
echo "${CHROOT_VERSION}" > "${working_dir}/.manjaro-chroot"
|
||||
# }}}
|
||||
fi
|
||||
mk_chroot
|
||||
|
|
124
lib/build-api.sh
124
lib/build-api.sh
|
@ -42,6 +42,18 @@ prepare_dir(){
|
|||
fi
|
||||
}
|
||||
|
||||
clean_dir(){
|
||||
msg2 "Cleaning $1 ..."
|
||||
rm -r $1/*
|
||||
}
|
||||
|
||||
git_clean(){
|
||||
msg2 "Cleaning $(pwd) ..."
|
||||
git clean -dfx$1
|
||||
}
|
||||
|
||||
####chroot controller######
|
||||
|
||||
chroot_clean(){
|
||||
for copy in "${chrootdir}"/*; do
|
||||
[[ -d "${copy}" ]] || continue
|
||||
|
@ -64,41 +76,61 @@ chroot_clean(){
|
|||
rm -rf --one-file-system "${chrootdir}"
|
||||
}
|
||||
|
||||
clean_dir(){
|
||||
msg2 "Cleaning $1 ..."
|
||||
rm -r $1/*
|
||||
}
|
||||
|
||||
git_clean(){
|
||||
msg2 "Cleaning $(pwd) ..."
|
||||
git clean -dfx$1
|
||||
}
|
||||
|
||||
chroot_create(){
|
||||
mkdir -p "${chrootdir}"
|
||||
setarch "${arch}" \
|
||||
mkchroot ${mkchroot_args[*]} ${chrootdir}/root ${base_packages[*]} || abort
|
||||
}
|
||||
|
||||
chroot_update(){
|
||||
setarch "${arch}" \
|
||||
mkchroot ${mkchroot_args[*]} -u ${chrootdir}/$(get_user) || abort
|
||||
}
|
||||
|
||||
# chroot_update(){
|
||||
# setarch "${arch}" \
|
||||
# mkchroot ${mkchroot_args[*]} -u ${chrootdir}/$(get_user) || abort
|
||||
# }
|
||||
|
||||
chroot_init(){
|
||||
if [[ ! -d "${chrootdir}" ]]; then
|
||||
msg "Creating chroot for [${branch}] (${arch})..."
|
||||
chroot_create
|
||||
elif ${clean_first};then
|
||||
else ${clean_first};then
|
||||
msg "Creating chroot for [${branch}] (${arch})..."
|
||||
chroot_clean
|
||||
chroot_create
|
||||
else
|
||||
msg "Updating chroot for [${branch}] (${arch})..."
|
||||
chroot_update
|
||||
# else
|
||||
# msg "Updating chroot for [${branch}] (${arch})..."
|
||||
# chroot_update
|
||||
fi
|
||||
}
|
||||
|
||||
chroot_build(){
|
||||
if ${is_profile};then
|
||||
msg "Start building profile: [${profile}]"
|
||||
for pkg in $(cat ${profiledir}/${profile}.set); do
|
||||
cd $pkg
|
||||
if [[ $pkg == 'eudev' ]] || [[ $pkg == 'lib32-eudev' ]]; then
|
||||
blacklist_pkg
|
||||
fi
|
||||
setarch "${arch}" \
|
||||
mkchrootpkg ${mkchrootpkg_args[*]} -- "${makepkg_args[*]}" || break
|
||||
move_pkg "${pkg}"
|
||||
cd ..
|
||||
done
|
||||
msg "Finished building profile: [${profile}]"
|
||||
else
|
||||
cd ${profile}
|
||||
if [[ ${profile} == 'eudev' ]] || [[ ${profile} == 'lib32-eudev' ]]; then
|
||||
blacklist_pkg
|
||||
fi
|
||||
setarch "${arch}" \
|
||||
mkchrootpkg ${mkchrootpkg_args[*]} -- "${makepkg_args[*]}" || abort
|
||||
move_pkg "${profile}"
|
||||
cd ..
|
||||
fi
|
||||
}
|
||||
|
||||
####end chroot controller######
|
||||
|
||||
|
||||
eval_profile(){
|
||||
eval "case ${profile} in
|
||||
$(get_profiles)) is_profile=true ;;
|
||||
|
@ -127,32 +159,6 @@ move_pkg(){
|
|||
mv *.${ext} ${pkgdir}/
|
||||
}
|
||||
|
||||
chroot_build(){
|
||||
if ${is_profile};then
|
||||
msg "Start building profile: [${profile}]"
|
||||
for pkg in $(cat ${profiledir}/${profile}.set); do
|
||||
cd $pkg
|
||||
if [[ $pkg == 'eudev' ]] || [[ $pkg == 'lib32-eudev' ]]; then
|
||||
blacklist_pkg
|
||||
fi
|
||||
setarch "${arch}" \
|
||||
mkchrootpkg ${mkchrootpkg_args[*]} -- "${makepkg_args[*]}" || break
|
||||
move_pkg "${pkg}"
|
||||
cd ..
|
||||
done
|
||||
msg "Finished building profile: [${profile}]"
|
||||
else
|
||||
cd ${profile}
|
||||
if [[ ${profile} == 'eudev' ]] || [[ ${profile} == 'lib32-eudev' ]]; then
|
||||
blacklist_pkg
|
||||
fi
|
||||
setarch "${arch}" \
|
||||
mkchrootpkg ${mkchrootpkg_args[*]} -- "${makepkg_args[*]}" || abort
|
||||
move_pkg "${profile}"
|
||||
cd ..
|
||||
fi
|
||||
}
|
||||
|
||||
display_settings(){
|
||||
msg "manjaro-tools version: ${version}"
|
||||
|
||||
|
@ -189,33 +195,3 @@ display_settings(){
|
|||
msg2 "${profile}"
|
||||
fi
|
||||
}
|
||||
|
||||
create_set(){
|
||||
msg "Creating [${profiledir}/${name}.set] ..."
|
||||
if [[ -f ${profiledir}/${name}.set ]];then
|
||||
msg2 "Backing up ${profiledir}/${name}.set.orig"
|
||||
mv "${profiledir}/${name}.set" "${profiledir}/${name}.set.orig"
|
||||
fi
|
||||
local list=$(find * -maxdepth 0 -type d | sort)
|
||||
for item in ${list[@]};do
|
||||
cd $item
|
||||
if [[ -f PKGBUILD ]];then
|
||||
msg2 "Adding ${item##*/}"
|
||||
echo ${item##*/} >> ${profiledir}/${name}.set || break
|
||||
fi
|
||||
cd ..
|
||||
done
|
||||
}
|
||||
|
||||
remove_set(){
|
||||
msg "Removing [${profiledir}/${name}.set] ..."
|
||||
rm ${profiledir}/${name}.set
|
||||
}
|
||||
|
||||
display_set(){
|
||||
local list=$(cat ${profiledir}/${name}.set)
|
||||
msg "Content of [${profiledir}/${name}.set] ..."
|
||||
for item in ${list[@]}; do
|
||||
msg2 "$item"
|
||||
done
|
||||
}
|
||||
|
|
|
@ -159,3 +159,12 @@ dm_name_for_devnode() {
|
|||
error 'Failed to resolve device mapper name for: %s' "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# check_root() {
|
||||
# (( EUID == 0 )) && return
|
||||
# if type -P sudo >/dev/null; then
|
||||
# exec sudo -- "$@"
|
||||
# else
|
||||
# exec su root -c "$(printf ' %q' "$@")"
|
||||
# fi
|
||||
# }
|
||||
|
|
Loading…
Reference in a new issue