mkrootfs: added -b, -c and -r options to set system pkg, cachedir and repos respectively.
This commit is contained in:
parent
1980b64954
commit
e056d3944c
@ -26,11 +26,11 @@
|
|||||||
|
|
||||||
readonly PROGNAME=$(basename $0)
|
readonly PROGNAME=$(basename $0)
|
||||||
readonly ARCH=$(uname -m)
|
readonly ARCH=$(uname -m)
|
||||||
readonly PKGBASE="base-system"
|
|
||||||
readonly VOIDRSAPUBKEY="60:ae:0c:d6:f0:95:17:80:bc:93:46:7a:89:af:a3:2d"
|
readonly VOIDRSAPUBKEY="60:ae:0c:d6:f0:95:17:80:bc:93:46:7a:89:af:a3:2d"
|
||||||
|
|
||||||
trap 'die "Interrupted! exiting..."' INT TERM HUP
|
trap 'die "Interrupted! exiting..."' INT TERM HUP
|
||||||
|
|
||||||
|
|
||||||
info_msg() {
|
info_msg() {
|
||||||
printf "\033[1m$@\n\033[m"
|
printf "\033[1m$@\n\033[m"
|
||||||
}
|
}
|
||||||
@ -49,10 +49,13 @@ Usage: $PROGNAME [options] <platform>
|
|||||||
Supported platforms: cubieboard2, odroid-u2, rpi
|
Supported platforms: cubieboard2, odroid-u2, rpi
|
||||||
|
|
||||||
Options
|
Options
|
||||||
|
-b <syspkg> Set an alternative base-system package (defaults to base-system)
|
||||||
|
-c <dir> Set XBPS cache directory (defaults to /var/cache/xbps)
|
||||||
-C <file> Full path to the XBPS configuration file
|
-C <file> Full path to the XBPS configuration file
|
||||||
-h Show this help
|
-h Show this help
|
||||||
-k <dir> Full path to a directory with the XBPS RSA public keys for repositories
|
-k <dir> Full path to a directory with the XBPS RSA public keys for repositories
|
||||||
-p <pkgs> Additional packages to install into the rootfs (separated by blanks)
|
-p <pkgs> Additional packages to install into the rootfs (separated by blanks)
|
||||||
|
-r <repo> Set XBPS repository (may be set multiple times)
|
||||||
-V Show version
|
-V Show version
|
||||||
_EOF
|
_EOF
|
||||||
}
|
}
|
||||||
@ -97,15 +100,20 @@ register_binfmt() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
: ${XBPS_CACHEDIR:=--cachedir=/var/cache/xbps}
|
||||||
|
: ${PKGBASE:=base-system}
|
||||||
#
|
#
|
||||||
# main()
|
# main()
|
||||||
#
|
#
|
||||||
while getopts "C:hk:p:V" opt; do
|
while getopts "b:C:hk:p:r:V" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
|
b) PKGBASE="$OPTARG";;
|
||||||
C) XBPS_CONFFILE="-C $OPTARG";;
|
C) XBPS_CONFFILE="-C $OPTARG";;
|
||||||
|
c) XBPS_CACHEDIR="--cachedir=$OPTARG";;
|
||||||
h) usage; exit 0;;
|
h) usage; exit 0;;
|
||||||
k) KEYSDIR="$OPTARG";;
|
k) KEYSDIR="$OPTARG";;
|
||||||
p) EXTRA_PKGS="$OPTARG";;
|
p) EXTRA_PKGS="$OPTARG";;
|
||||||
|
r) XBPS_REPOSITORY="--repository=$OPTARG $XBPS_REPOSITORY";;
|
||||||
V) echo "$PROGNAME @@MKLIVE_VERSION@@"; exit 0;;
|
V) echo "$PROGNAME @@MKLIVE_VERSION@@"; exit 0;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@ -151,8 +159,8 @@ fi
|
|||||||
mkdir -p $rootfs/var/db/xbps/keys
|
mkdir -p $rootfs/var/db/xbps/keys
|
||||||
cp $KEYSDIR/${VOIDRSAPUBKEY}.plist $rootfs/var/db/xbps/keys
|
cp $KEYSDIR/${VOIDRSAPUBKEY}.plist $rootfs/var/db/xbps/keys
|
||||||
|
|
||||||
run_cmd "xbps-install -S $XBPS_CONFFILE -r $rootfs"
|
run_cmd_target "xbps-install -S $XBPS_CONFFILE $XBPS_CACHEDIR $XBPS_REPOSITORY -r $rootfs"
|
||||||
run_cmd "xbps-query -R -r $rootfs $XBPS_CONFFILE -ppkgver $PKGBASE"
|
run_cmd_target "xbps-query -R -r $rootfs $XBPS_CONFFILE $XBPS_CACHEDIR $XBPS_REPOSITORY -ppkgver $PKGBASE"
|
||||||
|
|
||||||
chmod 755 $rootfs
|
chmod 755 $rootfs
|
||||||
|
|
||||||
@ -163,7 +171,7 @@ mount_pseudofs
|
|||||||
#
|
#
|
||||||
# Install base-system to the rootfs directory.
|
# Install base-system to the rootfs directory.
|
||||||
#
|
#
|
||||||
run_cmd_target "xbps-install -S $XBPS_CONFFILE -r $rootfs -y ${PKGS}"
|
run_cmd_target "xbps-install -S $XBPS_CONFFILE $XBPS_CACHEDIR $XBPS_REPOSITORY -r $rootfs -y ${PKGS}"
|
||||||
|
|
||||||
# Enable en_US.UTF-8 locale and generate it into the target rootfs.
|
# Enable en_US.UTF-8 locale and generate it into the target rootfs.
|
||||||
LOCALE=en_US.UTF-8
|
LOCALE=en_US.UTF-8
|
||||||
@ -178,12 +186,16 @@ if [ -n "${_ARCH}" ]; then
|
|||||||
register_binfmt
|
register_binfmt
|
||||||
run_cmd "xbps-reconfigure -r $rootfs base-directories"
|
run_cmd "xbps-reconfigure -r $rootfs base-directories"
|
||||||
run_cmd "chroot $rootfs xbps-reconfigure shadow"
|
run_cmd "chroot $rootfs xbps-reconfigure shadow"
|
||||||
run_cmd "chroot $rootfs xbps-reconfigure systemd"
|
if [ "$PKGBASE" = "base-system" ]; then
|
||||||
|
run_cmd "chroot $rootfs xbps-reconfigure systemd"
|
||||||
|
fi
|
||||||
run_cmd "chroot $rootfs xbps-reconfigure -a"
|
run_cmd "chroot $rootfs xbps-reconfigure -a"
|
||||||
rmdir $rootfs/usr/lib32
|
rmdir $rootfs/usr/lib32
|
||||||
rm -f $rootfs/lib32 $rootfs/lib64 $rootfs/usr/lib64
|
rm -f $rootfs/lib32 $rootfs/lib64 $rootfs/usr/lib64
|
||||||
else
|
else
|
||||||
run_cmd "chroot $rootfs xbps-reconfigure systemd"
|
if [ "$PKGBASE" = "base-system" ]; then
|
||||||
|
run_cmd "chroot $rootfs xbps-reconfigure systemd"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -195,7 +207,7 @@ umount_pseudofs
|
|||||||
# Cleanup rootfs.
|
# Cleanup rootfs.
|
||||||
#
|
#
|
||||||
rm -f $rootfs/etc/.pwd.lock 2>/dev/null
|
rm -f $rootfs/etc/.pwd.lock 2>/dev/null
|
||||||
rm -rf $rootfs/var/cache/xbps 2>/dev/null
|
rm -rf $rootfs/var/cache/* 2>/dev/null
|
||||||
|
|
||||||
#
|
#
|
||||||
# Generate final tarball.
|
# Generate final tarball.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user