Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Getting script to work with /bin/sh #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions docker-gc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# Copyright (c) 2014 Spotify AB.
#
Expand Down Expand Up @@ -68,7 +68,7 @@ fi
EXCLUDE_IDS_FILE="exclude_ids"
EXCLUDE_CONTAINER_IDS_FILE="exclude_container_ids"

function date_parse {
date_parse() {
if date --utc >/dev/null 2>&1; then
# GNU/date
echo $(date -u --date "${1}" "+%s")
Expand All @@ -79,7 +79,7 @@ function date_parse {
}

# Elapsed time since a docker timestamp, in seconds
function elapsed_time() {
elapsed_time() {
# Docker 1.5.0 datetime format is 2015-07-03T02:39:00.390284991
# Docker 1.7.0 datetime format is 2015-07-03 02:39:00.390284991 +0000 UTC
utcnow=$(date -u "+%s")
Expand All @@ -90,7 +90,7 @@ function elapsed_time() {
echo $(($utcnow - $epoch))
}

function compute_exclude_ids() {
compute_exclude_ids() {
# Find images that match patterns in the EXCLUDE_FROM_GC file and put their
# id prefixes into $EXCLUDE_IDS_FILE, prefixed with ^

Expand Down Expand Up @@ -118,7 +118,7 @@ function compute_exclude_ids() {
| sed 's/^/^/' > $EXCLUDE_IDS_FILE
}

function compute_exclude_container_ids() {
compute_exclude_container_ids() {
# Find containers matching to patterns listed in EXCLUDE_CONTAINERS_FROM_GC file
# Implode their values with a \| separator on a single line
PROCESSED_EXCLUDES=`cat $EXCLUDE_CONTAINERS_FROM_GC \
Expand Down