|
#!/bin/sh |
|
|
|
set -e |
|
|
|
currentdir=$(dirname $0) |
|
cd ${currentdir} |
|
|
|
source ./firstofall_functions.sh |
|
|
|
## Dotfiles |
|
dotfiles="${HOME}/dots" |
|
if ask_confirm "Clone \033[1;32mdotfiles\033[0m ... Are you ready?"; then |
|
if [ -e "${dotfiles}" ]; then |
|
mv "${dotfiles}" "${dotfiles}~$(date '+%Y%m%d%H%M')" |
|
fi |
|
mkdir -p ${dotfiles} |
|
git clone https://github.com/woowee/dots.git "${dotfiles}" |
|
sleep 10 |
|
ln -fs ${dotfiles}/.vimrc ${HOME}/.vimrc |
|
ln -fs ${dotfiles}/.gvimrc ${HOME}/.gvimrc |
|
ln -fs ${dotfiles}/.zshrc ${HOME}/.zshrc |
|
fi |
|
|
|
|
|
## Systen Settings |
|
ask_confirm "\033[1m##### System Information #####\033[0m" |
|
set_systeminfo |
|
|
|
cat << DATA |
|
Check the contents ... ; |
|
- Computer Name : ${MyCOMPUTERNAME} |
|
- Hostname : ${MyHOSTNAME} |
|
- Local Host Name : ${MyLOCALHOSTNAME} |
|
|
|
DATA |
|
|
|
confirm_systeminfo "Are you sure want to set using above infomation?" |
|
sudo scutil --set ComputerName "${MyCOMPUTERNAME}" |
|
sudo scutil --set HostName "${MyHOSTNAME}" |
|
sudo scutil --set LocalHostName "${MyLOCALHOSTNAME}" |
|
|
|
|
|
## Generating SSH Keys for Github |
|
ask_confirm "\033[1m########### GitHub ###########\033[0m" |
|
if ask_yesno "Do you generate \033[1;32ma SSH key for GitHub\033[0m?"; then |
|
osascript -e "tell app \"Terminal\" to do script \"${currentdir}/firstofall_github.sh\"" |
|
# ★ Terminal が新規で開いたことを知らせる必要あり? |
|
sleep 10 |
|
fi |
|
|
|
|
|
## OSX Settings |
|
ask_confirm "\033[1m######## OSX Settings ########\033[0m" |
|
|
|
# Trackpad |
|
echo ' トラックパッドのナチュラル・スクロールを止める... ' |
|
defaults write -g com.apple.swipescrolldirection -bool false |
|
# [システム環境設定 > トラックパッド > スクロールとズーム > スクロールの方向 : ナチュラル] = "OFF" |
|
|
|
echo ' トラックパッドの副ボタン機能をアクティヴにし、右下端クリックに割り当てる... ' |
|
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 |
|
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true |
|
defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 |
|
defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true |
|
# [システム環境設定 > トラックパッド > ポイントオプションおよびクリックオプション > 副ボタンのクリック] = "ON",[右下端をクリック] |
|
|
|
echo ' マウスの副ボタン機能をアクティヴにし、右クリックに割り当てる... ' |
|
defaults write com.apple.driver.AppleBluetoothMultitouch.mouse MouseButtonMode "TwoButton" |
|
# [システム環境設定 > マウス > ポイントオプションおよびクリックオプション > 副ボタンのクリック] = "ON",[右側をクリック] |
|
|
|
# Dock |
|
echo ' Dock を隠す... ' |
|
defaults write com.apple.dock autohide -bool true |
|
# [システム環境設定 > Dock > Dock を自動的に隠す/表示] => "ON" |
|
|
|
# Finder |
|
echo ' ファイルの拡張子を表示する... ' |
|
defaults write NSGlobalDomain AppleShowAllExtensions -bool true |
|
# [Finder の環境設定 > 詳細 > すべてのファイル名拡張子を表示] => "ON" |
|
|
|
# Keyboard |
|
keyboardid=$(ioreg -n IOHIDKeyboard -r | grep -E 'VendorID"|ProductID' | awk '{ print $4 }' | paste -s -d'-\n' -)'-0' |
|
echo ' Caps Lock を Control キーにする... ' |
|
# CapsLock(2) -> Control(0) |
|
# defaults -currentHost delete -g com.apple.keyboard.modifiermapping.${keyboardid} |
|
# defaults -currentHost write -g com.apple.keyboard.modifiermapping.${keyboardid} -array-add '<dict><key>HIDKeyboardModifierMappingDst</key><integer>2</integer><key>HIDKeyboardModifierMappingSrc</key><integer>0</integer></dict>' |
|
defaults -currentHost write -g com.apple.keyboard.modifiermapping.${keyboardid} -array '<dict><key>HIDKeyboardModifierMappingDst</key><integer>2</integer><key>HIDKeyboardModifierMappingSrc</key><integer>0</integer></dict>' |
|
# [システム環境設定 > キーボード > 修飾キー > Caps Lock キー] => [^ Control] |
|
|
|
echo ' Fn キーのショートカットとホットコーナーをすべて無効にする... ' |
|
defaults write com.apple.dock wvous-tl-corner -int 0 |
|
defaults write com.apple.dock wvous-tl-modifier -int 0 |
|
defaults write com.apple.dock wvous-tr-corner -int 0 |
|
defaults write com.apple.dock wvous-tr-modifier -int 0 |
|
defaults write com.apple.dock wvous-bl-corner -int 0 |
|
defaults write com.apple.dock wvous-bl-modifier -int 0 |
|
defaults write com.apple.dock wvous-br-corner -int 0 |
|
defaults write com.apple.dock wvous-br-modifier -int 0 |
|
# [システム環境設定],[Mission Control] の [キーボードとマウスのショートカット] = "すべて無効" |
|
|
|
echo ' すべての Fn (ファンクション) キーを標準にする... ' |
|
defaults write -g com.apple.keyboard.fnState -bool true |
|
# [システム環境設定 > キーボード > キーボード > F1、F2 などのすべてのキーを標準ファンクションキーとして使用] => "ON" |
|
|
|
echo ' すべてのコントロールを Tab キーで移動する... ' |
|
defaults write -g AppleKeyboardUIMode -int 3 |
|
# [システム環境設定 > キーボード > キーボードショートカット > フルキーボードアクセス : Tab キーを押してウィンドウやダイアログ内の操作対象を移動する機能の適用範囲] => [すべてのコントロール] |
|
|
|
echo ' Dashbord を使わない... ' |
|
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 62 "<dict><key>enabled</key><false/></dict>" |
|
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 63 "<dict><key>enabled</key><false/></dict>" |
|
# [システム環境設定 > キーボード > Mission Control > Dashboard を表示] => "OFF" |
|
|
|
echo ' Mission Control を [F12] にマップする... ' |
|
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 32 "<dict><key>enabled</key><true/><key>value</key><dict><key>parameters</key><array><integer>65535</integer><integer>111</integer><integer>0</integer></array><key>type</key><string>standard</string></dict></dict>" |
|
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 34 "<dict><key>enabled</key><true/><key>value</key><dict><key>parameters</key><array><integer>65535</integer><integer>111</integer><integer>131072</integer></array><key>type</key><string>standard</string></dict></dict>" |
|
# [システム環境設定 > キーボード > Mission Control > Mission Control] = "ON",[F12] |
|
|
|
echo ' アプリケーションウィンドウの表示を [F11] にマップする... ' |
|
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 33 "<dict><key>enabled</key><true/><key>value</key><dict><key>parameters</key><array><integer>65535</integer><integer>103</integer><integer>0</integer></array><key>type</key><string>standard</string></dict></dict>" |
|
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 35 "<dict><key>enabled</key><true/><key>value</key><dict><key>parameters</key><array><integer>65535</integer><integer>103</integer><integer>131072</integer></array><key>type</key><string>standard</string></dict></dict>" |
|
# [システム環境設定 > キーボード > Mission Control > アプリケーションウィンドウ] = "ON",[F11] |
|
|
|
echo ' デスクトップの表示を [F10] にマップする... ' |
|
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 36 "<dict><key>enabled</key><true/><key>value</key><dict><key>parameters</key><array><integer>65535</integer><integer>109</integer><integer>0</integer></array><key>type</key><string>standard</string></dict></dict>" |
|
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 37 "<dict><key>enabled</key><true/><key>value</key><dict><key>parameters</key><array><integer>65535</integer><integer>109</integer><integer>131072</integer></array><key>type</key><string>standard</string></dict></dict>" |
|
# [システム環境設定 > キーボード > Mission Control > デスクトップを表示] = "ON",[F10] |
|
|
|
echo ' [F2] でメニューを操作する... ' |
|
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 7 "<dict><key>enabled</key><true/><key>value</key><dict><key>parameters</key><array><integer>65535</integer><integer>120</integer><integer>0</integer></array><key>type</key><string>standard</string></dict></dict>" |
|
# [システム環境設定 > キーボード > キーボードと文字入力 > メニューバーを操作対象にする] = "ON",[F2] |
|
|
|
echo ' [F3] でツールバーを操作する... ' |
|
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 10 "<dict><key>enabled</key><true/><key>value</key><dict><key>parameters</key><array><integer>65535</integer><integer>99</integer><integer>0</integer></array><key>type</key><string>standard</string></dict></dict>" |
|
# [システム環境設定 > キーボード > キーボードと文字入力 > ウィンドウのツールバーを操作対象にする] = "ON",[F3] |
|
|
|
# Inputmethod (Kotoeri) |
|
echo ' 言語切り替えは “US-ひらがな” のみ (カタカナなどは含まない)... ' |
|
defaults -currentHost write 'com.apple.HIToolbox' 'AppleCurrentKeyboardLayoutInputSourceID' -string "com.apple.keylayout.US" |
|
defaults -currentHost write 'com.apple.HIToolbox' 'AppleEnabledInputSources' -array-add '{InputSourceKind = "Keyboard Layout"; "KeyboardLayout ID" = 0; "KeyboardLayout Name" = "U.S."; }' |
|
defaults -currentHost write 'com.apple.HIToolbox' 'AppleEnabledInputSources' -array-add '{"Bundle ID" = "com.apple.inputmethod.Kotoeri";"Input Mode" = "com.apple.inputmethod.Japanese"; InputSourceKind = "Input Mode";}' |
|
defaults -currentHost write 'com.apple.HIToolbox' 'AppleEnabledInputSources' -array-add '{"Bundle ID" = "com.apple.inputmethod.Kotoeri";"Input Mode" = "com.apple.inputmethod.Japanese.placename";InputSourceKind = "Input Mode";}' |
|
defaults -currentHost write 'com.apple.HIToolbox' 'AppleEnabledInputSources' -array-add '{"Bundle ID" = "com.apple.inputmethod.Kotoeri";"Input Mode" = "com.apple.inputmethod.Japanese.firstname";InputSourceKind = "Input Mode";}' |
|
defaults -currentHost write 'com.apple.HIToolbox' 'AppleEnabledInputSources' -array-add '{"Bundle ID" = "com.apple.inputmethod.Kotoeri";"Input Mode" = "com.apple.inputmethod.Japanese.lastname";InputSourceKind = "Input Mode";}' |
|
defaults -currentHost write 'com.apple.HIToolbox' 'AppleEnabledInputSources' -array-add '{"Bundle ID" = "com.apple.inputmethod.Kotoeri";InputSourceKind = "Keyboard Input Method";}' |
|
|
|
echo ' 数字,記号はシングルバイトで入力する... ' |
|
# [ことえり環境設定 > 文字入力 > 数字を全角で入力] |
|
#/usr/libexec/Plistbuddy -c "set :zhnm 0" ~/Library/Preferences/com.apple.inputmethod.Kotoeri.plist |
|
defaults write com.apple.inputmethod.Kotoeri 'zhnm' -int 0 |
|
|
|
#maverick で無くなった。っぽい? |
|
#echo '記号への勝手な変換機能は要らない... ' |
|
# /usr/libexec/Plistbuddy -c "set :NSUserReplacementItemsEnabled bool false" ~/Library/Preferences/.GlobalPreferences.plist |
|
# /usr/libexec/Plistbuddy -c "set :WebAutomaticTextReplacementEnabled bool false" ~/Library/Preferences/.GlobalPreferences.plist |
|
# # [システム環境設定 > 言語とテキスト > テキスト > 記号とテキストの置換を使用] = "OFF" |
|
|
|
echo ' スペルチェック機能は要らない... ' |
|
#/usr/libexec/Plistbuddy -c "set :NSAutomaticSpellingCorrectionEnabled bool false" ~/Library/Preferences/.GlobalPreferences.plist |
|
#/usr/libexec/Plistbuddy -c "set :WebAutomaticSpellingCorrectionEnabled bool false" ~/Library/Preferences/.GlobalPreferences.plist |
|
# [システム環境設定 > 言語とテキスト > テキスト > 記号とテキストの置換を使用] = "OFF" |
|
# ブランク(スペース),記号 |
|
# can't set by plistbuddy command, why? |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '" "' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"("' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '")"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"["' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"]"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"{"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"}"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"!"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"\\"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"#"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"$"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"%"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"&"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"*"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"+"' -bool FALSE |
|
# defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '","' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"-"' -bool FALSE |
|
# defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"."' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"/"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '":"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '";"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"<"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"="' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '">"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"?"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"@"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"^"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"_"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"`"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"|"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"~"' -bool FALSE |
|
defaults write com.apple.inputmethod.Kotoeri 'zhsy' -dict-add '"\U00a5"' -bool FALSE |
|
|
|
|
|
# Applications |
|
# echo "" |
|
# ask_confirm "\033[1m#### Install Applications ####\033[0m" |
|
|
|
# work_directoryname="_firstofall" |
|
# mkdir -p "${HOME}/${work_directoryname}" |
|
|
|
# app_macvim_name='MacVim-KaoriYa' |
|
# app_macvim_filename='MacVim.app' |
|
# app_macvim_url='https://macvim-kaoriya.googlecode.com/files/macvim-kaoriya-20131126.dmg' |
|
|
|
# app_alfred_name="Alfred 2" |
|
# app_alfred_filename="Alfred 2.app" |
|
# app_alfred_url='http://cachefly.alfredapp.com/Alfred_2.1.1_227.zip' |
|
|
|
# app_chrome_name='Google Chrome' |
|
# app_chrome_filename='Google Chrome.app' |
|
# app_chrome_url='https://dl.google.com/chrome/mac/stable/GGRM/googlechrome.dmg' |
|
|
|
# ## access, download, and install |
|
# function install_application() { |
|
# # arguments |
|
# app_name=$1 |
|
# app_filename=$2 |
|
# app_url=$3 |
|
|
|
# echo "Installing \033[1;32m${app_name}\033[0m..." |
|
# # get |
|
# cd "${HOME}/${work_directoryname}" |
|
# curl --location --remote-name "${app_url}" |
|
# app_filepath="${HOME}/${work_directoryname}/${app_url##*/}" |
|
# echo ${app_filepath} |
|
# # expansion & install |
|
# #case "${app_filename##*.}" in |
|
# case "${app_url##*.}" in |
|
# 'zip') |
|
# unzip -q "${app_filepath}" |
|
# #cp -a "$app_filepath" "/Applications" |
|
# cp -a "${app_filename}" "/Applications" |
|
# ;; |
|
# 'dmg') |
|
# app_mount="/Volumes/${app_name}" |
|
# hdiutil attach "${app_filepath}" -noidmereveal |
|
# cp -a "${app_mount}/${app_filename}" "/Applications" |
|
# hdiutil detach -force "${app_mount}" |
|
# ;; |
|
# esac |
|
# } |
|
|
|
# ## install |
|
# install_application "${app_macvim_name}" "${app_macvim_filename}" "${app_macvim_url}" |
|
# #install_application ${app_alfred_name} ${app_alfred_filename} ${app_alfred_url} |
|
# install_application "${app_alfred_name}" "${app_alfred_filename}" "${app_alfred_url}" |
|
# install_application "${app_chrome_name}" "${app_chrome_filename}" "${app_chrome_url}" |
|
|
|
# ## Each application settings |
|
# # Terminal |
|
# defaults write com.apple.terminal "Default Window Settings" -string "Pro" |
|
# defaults write com.apple.terminal "Startup Window Settings" -string "Pro" |
|
|
|
# # MacVim |
|
# defaults write org.vim.MacVim "MMNativeFullScreen" -bool false |
|
|
|
# # Alfred |
|
# ask_confirm 'Once open Alfred to start Alfred automatically at loguin.' |
|
# open -a Alfred\ 2 |
|
|
|
## Please restart |
|
echo "" |
|
echo "" |
|
echo "**************************************************" |
|
echo " NOW IT'S DONE. " |
|
echo "" |
|
echo " You Should RESTART to activate the settings. " |
|
echo " (c.g., [Command] + [Control] + [EJECT]) " |
|
echo "**************************************************" |
|
echo "" |
|
echo "" |
|
|
|
## ADDITIONA SETTINGS |
|
ask_confirm "\033[1m????? Addtional Settings ?????\033[0m" |
|
# MacVim > Neobundle |
|
if ask_yesno "\033[1;32mMacVim\033[0m, Install the plugins by using 'NeoBundleInstall'?"; then |
|
vimbundle="~/.vim/bundle" |
|
if [ -e ${HOME}/.vim ]; then |
|
mv ${HOME}/.vim "${HOME}/.vim~$(date '+%Y%m%d%H%M')" |
|
fi |
|
mkdir -p ~/.vim/bundle |
|
git clone git://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim |
|
|
|
vim -u ~/.vimrc -i NONE -c "try | NeoBundleUpdate! | finally | q! | endtry" -e -s -V1 &&: |
|
echo "" |
|
fi |
|
# BOXEN |
|
if ask_yesno "Incidentally... Do you continue setting it more by \033[1;32mBoxen\033[0m, ? (note: It takes time very much though.)"; then |
|
sudo mkdir -p /opt/boxen |
|
sudo chown ${USER}:staff /opt/boxen |
|
git clone https://github.com/woowee/my-boxen.git /opt/boxen/repo |
|
cd /opt/boxen/repo |
|
script/boxen |
|
|
|
echo "*** BOXEN ALSO DONE! ***" |
|
fi |
|
# RADIKO |
|
if ask_yesno 'Clone the scripts for recording Radiko?'; then |
|
ask_inputvalue 'Enter the name of directory for Radiko. : ' MyRadicoRec |
|
# existence check |
|
if [ -e ${HOME}/${MyRadicoRec} ]; then |
|
mv ${HOME}/${MyRadicoRec} "${HOME}/${MyRadicoRec}~$(date '+%Y%m%d%H%M')" |
|
fi |
|
|
|
git clone https://github.com/woowee/radiko.git "${HOME}/${MyRadicoRec}" |
|
fi |