本论坛首发【老骥伏枥-鸡年大礼包】黑群晖6.02-8451版硬盘自启动,USB启动盘,系统救援
群晖 Synology / 教程分享 / 倒序浏览 © 著作权归作者本人所有
回帖数
4542
浏览数
59857
收藏数
187
使用道具 举报
#!/bin/sh # # The purpose of the script is to install the bootloader on # a usb key for Synology can be booted from usb key # #help screen if [ $# != 1 ]; then echo " standard use of script is: ./usb_inst.sh the script will install bootloader on usb key, it will not touch the partition tables and therefore please perserves data. possible options are: /dev/sd* usb key device name for Synology bootloader. example ./usb_inst.sh /dev/sdc2 " exit 1 fi #check if the device exist if [ ! -e $1 ]; then echo "$1 does not exist." exit 1 fi if [ ! -x /mnt/grub ]; then echo "There is not correct bootloader installer" exit 1 fi mount $1 /boot if [ $? -ne 0 ]; then echo "The usb device could not mounted" exit 1 fi cp -rf /mnt/boot /boot tmp_disk=$(echo $1 | sed "s/\([0-9]\)//g") grub-install --root-directory=/boot $tmp_disk if [ $? -ne 0 ]; then echo "install usb device bootloader fail" umount /boot exit 1 fi umount /boot echo "Generate usb key bootloader successful" exit 0 复制代码
本版积分规则 发表回复 回帖后跳转到最后一页
技术达人
主题
25
帖子
288
关注者
10
2026-1-12 01:58
2023-1-4 02:40
2021-2-13 08:32
2020-2-8 06:16
2020-1-23 03:44
手机扫描二维码快速访问本帖