Shell Script Oluşturmak

DJ Rush

PADAVAN
4 Ocak 2017
134
139
151
macOS için shell script nasıl oluşturabilirim? Bulduğum bazı dosyalar var bunları çift tıklama ile script olarak kullanmak istiyorum.
Örneğin bu scripti:
#!/bin/bash
# Mount EFI
# @cecekpawon 10/24/2015 14:13 PM
# thrsh.net
gVer=1.6
gTITLE="Mount EFI v${gVer}"
gUname="cecekpawon"
gME="@${gUname} | thrsh.net"
gBase="OSXOLVED"
gRepo="https://github.com/${gUname}/${gBase}"
gRepoRAW="https://raw.githubusercontent.com/${gUname}/${gBase}/master"
gScriptName=${0##*/}
isdone() {
exit
}
C_MENU="\e[36m"
C_BLUE="\e[38;5;27m"
C_BLACK="\e[0m"
C_RED="\e[31m"
C_NUM="\e[33m"
gHEAD=`cat <<EOF
${C_MENU}============================================
${C_BLUE}${gTITLE} ${C_MENU}: ${C_RED}${gME}
${C_MENU}============================================
${C_MENU}Usages\t: ${C_BLUE}./${gScriptName} ${C_MENU}[${C_NUM}-Options${C_MENU}]
${C_MENU}\t\t: ${C_BLUE}./${gScriptName} ${C_NUM}-aou
${C_MENU}Options\t: ${C_NUM}-a${C_MENU}] auto-mount
${C_MENU}\t\t: ${C_NUM}-o${C_MENU}] auto-open
${C_MENU}\t\t: ${C_NUM}-u${C_MENU}] update-scripts
${C_MENU}--------------------------------------------
${C_MENU}Inspiration: Clover Configurator, #longlive!
${C_MENU}--------------------------------------------${C_BLACK}\n\n
EOF`
gMSG=`cat <<EOF
Please die!\n
EOF`
gAuto=0
gOpen=0
gUpdate=0
aDisk=()
aPar=()
aLabel=()
i=0
tabs -6
clear && printf "${gHEAD}"
aEFI=($(diskutil list | grep EFI | grep -o -e disk[[:digit:]]*s[[:digit:]]*))
gEFITotal=${#aEFI[@]}
if [[ $gEFITotal -eq 0 ]]; then
echo "Zero EFI partition detected!"
isdone
fi
while getopts :aAuUoO gOpt; do
case "${gOpt}" in
[aA]) gAuto=1;;
[uU]) gUpdate=1;;
[oO]) gOpen=1;;
esac
done
if [[ $gUpdate -ne 0 ]]; then
echo "Looking for updates .."
gTmp=$(curl -sS "${gRepoRAW}/versions.json" | awk '/'$gScriptName'/ {print $2}' | sed -e 's/[^0-9\.]//g')
if [[ $gTmp > $gVer ]]; then
echo "Update currently available (v${gTmp}) .."
if [[ -w "${0}" ]]; then
gBkp="${0}.bak"
gTmp="${0}.tmp"
echo "Create script backup: ${gBkp}"
curl -sS "${gRepoRAW}/${gScriptName}" -o "${gTmp}"
gStr=`cat ${gTmp}`
if [[ "${gStr}" =~ "bash" ]]; then
echo "Update successfully :))"
cp "${0}" "${gBkp}" && mv "${gTmp}" "${0}" && chmod +x "${0}"
read -p "Relaunch script now? [yY] " gChoose
case "${gChoose}" in
[yY]) exec "${0}" "${@}";;
esac
isdone
else
echo "Update failed :(("
fi
else
echo "Scripts read-only :(("
fi
else
echo "Scripts up-to-date! :))"
fi
printf "\n"
fi
gStr=""
gStartup="$(diskutil info / | awk '/Identifier/' | grep -o -e disk[[:digit:]]*)"
printf "`cat <<EOF
Getting EFI disks ..
Choose one from available devices:
[${C_BLUE}#${C_BLACK}] is current startup disk!
------+-----------+--------------------------
[#]\t| Partition\t| Label
------+-----------+--------------------------\n
EOF`"
for gArg in "${aEFI[@]}"
do
gDevice=$(echo "${gArg}" | grep -o -e disk[[:digit:]]*)
gInfo=$(diskutil info "${gDevice}" | grep 'Media Name:' | sed -e 's/.*://;s/^ *//')
aPar+=("${gArg}")
aDisk+=("${gDevice}")
aLabel+=("${gInfo}")
C_HI=$C_BLACK
if [[ "${gStartup}" == "${gDevice}" ]]; then
C_HI=$C_BLUE
(($gAuto)) && gChoose=$i
fi
gStr+="[${C_HI}${i}${C_BLACK}]\t| ${C_HI}${gArg}${C_BLACK}\t| ${C_HI}${gInfo}${C_BLACK}\n"
let i++
done
printf "${gStr}\n"
((!$gAuto)) && read -p "Choose [#]: " gChoose
if [[ "${gChoose}" =~ ^[[:digit:]]+$ ]] && [[ $gChoose -lt $gEFITotal ]]; then
gDisk=${aDisk[$gChoose]}
gPar=${aPar[$gChoose]}
gLabel=${aLabel[$gChoose]}
gOEFI=$(df | grep "${gPar}")
(($gAuto)) && printf "Auto mount EFI on: ${gDisk} .."
printf "\nMounting: ${gPar} (on ${gLabel}) ..\n"
[[ ! -z "${gOEFI}" ]] && diskutil unmount "${gPar}"
diskutil mount "${gPar}"
mEFI=$(diskutil info "${gPar}" | grep 'Mount Point:' | sed -e 's/.*://;s/^ *//')
printf "Mounted on: ${mEFI} ..\n"
if [[ $gOpen -ne 0 ]]; then
printf "Auto open EFI directory ..\n"
open "${mEFI}"
fi
fi
#printf "${gMSG}"
isdone
 
BootLoader
OpenCore 0.9.6
Anakart Modeli
MSI B460M PRO
İşlemci Modeli
İ5 10400
Grafik Kartı
Sapphire AMD RX6600 8GB 128bit
Ses Kartı Modeli
Realtek® ALC892/ALC897 Codec
Ağ Aygıtları
1x Realtek® RTL8111H Gigabit LAN
Disk ve RAM
KINGSTON SA2000M8500G Media NVMe SSD+ KINGSTON 120GB+OCZ Toshiba SSD 120GB+WD 1TB HDD

montezuma

MASTER YODA
Yönetici
19 Eki 2016
29,786
7,584
4,401
Merhaba @dj sms
Bunun için command dosyası oluşturmalısın.
  1. Yukarıda paylaştığın betiği text edit içine yapıştır.
  2. Ardından Text Edit / Menü / Format içinde "main plain text" seç.
  3. İsmini istediğin gibi girip istediğin yere kaydet.
  4. Bundan sonra kaydettiğimiz dosyanın uzantısını .command olarak değiştirelim. Örnek: mount_efi.command
  5. Şimdi Terminal açıp şu komutu girelim.
    Kod:
    chmod 755 /command/dosyasını/kopyaladığımız/dosya/yolu/mount_efi.command
    İpucu: Burada chmod 755 yazdıktan sonra boşluk bırakıp, dosyayı terminale sürükleyebilirsin. Daha kolay.
  6. İşlem bu kadar. Artık çift tıkladığında açılan bir EFI mount dosyası oluşmuş oldu.
Örnek olsun diye senin verdiğin betiği ben hazırladım ve aşağıda paylaştım.
 

Ekli dosyalar

Son düzenleme:
BootLoader
OpenCore 0.6.4
Anakart Modeli
Asus Z170 Deluxe
İşlemci Modeli
Intel i7 6700K
Grafik Kartı
8 GB Sapphire RX 580 & HD 530
Ses Kartı Modeli
ALC 1150
Ağ Aygıtları
Broadcom BCM43xx - I211 Gigabit Ethernet
Disk ve RAM
500GB NVMe & 32 GB DDR4

Benzer konular

AD Engelleyici Tespit Edildi

Anlıyoruz, reklamlar can sıkıcı!

Elbette, reklam engelleme yazılımı reklamları engelleme konusunda harika bir iş çıkarsa da, web sitemizin faydalı özelliklerini de engeller. En iyi site deneyimi ve bize destek olmak için lütfen AdBlocker’ınızı devre dışı bırakın.

AD Reklam Engelleyiciyi Devre Dışı Bıraktım    Hayır teşekkürler