Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
vnotepad
Exa
提交
02350c5a
E
Exa
项目概览
vnotepad
/
Exa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
Exa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
02350c5a
编写于
8月 19, 2017
作者:
B
Benjamin Sago
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'a-better-ssh-experience'
上级
9e4ac8ca
c2779403
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
73 addition
and
13 deletion
+73
-13
Vagrantfile
Vagrantfile
+73
-13
未找到文件。
Vagrantfile
浏览文件 @
02350c5a
...
...
@@ -44,27 +44,87 @@ Vagrant.configure(2) do |config|
# By default it just uses the one in /vagrant/target, which can
# cause problems if it has different permissions than the other
# directories, or contains object files compiled for the host.
config
.
vm
.
provision
:shell
,
privileged:
false
,
inline:
<<-
EOF
function put_line() {
grep -q -F "$2" $1 || echo "$2" >> $1
}
put_line ~/.bashrc 'export CARGO_TARGET_DIR=/home/
#{
developer
}
/target'
put_line ~/.bashrc 'export PATH=$PATH:/home/
#{
developer
}
/.cargo/bin'
config
.
vm
.
provision
:shell
,
privileged:
true
,
inline:
<<-
EOF
echo 'PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/
#{
developer
}
/.cargo/bin"' > /etc/environment
echo 'CARGO_TARGET_DIR="/home/
#{
developer
}
/target"' >> /etc/environment
EOF
# Create "dexa" and "rexa" scripts that run the debug and release
# compiled versions of exa.
# Create a variety of misc scripts.
config
.
vm
.
provision
:shell
,
privileged:
true
,
inline:
<<-
EOF
set -xe
echo -e "#!/bin/sh
\n
/home/
#{
developer
}
/target/debug/exa
\"\\
$*
\"
" > /usr/bin/exa
echo -e "#!/bin/sh
\n
/home/
#{
developer
}
/target/release/exa
\"\\
$*
\"
" > /usr/bin/rexa
echo -e "#!/bin/sh
\n
cargo build --manifest-path /vagrant/Cargo.toml" > /usr/bin/b
echo -e "#!/bin/sh
\n
cargo test --manifest-path /vagrant/Cargo.toml" > /usr/bin/t
echo -e "#!/bin/sh
\n
/vagrant/xtests/run.sh" > /usr/bin/x
chmod +x /usr/bin/{exa,rexa,b,t,x}
echo -e "#!/bin/sh
\n
cargo build --manifest-path /vagrant/Cargo.toml" > /usr/bin/build-exa
ln -sf /usr/bin/build-exa /usr/bin/b
echo -e "#!/bin/sh
\n
cargo test --manifest-path /vagrant/Cargo.toml" > /usr/bin/test-exa
ln -sf /usr/bin/test-exa /usr/bin/t
echo -e "#!/bin/sh
\n
/vagrant/xtests/run.sh" > /usr/bin/run-xtests
ln -sf /usr/bin/run-xtests /usr/bin/x
echo -e "#!/bin/sh
\n
build-exa && test-exa && run-xtests" > /usr/bin/compile-exa
ln -sf /usr/bin/compile-exa /usr/bin/c
chmod +x /usr/bin/{exa,rexa,b,t,x,c,build-exa,test-exa,run-xtests,compile-exa}
EOF
# Write some welcoming text.
config
.
vm
.
provision
:shell
,
privileged:
true
,
inline:
<<-
EOF
rm -f /etc/update-motd.d/*
echo -e "" > /etc/motd
echo -e "
\033
[1;33mThe exa development environment!
\033
[0m" >> /etc/motd
echo -e "The source is at
\033
[33m/vagrant
\033
[0m." >> /etc/motd
echo -e "" >> /etc/motd
echo -e "
\033
[4mCommands
\033
[0m" >> /etc/motd
echo -e "
\033
[32;1mb
\033
[0m or
\033
[32;1mbuild-exa
\033
[0m to run
\033
[1mcargo build
\033
[0m" >> /etc/motd
echo -e "
\033
[32;1mt
\033
[0m or
\033
[32;1mtest-exa
\033
[0m to run
\033
[1mcargo test
\033
[0m" >> /etc/motd
echo -e "
\033
[32;1mx
\033
[0m or
\033
[32;1mrun-xtests
\033
[0m to run
\033
[1m/vagrant/xtests/run.sh
\033
[0m" >> /etc/motd
echo -e "
\033
[32;1mc
\033
[0m or
\033
[32;1mcompile-exa
\033
[0m to run all three" >> /etc/motd
echo -e "
\033
[32;1mdebug on
\033
[0;32m|
\033
[1moff
\033
[0m to toggle printing logs" >> /etc/motd
echo -e "
\033
[32;1mstrict on
\033
[0;32m|
\033
[1moff
\033
[0m to toggle strict mode" >> /etc/motd
echo -e "
\033
[32;1mls-colors on
\033
[0;32m|
\033
[1moff
\033
[0m to toggle LS_COLORS
\n
" >> /etc/motd
# help banner
echo 'echo -e "
\\
033[4mVersions
\\
033[0m"' > /home/ubuntu/.bash_profile
echo "rustc --version" >> /home/ubuntu/.bash_profile
echo "cargo --version" >> /home/ubuntu/.bash_profile
echo "echo" >> /home/ubuntu/.bash_profile
# cool prompt
echo 'function nonzero_return() { RETVAL=$?; [ $RETVAL -ne 0 ] && echo "$RETVAL "; }' >> /home/ubuntu/.bash_profile
echo 'function debug_mode() { [ -n "$EXA_DEBUG" ] && echo "debug "; }' >> /home/ubuntu/.bash_profile
echo 'function strict_mode() { [ -n "$EXA_STRICT" ] && echo "strict "; }' >> /home/ubuntu/.bash_profile
echo 'function lsc_mode() { [ -n "$LS_COLORS" ] && echo "lsc "; }' >> /home/ubuntu/.bash_profile
echo 'export PS1="
\\
[
\\
e[36m
\\
]
\\
h
\\
[
\\
e[32m
\\
]
\\
w
\\
[
\\
e[31m
\\
]
\\
`nonzero_return
\\
`
\\
[
\\
e[35m
\\
]
\\
`debug_mode
\\
`
\\
[
\\
e[32m
\\
]
\\
`lsc_mode
\\
`
\\
[
\\
e[33m
\\
]
\\
`strict_mode
\\
`
\\
[
\\
e[36m
\\
]
\\\\
$
\\
[
\\
e[m
\\
] "' >> /home/ubuntu/.bash_profile
# environment setting
echo 'function debug () {' >> /home/ubuntu/.bash_profile
echo ' case "$1" in "on") export EXA_DEBUG=1 ;;' >> /home/ubuntu/.bash_profile
echo ' "off") export EXA_DEBUG= ;;' >> /home/ubuntu/.bash_profile
echo ' "") [ -n "$EXA_DEBUG" ] && echo "debug on" || echo "debug off" ;;' >> /home/ubuntu/.bash_profile
echo ' *) echo "Usage: debug on|off"; return 1 ;; esac; }' >> /home/ubuntu/.bash_profile
echo 'function strict () {' >> /home/ubuntu/.bash_profile
echo ' case "$1" in "on") export EXA_STRICT=1 ;;' >> /home/ubuntu/.bash_profile
echo ' "off") export EXA_STRICT= ;;' >> /home/ubuntu/.bash_profile
echo ' "") [ -n "$EXA_STRICT" ] && echo "strict on" || echo "strict off" ;;' >> /home/ubuntu/.bash_profile
echo ' *) echo "Usage: strict on|off"; return 1 ;; esac; }' >> /home/ubuntu/.bash_profile
echo 'function ls-colors () {' >> /home/ubuntu/.bash_profile
echo ' case "$1" in "on") export LS_COLORS="di=34:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43" ;;' >> /home/ubuntu/.bash_profile
echo ' "off") export LS_COLORS= ;;' >> /home/ubuntu/.bash_profile
echo ' "") [ -n "$LS_COLORS" ] && echo "LS_COLORS=$LS_COLORS" || echo "ls-colors off" ;;' >> /home/ubuntu/.bash_profile
echo ' *) echo "Usage: ls-colors on|off"; return 1 ;; esac; }' >> /home/ubuntu/.bash_profile
# Disable last login date in sshd
sed -i '/PrintLastLog yes/c
\P
rintLastLog no' /etc/ssh/sshd_config
systemctl restart sshd
EOF
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录