-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from mikoto2000/add-support-other-arch
ホストと異なるアーキテクチャのコンテナの実行に対応。
- Loading branch information
Showing
26 changed files
with
443 additions
and
587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package devcontainer | ||
|
||
import "runtime" | ||
|
||
// `devcontainer.vim start` 時の `devcontainer exec` の引数を組み立てる | ||
// | ||
// Args: | ||
// - containerID: コンテナ ID | ||
// - workspaceFolder: ワークスペースフォルダパス | ||
// - vimFileName: コンテナ上に転送した vim/nvim のファイル名 | ||
// - useSystemVim: true の場合、システムにインストールした vim/nvim を利用する | ||
// | ||
// Return: | ||
// | ||
// `devcontainer exec` に使うコマンドライン引数の配列 | ||
func devcontainerStartVimArgs(containerID string, workspaceFolder string, vimFileName string, sendToTCP string, containerArch string, useSystemVim bool) []string { | ||
if useSystemVim { | ||
return []string{ | ||
"exec", | ||
"--container-id", | ||
containerID, | ||
"--workspace-folder", | ||
workspaceFolder, | ||
"sh", | ||
"-c", | ||
vimFileName + " --cmd \"let g:devcontainer_vim = v:true\" -S /" + sendToTCP + " -S /vimrc"} | ||
} else { | ||
if containerArch == "amd64" { | ||
if runtime.GOOS != "darwin" { | ||
return []string{ | ||
"exec", | ||
"--container-id", | ||
containerID, | ||
"--workspace-folder", | ||
workspaceFolder, | ||
"sh", | ||
"-c", | ||
"cd ~; /" + vimFileName + " --appimage-extract > /dev/null; cd -; ~/squashfs-root/AppRun --cmd \"let g:devcontainer_vim = v:true\" -S /" + sendToTCP + " -S /vimrc"} | ||
} else { | ||
return []string{ | ||
"exec", | ||
"--container-id", | ||
containerID, | ||
"--workspace-folder", | ||
workspaceFolder, | ||
"sh", | ||
"-c", | ||
"cd /; tar zxf ./" + vimFileName + " -C ~/ > /dev/null; cd ~; sudo rm -rf ~/vim-static; mv $(ls -d ~/vim-*-x86_64) ~/vim-static;~/vim-static/AppRun --cmd \"let g:devcontainer_vim = v:true\" -S /" + sendToTCP + " -S /vimrc"} | ||
} | ||
} else { | ||
return []string{ | ||
"exec", | ||
"--container-id", | ||
containerID, | ||
"--workspace-folder", | ||
workspaceFolder, | ||
"sh", | ||
"-c", | ||
"cd /; tar zxf ./" + vimFileName + " -C ~/ > /dev/null; cd ~; sudo rm -rf ~/vim-static; mv $(ls -d ~/vim-*-aarch64) ~/vim-static;~/vim-static/AppRun --cmd \"let g:devcontainer_vim = v:true\" -S /" + sendToTCP + " -S /vimrc"} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package devcontainer | ||
|
||
import "runtime" | ||
|
||
// `devcontainer.vim run` 時の `docker exec` の引数を組み立てる | ||
// | ||
// Args: | ||
// - containerID: コンテナ ID | ||
// - vimFileName: コンテナ上に転送した vim のファイル名 | ||
// - useSystemVim: true の場合、システムにインストールされた vim/nvim を使用する | ||
// | ||
// Return: | ||
// | ||
// `docker exec` に使うコマンドライン引数の配列 | ||
func dockerRunVimArgs(containerID string, vimFileName string, sendToTCP string, containerArch string, useSystemVim bool) []string { | ||
if useSystemVim { | ||
return []string{ | ||
"exec", | ||
"-it", | ||
containerID, | ||
"sh", | ||
"-c", | ||
vimFileName + " --cmd \"let g:devcontainer_vim = v:true\" -S /" + sendToTCP + " -S /vimrc"} | ||
} else { | ||
if containerArch == "amd64" { | ||
if runtime.GOOS != "darwin" { | ||
return []string{ | ||
"exec", | ||
"-it", | ||
containerID, | ||
"sh", | ||
"-c", | ||
"cd ~; /" + vimFileName + " --appimage-extract > /dev/null; cd -; ~/squashfs-root/AppRun --cmd \"let g:devcontainer_vim = v:true\" -S /" + sendToTCP + " -S /vimrc"} | ||
} else { | ||
return []string{ | ||
"exec", | ||
"-it", | ||
containerID, | ||
"sh", | ||
"-c", | ||
"cd /; tar zxf ./" + vimFileName + " -C ~/ > /dev/null; cd ~; sudo rm -rf ~/vim-static; mv $(ls -d ~/vim-*-x86_64) ~/vim-static;~/vim-static/AppRun --cmd \"let g:devcontainer_vim = v:true\" -S /" + sendToTCP + " -S /vimrc"} | ||
} | ||
} else { | ||
return []string{ | ||
"exec", | ||
"-it", | ||
containerID, | ||
"sh", | ||
"-c", | ||
"cd /; tar zxf ./" + vimFileName + " -C ~/ > /dev/null; cd ~; sudo rm -rf ~/vim-static; mv $(ls -d ~/vim-*-aarch64) ~/vim-static;~/vim-static/AppRun --cmd \"let g:devcontainer_vim = v:true\" -S /" + sendToTCP + " -S /vimrc"} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.