diff options
| author | Fred Sundvik <fsundvik@gmail.com> | 2017-07-10 17:31:58 +0300 |
|---|---|---|
| committer | Fred Sundvik <fsundvik@gmail.com> | 2017-07-10 17:31:58 +0300 |
| commit | a2d3fc98b8eb83a550fefce9acd2884ebac3eee8 (patch) | |
| tree | 288bb7e2dd6320fb7c4f464f279a5d25dee5a1ed /util | |
| parent | fcd08b8c7d66cf4cf5724b7b2468d3569488114f (diff) | |
| download | qmk_firmware-a2d3fc98b8eb83a550fefce9acd2884ebac3eee8.tar.gz qmk_firmware-a2d3fc98b8eb83a550fefce9acd2884ebac3eee8.zip | |
Initial structure for shared msys2 and wsl installation
Diffstat (limited to 'util')
| -rw-r--r-- | util/msys2_install.sh | 4 | ||||
| -rw-r--r-- | util/win_shared_install.sh | 137 | ||||
| -rw-r--r-- | util/wsl_install.sh | 130 |
3 files changed, 143 insertions, 128 deletions
diff --git a/util/msys2_install.sh b/util/msys2_install.sh new file mode 100644 index 000000000..945009e5e --- /dev/null +++ b/util/msys2_install.sh | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) | ||
| 4 | source "$dir/win_shared_install.sh" \ No newline at end of file | ||
diff --git a/util/win_shared_install.sh b/util/win_shared_install.sh new file mode 100644 index 000000000..d86553bf0 --- /dev/null +++ b/util/win_shared_install.sh | |||
| @@ -0,0 +1,137 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | download_dir=win_downloaded | ||
| 4 | wsl_download_dir=wsl_downloaded | ||
| 5 | |||
| 6 | function install_utils { | ||
| 7 | rm -f -r $download_dir | ||
| 8 | mkdir $download_dir | ||
| 9 | |||
| 10 | pushd $download_dir | ||
| 11 | |||
| 12 | echo "Installing dfu-programmer" | ||
| 13 | wget 'http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip' | ||
| 14 | unzip -d dfu-programmer dfu-programmer-win-0.7.2.zip | ||
| 15 | |||
| 16 | echo "Installing dfu-util" | ||
| 17 | wget 'http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip' | ||
| 18 | unzip dfu-util-0.9-win64.zip | ||
| 19 | |||
| 20 | echo "Installing teensy_loader_cli" | ||
| 21 | wget 'https://www.pjrc.com/teensy/teensy_loader_cli_windows.zip' | ||
| 22 | unzip teensy_loader_cli_windows.zip | ||
| 23 | |||
| 24 | echo "Installing Atmel Flip" | ||
| 25 | wget 'http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe' | ||
| 26 | mv Flip\ Installer\ \-\ 3.4.7.112.exe FlipInstaller.exe | ||
| 27 | |||
| 28 | echo "Downloading the QMK driver installer" | ||
| 29 | wget -qO- https://api.github.com/repos/qmk/qmk_driver_installer/releases | grep browser_download_url | head -n 1 | cut -d '"' -f 4 | wget -i - | ||
| 30 | |||
| 31 | rm -f *.zip | ||
| 32 | |||
| 33 | popd > /dev/null | ||
| 34 | } | ||
| 35 | |||
| 36 | function install_drivers { | ||
| 37 | pushd $download_dir | ||
| 38 | cmd.exe /C qmk_driver_installer.exe $1 $2 ../drivers.txt | ||
| 39 | popd > /dev/null | ||
| 40 | } | ||
| 41 | |||
| 42 | pushd "$dir" | ||
| 43 | |||
| 44 | if [ -d "$wsl_download_dir" ]; then | ||
| 45 | echo "Renaming existing wsl_download_dir to win_download" | ||
| 46 | mv -f "$wsl_download_dir" "$download_dir" | ||
| 47 | fi | ||
| 48 | |||
| 49 | if [ ! -d "$download_dir" ]; then | ||
| 50 | install_utils | ||
| 51 | else | ||
| 52 | while true; do | ||
| 53 | echo | ||
| 54 | read -p "The utils seem to already be downloaded, do you want to re-download them and update to the newest version (Y/N) " res | ||
| 55 | case $res in | ||
| 56 | [Yy]* ) install_utils; break;; | ||
| 57 | [Nn]* ) break;; | ||
| 58 | * ) echo "Invalid answer";; | ||
| 59 | esac | ||
| 60 | done | ||
| 61 | fi | ||
| 62 | |||
| 63 | while true; do | ||
| 64 | echo | ||
| 65 | read -p "Flip need to be installed if you want to use that for programming, do you want to install it now? (Y/N) " res | ||
| 66 | case $res in | ||
| 67 | [Yy]* ) cmd.exe /c $download_dir\\FlipInstaller.exe; break;; | ||
| 68 | [Nn]* ) break;; | ||
| 69 | * ) echo "Invalid answer";; | ||
| 70 | esac | ||
| 71 | done | ||
| 72 | |||
| 73 | |||
| 74 | while true; do | ||
| 75 | echo | ||
| 76 | echo "Which USB drivers do you want to install?" | ||
| 77 | echo "(A)all - All supported drivers will be installed" | ||
| 78 | echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode) will be installed" | ||
| 79 | echo "(F)force - Like all, but will also override existing drivers for connected keyboards" | ||
| 80 | echo "(N)one - No drivers will be installed, flashing your keyboard will most likely not work" | ||
| 81 | read -p "(A/C/F/N)? " res | ||
| 82 | case $res in | ||
| 83 | [Aa]* ) install_drivers --all; break;; | ||
| 84 | [Cc]* ) install_drivers; break;; | ||
| 85 | [Ff]* ) install_drivers --all --force; break;; | ||
| 86 | [Nn]* ) break;; | ||
| 87 | * ) echo "Invalid answer";; | ||
| 88 | esac | ||
| 89 | done | ||
| 90 | |||
| 91 | echo | ||
| 92 | echo "Creating a softlink to the utils directory as ~/qmk_utils." | ||
| 93 | echo "This is needed so that the the make system can find all utils it need." | ||
| 94 | read -p "Press any key to continue (ctrl-c to abort)" | ||
| 95 | ln -sfn "$dir" ~/qmk_utils | ||
| 96 | |||
| 97 | if grep "^source ~/qmk_utils/activate_wsl.sh$" ~/.bashrc | ||
| 98 | then | ||
| 99 | echo | ||
| 100 | echo "The line source ~/qmk_utils/activate_wsl.sh is already added to your /.bashrc" | ||
| 101 | echo "Not adding it twice" | ||
| 102 | else | ||
| 103 | while true; do | ||
| 104 | echo | ||
| 105 | echo "Do you want to add 'source ~/qmk_utils/activate_wsl.sh' to the end of you .bashrc file?" | ||
| 106 | echo "Without this make won't find the needed utils, so if you don't want to do it automatically," | ||
| 107 | echo "then you have to do it manually." | ||
| 108 | read -p "(Y/N)? " res | ||
| 109 | case $res in | ||
| 110 | [Yy]* ) echo "source ~/qmk_utils/activate_wsl.sh" >> ~/.bashrc; break;; | ||
| 111 | [Nn]* ) break;; | ||
| 112 | * ) echo "Invalid answer";; | ||
| 113 | esac | ||
| 114 | done | ||
| 115 | fi | ||
| 116 | |||
| 117 | while true; do | ||
| 118 | echo | ||
| 119 | echo "Do you want to add a symlink to the QMK repository in your home directory for convenience?" | ||
| 120 | echo "This will create a folder 'qmk_firmware' in your home directory." | ||
| 121 | echo "In the future you can use this folder instead of the full path on your windows file system" | ||
| 122 | read -p "(Y/N)? " res | ||
| 123 | case $res in | ||
| 124 | [Yy]* ) ln -sfn "$dir/.." ~/qmk_firmware; break;; | ||
| 125 | [Nn]* ) break;; | ||
| 126 | * ) echo "Invalid answer";; | ||
| 127 | esac | ||
| 128 | done | ||
| 129 | |||
| 130 | echo | ||
| 131 | echo "******************************************************************************" | ||
| 132 | echo "Installation completed!" | ||
| 133 | echo "You need to open a new batch command prompt for all the utils to work properly" | ||
| 134 | echo "******************************************************************************" | ||
| 135 | |||
| 136 | popd > /dev/null | ||
| 137 | |||
diff --git a/util/wsl_install.sh b/util/wsl_install.sh index 8999da8a4..578fcb88c 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh | |||
| @@ -1,44 +1,7 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | 2 | ||
| 3 | download_dir=wsl_downloaded | ||
| 4 | |||
| 5 | function install_utils { | ||
| 6 | rm -f -r $download_dir | ||
| 7 | mkdir $download_dir | ||
| 8 | |||
| 9 | pushd $download_dir | ||
| 10 | |||
| 11 | echo "Installing dfu-programmer" | ||
| 12 | wget 'http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip' | ||
| 13 | unzip -d dfu-programmer dfu-programmer-win-0.7.2.zip | ||
| 14 | |||
| 15 | echo "Installing dfu-util" | ||
| 16 | wget 'http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip' | ||
| 17 | unzip dfu-util-0.9-win64.zip | ||
| 18 | |||
| 19 | echo "Installing teensy_loader_cli" | ||
| 20 | wget 'https://www.pjrc.com/teensy/teensy_loader_cli_windows.zip' | ||
| 21 | unzip teensy_loader_cli_windows.zip | ||
| 22 | |||
| 23 | echo "Installing Atmel Flip" | ||
| 24 | wget 'http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe' | ||
| 25 | mv Flip\ Installer\ \-\ 3.4.7.112.exe FlipInstaller.exe | ||
| 26 | |||
| 27 | echo "Downloading the QMK driver installer" | ||
| 28 | wget -qO- https://api.github.com/repos/qmk/qmk_driver_installer/releases | grep browser_download_url | head -n 1 | cut -d '"' -f 4 | wget -i - | ||
| 29 | |||
| 30 | rm -f *.zip | ||
| 31 | |||
| 32 | popd > /dev/null | ||
| 33 | } | ||
| 34 | |||
| 35 | function install_drivers { | ||
| 36 | pushd $download_dir | ||
| 37 | cmd.exe /C qmk_driver_installer.exe $1 $2 ../drivers.txt | ||
| 38 | popd > /dev/null | ||
| 39 | } | ||
| 40 | |||
| 41 | dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) | 3 | dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) |
| 4 | pushd "$dir"; | ||
| 42 | 5 | ||
| 43 | if [[ $dir != /mnt/* ]]; | 6 | if [[ $dir != /mnt/* ]]; |
| 44 | then | 7 | then |
| @@ -48,7 +11,6 @@ then | |||
| 48 | exit 1 | 11 | exit 1 |
| 49 | fi | 12 | fi |
| 50 | 13 | ||
| 51 | pushd "$dir" | ||
| 52 | 14 | ||
| 53 | while true; do | 15 | while true; do |
| 54 | echo | 16 | echo |
| @@ -66,94 +28,6 @@ done | |||
| 66 | echo "Installing dependencies needed for the installation (unzip, wget)" | 28 | echo "Installing dependencies needed for the installation (unzip, wget)" |
| 67 | echo "This will ask for the sudo password" | 29 | echo "This will ask for the sudo password" |
| 68 | sudo apt-get install unzip wget | 30 | sudo apt-get install unzip wget |
| 69 | 31 | source "$dir/win_shared_install.sh" | |
| 70 | |||
| 71 | if [ ! -d "$download_dir" ]; then | ||
| 72 | install_utils | ||
| 73 | else | ||
| 74 | while true; do | ||
| 75 | echo | ||
| 76 | read -p "The utils seem to already be downloaded, do you want to re-download them and update to the newest version (Y/N) " res | ||
| 77 | case $res in | ||
| 78 | [Yy]* ) install_utils; break;; | ||
| 79 | [Nn]* ) break;; | ||
| 80 | * ) echo "Invalid answer";; | ||
| 81 | esac | ||
| 82 | done | ||
| 83 | fi | ||
| 84 | |||
| 85 | while true; do | ||
| 86 | echo | ||
| 87 | read -p "Flip need to be installed if you want to use that for programming, do you want to install it now? (Y/N) " res | ||
| 88 | case $res in | ||
| 89 | [Yy]* ) cmd.exe /c $download_dir\\FlipInstaller.exe; break;; | ||
| 90 | [Nn]* ) break;; | ||
| 91 | * ) echo "Invalid answer";; | ||
| 92 | esac | ||
| 93 | done | ||
| 94 | |||
| 95 | |||
| 96 | while true; do | ||
| 97 | echo | ||
| 98 | echo "Which USB drivers do you want to install?" | ||
| 99 | echo "(A)all - All supported drivers will be installed" | ||
| 100 | echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode) will be installed" | ||
| 101 | echo "(F)force - Like all, but will also override existing drivers for connected keyboards" | ||
| 102 | echo "(N)one - No drivers will be installed, flashing your keyboard will most likely not work" | ||
| 103 | read -p "(A/C/F/N)? " res | ||
| 104 | case $res in | ||
| 105 | [Aa]* ) install_drivers --all; break;; | ||
| 106 | [Cc]* ) install_drivers; break;; | ||
| 107 | [Ff]* ) install_drivers --all --force; break;; | ||
| 108 | [Nn]* ) break;; | ||
| 109 | * ) echo "Invalid answer";; | ||
| 110 | esac | ||
| 111 | done | ||
| 112 | |||
| 113 | echo | ||
| 114 | echo "Creating a softlink to the utils directory as ~/qmk_utils." | ||
| 115 | echo "This is needed so that the the make system can find all utils it need." | ||
| 116 | read -p "Press any key to continue (ctrl-c to abort)" | ||
| 117 | ln -sfn "$dir" ~/qmk_utils | ||
| 118 | |||
| 119 | if grep "^source ~/qmk_utils/activate_wsl.sh$" ~/.bashrc | ||
| 120 | then | ||
| 121 | echo | ||
| 122 | echo "The line source ~/qmk_utils/activate_wsl.sh is already added to your /.bashrc" | ||
| 123 | echo "Not adding it twice" | ||
| 124 | else | ||
| 125 | while true; do | ||
| 126 | echo | ||
| 127 | echo "Do you want to add 'source ~/qmk_utils/activate_wsl.sh' to the end of you .bashrc file?" | ||
| 128 | echo "Without this make won't find the needed utils, so if you don't want to do it automatically," | ||
| 129 | echo "then you have to do it manually." | ||
| 130 | read -p "(Y/N)? " res | ||
| 131 | case $res in | ||
| 132 | [Yy]* ) echo "source ~/qmk_utils/activate_wsl.sh" >> ~/.bashrc; break;; | ||
| 133 | [Nn]* ) break;; | ||
| 134 | * ) echo "Invalid answer";; | ||
| 135 | esac | ||
| 136 | done | ||
| 137 | fi | ||
| 138 | |||
| 139 | while true; do | ||
| 140 | echo | ||
| 141 | echo "Do you want to add a symlink to the QMK repository in your home directory for convenience?" | ||
| 142 | echo "This will create a folder 'qmk_firmware' in your home directory." | ||
| 143 | echo "In the future you can use this folder instead of the full path on your windows file system" | ||
| 144 | read -p "(Y/N)? " res | ||
| 145 | case $res in | ||
| 146 | [Yy]* ) ln -sfn "$dir/.." ~/qmk_firmware; break;; | ||
| 147 | [Nn]* ) break;; | ||
| 148 | * ) echo "Invalid answer";; | ||
| 149 | esac | ||
| 150 | done | ||
| 151 | |||
| 152 | echo | ||
| 153 | echo "******************************************************************************" | ||
| 154 | echo "Installation completed!" | ||
| 155 | echo "You need to open a new batch command prompt for all the utils to work properly" | ||
| 156 | echo "******************************************************************************" | ||
| 157 | 32 | ||
| 158 | popd > /dev/null | 33 | popd > /dev/null |
| 159 | |||
