Last active
October 30, 2023 08:34
-
-
Save okinjp/f11a4b53db601776b1df2714128b7c2e to your computer and use it in GitHub Desktop.
Shellscript for podman compose as podman-compose
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
#!/usr/bin/env bash | |
#### | |
# Notice: This script must be in /usr/local/bin because the default "podman" is in /usr/bin and the shell prefers commands from /usr/local/bin over /usr/bin. | |
# | |
# How to install this script on your computer. | |
# 1. Open your terminal | |
# 2. Copy | |
# " | |
# sudo curl -Ls https://ip1.info/gist_dl/get_podman_sh.php -o /usr/local/bin/podman && sudo chmod +x /usr/local/bin/podman | |
# " | |
# 3. Paste to your terminal | |
#### | |
PODMAN=$(PATH=/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin which podman) | |
if [ ! "$PODMAN" ];then | |
echo "Missing podman" | |
exit | |
fi | |
if [[ "$@" = "compose"* ]] && [ $? -gt 2 ];then | |
PODMANCOMPOSE=$(PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin which podman-compose) | |
if [ ! "PODMANCOMPOSE" ];then | |
echo "Missing podman-compose" | |
fi | |
# podman compose ~ to podman-compose ~ | |
ARGSARR=$@ | |
/usr/bin/podman-compose ${ARGSARR[@]:1:((${#ARGSARR[@]}))} | |
exit | |
elif [[ "$@" = "compose"* ]];then | |
/usr/bin/podman-compose | |
exit | |
else | |
$PODMAN $@ | |
exit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment