#!/bin/sh # inspired by https://github.com/umiddelb/z2d/tree/master/pine64 display_usage() { echo "$0 " } SD_DEV=$1 SD_MOUNT_POINT=$2 [ "x$1" == "x" ] && display_usage && exit [ "x$2" == "x" ] && display_usage && exit [[ "x$UID" != "x0" ]] && echo "run as root" && exit if $(df | grep /$ | grep -q "^$SD_DEV"); then echo "Target and current system device are the same. Can't do that!" exit fi SIMPLEIMAGE_VERSION=${SIMPLEIMAGE_VERSION:-"latest"} LINUX_VERSION=${LINUX_VERSION:-"latest"} SLACKWARE_VERSION=${SLACKWARE_VERSION:-"14.2"} SLACKWARE_MINIROOTFS_VERSION=${SLACKWARE_MINIROOTFS_VERSION:-"01Jul16"} echo "Going further will wipe ${SD_DEV} and you _will_ lose all data on it !" echo "/!\\ LAST CHANCE TO HIT Ctrl-C /!\\" read wget -c https://www.stdin.xyz/downloads/people/longsleep/pine64-images/simpleimage-pine64-${SIMPLEIMAGE_VERSION}.img.xz unxz simpleimage-pine64-${SIMPLEIMAGE_VERSION}.img.xz dd if=simpleimage-pine64-${SIMPLEIMAGE_VERSION}.img of=$SD_DEV bs=1024 /bin/echo -e "d\n2\nn\np\n2\n143360\n\nw\n" | sudo fdisk $SD_DEV sudo mkfs.ext4 -O ^has_journal -b 4096 -L rootfs -U deadbeef-dead-beef-dead-beefdeadbeef ${SD_DEV}p2 mount ${SD_DEV}p2 $SD_MOUNT_POINT mkdir -p $SD_MOUNT_POINT/bootenv mount ${SD_DEV}p1 $SD_MOUNT_POINT/bootenv wget -c http://slackware.uk/slackwarearm/slackwarearm-devtools/minirootfs/roots/slack-${SLACKWARE_VERSION}-miniroot_${SLACKWARE_MINIROOTFS_VERSION}.tar.xz tar --numeric-owner -C $SD_MOUNT_POINT/ -xpJf slack-${SLACKWARE_VERSION}-miniroot_${SLACKWARE_MINIROOTFS_VERSION}.tar.xz wget -c https://www.stdin.xyz/downloads/people/longsleep/pine64-images/linux/linux-pine64-${LINUX_VERSION}.tar.xz tar --numeric-owner -C $SD_MOUNT_POINT/ -xpJf linux-pine64-${LINUX_VERSION}.tar.xz cp -R $SD_MOUNT_POINT/boot/* $SD_MOUNT_POINT/bootenv/ cat < $SD_MOUNT_POINT/root/update_kernel.sh #!/bin/sh wget -c https://www.stdin.xyz/downloads/people/longsleep/pine64-images/linux/linux-pine64-${LINUX_VERSION}.tar.xz tar --numeric-owner -C / -xpJf linux-pine64-${LINUX_VERSION}.tar.xz rm linux-pine64-${LINUX_VERSION}.tar.xz cp -R /boot/* /bootenv/ EOF chmod +x $SD_MOUNT_POINT/root/update_kernel.sh cat < $SD_MOUNT_POINT/etc/modprobe.d/blacklist 8723bs_vq0 EOF cat <> $SD_MOUNT_POINT/etc/rc.d/rc.modprobe.local /sbin/modprobe 8723bs EOF umount $SD_MOUNT_POINT/bootenv umount $SD_MOUNT_POINT curl -s ftp://ftp.arm.slackware.com/slackwarearm/slackwarearm-devtools/minirootfs/roots/slack-${SLACKWARE_VERSION}-miniroot_details.txt | grep -C1 "User" sync