Skip to content

Commit e40ded4

Browse files
chaichontatdeluan
andauthored
Add -x to skip dependency installation (#19)
* Add -x to skip dependency installation Signed-off-by: Chaichontat Sriworarat <[email protected]> * Update README Signed-off-by: Chaichontat Sriworarat <[email protected]> Co-authored-by: Deluan <[email protected]>
1 parent 946cec3 commit e40ded4

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ One line installation: add the following line in your `Dockerfile`:
1818

1919
```Dockerfile
2020
# Default powerline10k theme, no plugins installed
21-
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.4/zsh-in-docker.sh)"
21+
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.5/zsh-in-docker.sh)"
2222
```
2323

2424
#### Optional arguments:
@@ -33,23 +33,26 @@ RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/
3333
- `-a <line>` - You can add extra lines at the end of the generated `.zshrc` (but before loading oh-my-zsh) by
3434
passing one `-a` argument for each line you want to add. This is useful to customize plugins or themes.
3535
For example, if you want to enable [case sensitive completion](https://stackoverflow.com/a/28021691):
36-
36+
- `-x` - Skip installation of dependencies: `zsh`, `git`, `curl`. If you are having issues with the script failing to
37+
install these dependencies due to sudo permissions, you can install them yourself in a prior step, and use this flag
38+
to make the script skip their installation
39+
3740
```Dockerfile
38-
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.4/zsh-in-docker.sh)" -- \
41+
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.5/zsh-in-docker.sh)" -- \
3942
-a 'CASE_SENSITIVE="true"'
4043
```
4144

4245
#### Examples:
4346

4447
```Dockerfile
4548
# Uses "robbyrussell" theme (original Oh My Zsh theme), with no plugins
46-
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.4/zsh-in-docker.sh)" -- \
49+
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.5/zsh-in-docker.sh)" -- \
4750
-t robbyrussell
4851
```
4952

5053
```Dockerfile
5154
# Uses "git", "ssh-agent" and "history-substring-search" bundled plugins
52-
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.4/zsh-in-docker.sh)" -- \
55+
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.5/zsh-in-docker.sh)" -- \
5356
-p git -p ssh-agent -p 'history-substring-search' \
5457
-a 'bindkey "\$terminfo[kcuu1]" history-substring-search-up' \
5558
-a 'bindkey "\$terminfo[kcud1]" history-substring-search-down'
@@ -58,7 +61,7 @@ RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/
5861

5962
```Dockerfile
6063
# Uses "Spaceship" theme with some customization. Uses some bundled plugins and installs some more from github
61-
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.4/zsh-in-docker.sh)" -- \
64+
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.5/zsh-in-docker.sh)" -- \
6265
-t https://github.com/denysdovhan/spaceship-prompt \
6366
-a 'SPACESHIP_PROMPT_ADD_NEWLINE="false"' \
6467
-a 'SPACESHIP_PROMPT_SEPARATE_LINE="false"' \
@@ -74,7 +77,8 @@ RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/
7477
- This scripts requires `git` and `curl` to work properly. If your `Dockerfile` uses `root` as the
7578
main user, it should be fine, as the script will install them automatically. If you are using a
7679
non-root user, make sure to install the `sudo` package _OR_ to install `git` and `curl` packages
77-
_before_ calling this script
80+
_before_ calling this script. In case `sudo` access is an issue and you already have `zsh`, `git`
81+
and `curl`, you can use the option `-x` to skip the installations.
7882
- By default this script will install the `powerlevel10k` theme, as it is one of the fastest and most
7983
customizable themes available for zsh. If you want the default Oh My Zsh theme, use the option
8084
`-t robbyrussell`

zsh-in-docker.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,18 @@ set -e
2525
THEME=default
2626
PLUGINS=""
2727
ZSHRC_APPEND=""
28+
INSTALL_DEPENDENCIES=true
2829

29-
while getopts ":t:p:a:" opt; do
30+
while getopts ":t:p:a:x" opt; do
3031
case ${opt} in
3132
t) THEME=$OPTARG
3233
;;
3334
p) PLUGINS="${PLUGINS}$OPTARG "
3435
;;
3536
a) ZSHRC_APPEND="$ZSHRC_APPEND\n$OPTARG"
3637
;;
38+
x) INSTALL_DEPENDENCIES=false
39+
;;
3740
\?)
3841
echo "Invalid option: $OPTARG" 1>&2
3942
;;
@@ -137,7 +140,9 @@ POWERLEVEL9K_STATUS_CROSS=true
137140
EOM
138141
}
139142

140-
install_dependencies
143+
if [ "$INSTALL_DEPENDENCIES" = true ]; then
144+
install_dependencies
145+
fi
141146

142147
cd /tmp
143148

0 commit comments

Comments
 (0)