++ideas for install any linux
This commit is contained in:
parent
56220ebaf6
commit
715dd03ab5
1 changed files with 38 additions and 3 deletions
|
@ -6,16 +6,51 @@
|
||||||
# Requirements:
|
# Requirements:
|
||||||
# The OS image needs to be in tar format and needs to contain grub
|
# The OS image needs to be in tar format and needs to contain grub
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
if [ $# -ne 2 ]; then
|
if [ $# -lt 2 ]; then
|
||||||
echo "$0 os-image.tar [usb|disk]"
|
echo "$0 os-image.tar [usb|disk] [target-usb-disk]"
|
||||||
echo "os-image.tar contains the OS"
|
echo "os-image.tar contains the OS"
|
||||||
echo "usb mode: create a bootable usb stick including this script to auto install to disk"
|
echo "usb mode: create a bootable usb stick including this script to auto install to disk"
|
||||||
echo "disk mode: actually install os-image.tar to the first disk"
|
echo "disk mode: actually install os-image.tar to the first disk"
|
||||||
|
echo ""
|
||||||
|
echo "In usb mode, specify the usb disk to install to"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
os=$1; shift
|
IMAGE=$1; shift
|
||||||
mode=$1; shift
|
mode=$1; shift
|
||||||
|
|
||||||
# isohybrid
|
# isohybrid
|
||||||
|
|
||||||
|
setup_usb() {
|
||||||
|
rootfs_tmpdir=$(mktemp -d)
|
||||||
|
|
||||||
|
sudo sfdisk "$DISK" <<EOF
|
||||||
|
label: dos
|
||||||
|
,,L
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sudo mkfs.ext4 -F ${DISK}1
|
||||||
|
sudo mount ${DISK}1 $rootfs_tmpdir
|
||||||
|
sudo tar xf $IMAGE -C $rootfs_tmpdir
|
||||||
|
|
||||||
|
for dir in dev proc sys; do
|
||||||
|
sudo mount --bind /${dir} ${rootfs_tmpdir}/${dir}
|
||||||
|
done
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_disk()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$mode" in
|
||||||
|
usb)
|
||||||
|
if [ $# -ne 1 ]; then echo "Specify usb disk to install to"; exit 1; fi
|
||||||
|
DISK=$1; shift
|
||||||
|
|
Loading…
Reference in a new issue