image_optim_pack 0.10.1.20240317 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/check.yml +1 -3
- data/.gitignore +0 -1
- data/CHANGELOG.markdown +9 -0
- data/Dockerfile +2 -0
- data/Dockerfile.debian +2 -0
- data/Makefile +10 -3
- data/README.markdown +1 -3
- data/checksums.mk +1 -1
- data/image_optim_pack.gemspec +2 -2
- data/script/livecheck +7 -2
- data/script/platform_downloads +4 -1
- data/script/run +65 -33
- data/vendor/darwin-x86_64/advpng +0 -0
- data/vendor/darwin-x86_64/gifsicle +0 -0
- data/vendor/darwin-x86_64/jhead +0 -0
- data/vendor/darwin-x86_64/jpeg-recompress +0 -0
- data/vendor/darwin-x86_64/jpegoptim +0 -0
- data/vendor/darwin-x86_64/jpegtran +0 -0
- data/vendor/darwin-x86_64/libjpeg.dylib +0 -0
- data/vendor/darwin-x86_64/liblcms2.dylib +0 -0
- data/vendor/darwin-x86_64/libpng.dylib +0 -0
- data/vendor/darwin-x86_64/libz.dylib +0 -0
- data/vendor/darwin-x86_64/optipng +0 -0
- data/vendor/darwin-x86_64/oxipng +0 -0
- data/vendor/darwin-x86_64/pngcrush +0 -0
- data/vendor/darwin-x86_64/pngquant +0 -0
- data/vendor/linux-x86_64/advpng +0 -0
- data/vendor/linux-x86_64/gifsicle +0 -0
- data/vendor/linux-x86_64/jhead +0 -0
- data/vendor/linux-x86_64/jpeg-recompress +0 -0
- data/vendor/linux-x86_64/jpegoptim +0 -0
- data/vendor/linux-x86_64/jpegtran +0 -0
- data/vendor/linux-x86_64/libjpeg.so +0 -0
- data/vendor/linux-x86_64/liblcms2.so +0 -0
- data/vendor/linux-x86_64/libpng.so +0 -0
- data/vendor/linux-x86_64/libz.so +0 -0
- data/vendor/linux-x86_64/optipng +0 -0
- data/vendor/linux-x86_64/oxipng +0 -0
- data/vendor/linux-x86_64/pngcrush +0 -0
- data/vendor/linux-x86_64/pngquant +0 -0
- metadata +4 -12
- data/Vagrantfile +0 -61
- data/boxes/.gitignore +0 -3
- data/boxes/.rubocop.yml +0 -10
- data/boxes/Gemfile +0 -10
- data/boxes/Rakefile +0 -88
- data/boxes/definitions/centos-amd64/definition.rb +0 -32
- data/boxes/definitions/centos-amd64/ks.cfg +0 -37
- data/boxes/definitions/centos-postinstall.sh +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21e4625f02fc1cdef761e5100c7f433ba8d3062a03883b04d650ee6ab7e9bff4
|
4
|
+
data.tar.gz: f2e2e3dc2c48ab57e29d5f59170b1b0c8716c78127d98ea8068bfe2d2a950564
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 056c361fec8574f5c000b9232f0dd0d5ca6c58a052756e119d28b59bf70d39f61d79a92f22f736736253a0ed1a10600424fa2b02ee0e69b993f5b79e9866e175
|
7
|
+
data.tar.gz: b9b1795c31e925729a08bab275a70a7c6f2a1b958d26a7d84c5d08405c61483aa87945e69f2e0fa12a182082b1a9f962d6dd530f4dba148812ed6ee92586dfa5
|
data/.github/workflows/check.yml
CHANGED
data/.gitignore
CHANGED
data/CHANGELOG.markdown
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
## unreleased
|
4
4
|
|
5
|
+
## v0.11.1 (2024-05-09)
|
6
|
+
|
7
|
+
* Use oldest maintained debian buster instead of newest bookworm for building linux binaries [@toy](https://github.com/toy)
|
8
|
+
|
9
|
+
## v0.11.0 (2024-05-05)
|
10
|
+
|
11
|
+
* Use container instead of vagrant to build linux binaries [@toy](https://github.com/toy)
|
12
|
+
* oxipng 9.1.1 [@toy](https://github.com/toy)
|
13
|
+
|
5
14
|
## v0.10.1.20240317 (2024-03-17)
|
6
15
|
|
7
16
|
* gifsicle 1.95 [@toy](https://github.com/toy)
|
data/Dockerfile
CHANGED
@@ -120,8 +120,10 @@ FROM libpng as pngcrush
|
|
120
120
|
ARG PNGCRUSH_VER
|
121
121
|
ARG PNGCRUSH_SHA256
|
122
122
|
COPY download/pngcrush-$PNGCRUSH_VER.tar.gz download/
|
123
|
+
COPY patches/pngcrush.patch patches/
|
123
124
|
RUN ./extract pngcrush && \
|
124
125
|
cd build/pngcrush && \
|
126
|
+
patch < ../../patches/pngcrush.patch && \
|
125
127
|
make && \
|
126
128
|
install -c pngcrush /usr/local/bin
|
127
129
|
|
data/Dockerfile.debian
CHANGED
@@ -120,8 +120,10 @@ FROM libpng as pngcrush
|
|
120
120
|
ARG PNGCRUSH_VER
|
121
121
|
ARG PNGCRUSH_SHA256
|
122
122
|
COPY download/pngcrush-$PNGCRUSH_VER.tar.gz download/
|
123
|
+
COPY patches/pngcrush.patch patches/
|
123
124
|
RUN ./extract pngcrush && \
|
124
125
|
cd build/pngcrush && \
|
126
|
+
patch < ../../patches/pngcrush.patch && \
|
125
127
|
make && \
|
126
128
|
install -c pngcrush /usr/local/bin
|
127
129
|
|
data/Makefile
CHANGED
@@ -13,7 +13,7 @@ LIBMOZJPEG_VER := 4.1.5
|
|
13
13
|
LIBPNG_VER := 1.6.43
|
14
14
|
LIBZ_VER := 1.2.11
|
15
15
|
OPTIPNG_VER := 0.7.8
|
16
|
-
OXIPNG_VER := 9.
|
16
|
+
OXIPNG_VER := 9.1.1
|
17
17
|
PNGCRUSH_VER := 1.8.13
|
18
18
|
PNGOUT_VER := 20200115
|
19
19
|
PNGOUT_LINUX_VER := $(PNGOUT_VER)
|
@@ -45,6 +45,8 @@ OUTPUT_ROOT_DIR := $(CURDIR)/vendor
|
|
45
45
|
OUTPUT_DIR := $(OUTPUT_ROOT_DIR)/$(OS)-$(ARCH)
|
46
46
|
PATCHES_DIR := $(CURDIR)/patches
|
47
47
|
|
48
|
+
export CARGO_HOME := $(DL_DIR)/cargo
|
49
|
+
|
48
50
|
ANSI_RED=\033[31m
|
49
51
|
ANSI_GREEN=\033[32m
|
50
52
|
ANSI_MAGENTA=\033[35m
|
@@ -113,6 +115,10 @@ $(eval $(call archive-dl,PNGQUANT, https://pngquant.org/pngquant-[VER]-src.ta
|
|
113
115
|
download : $(foreach archive,$(ARCHIVES),$($(archive)_ARC))
|
114
116
|
.PHONY : download
|
115
117
|
|
118
|
+
download-dependencies : $(OXIPNG_EXTRACTED)
|
119
|
+
cd $(OXIPNG_DIR) && cargo fetch --locked
|
120
|
+
.PHONY : download-dependencies
|
121
|
+
|
116
122
|
download-tidy-up :
|
117
123
|
rm -f $(filter-out $(foreach archive,$(ARCHIVES),$($(archive)_ARC)),$(wildcard $(DL_DIR)/*.*))
|
118
124
|
.PHONY : download-tidy-up
|
@@ -270,6 +276,7 @@ test :
|
|
270
276
|
update-versions :
|
271
277
|
script/livecheck --update
|
272
278
|
make checksum-update
|
279
|
+
make download-dependencies
|
273
280
|
.PHONY : update-versions
|
274
281
|
|
275
282
|
# ====== DOCKER ======
|
@@ -411,7 +418,7 @@ $(JHEAD_TARGET) :
|
|
411
418
|
## jpeg-recompress
|
412
419
|
$(eval $(call depend-build,JPEG-RECOMPRESS,LIBMOZJPEG))
|
413
420
|
$(JPEG-RECOMPRESS_TARGET) :
|
414
|
-
cd $(DIR) && $(MAKE) jpeg-recompress CC="$(CC) $(CFLAGS)" LIBJPEG=$(LIBMOZJPEG_TARGET) \
|
421
|
+
cd $(DIR) && $(MAKE) jpeg-recompress CC="$(CC) $(CFLAGS) -fcommon" LIBJPEG=$(LIBMOZJPEG_TARGET) \
|
415
422
|
MAKE=$(MAKE) # fix for bsd in jpeg-archive-2.1.1
|
416
423
|
|
417
424
|
## jpegoptim
|
@@ -490,7 +497,7 @@ $(OPTIPNG_TARGET) :
|
|
490
497
|
|
491
498
|
## oxipng
|
492
499
|
$(OXIPNG_TARGET) :
|
493
|
-
cd $(DIR) && cargo build --release --
|
500
|
+
cd $(DIR) && cargo build --release --frozen --offline
|
494
501
|
|
495
502
|
## pngcrush
|
496
503
|
$(eval $(call depend,PNGCRUSH,LIBPNG LIBZ))
|
data/README.markdown
CHANGED
@@ -70,9 +70,7 @@ gem 'image_optim_pack'
|
|
70
70
|
|
71
71
|
## Development
|
72
72
|
|
73
|
-
Mac OS X binaries and libraries are built on host, others using
|
74
|
-
|
75
|
-
Boxes for vagrant are built using [veewee](https://github.com/jedi4ever/veewee), check [boxes/Rakefile](boxes/Rakefile) and [boxes/definitions](boxes/definitions).
|
73
|
+
Mac OS X binaries and libraries are built on host, others using containers.
|
76
74
|
|
77
75
|
```sh
|
78
76
|
script/run # Build and test all for all oses and architectures
|
data/checksums.mk
CHANGED
@@ -9,7 +9,7 @@ LIBMOZJPEG_SHA256 := 9fcbb7171f6ac383f5b391175d6fb3acde5e64c4c4727274eade84ed099
|
|
9
9
|
LIBPNG_SHA256 := e804e465d4b109b5ad285a8fb71f0dd3f74f0068f91ce3cdfde618180c174925
|
10
10
|
LIBZ_SHA256 := c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
|
11
11
|
OPTIPNG_SHA256 := 25a3bd68481f21502ccaa0f4c13f84dcf6b20338e4c4e8c51f2cefbd8513398c
|
12
|
-
OXIPNG_SHA256 :=
|
12
|
+
OXIPNG_SHA256 := f50db90c7ef95c0964dc980f6596b821f362e15d6d4bab247f1eb4aab7554db8
|
13
13
|
PNGCRUSH_SHA256 := fed0aaf5c098aa8c7f78c75365cd18d7341417326ecbdba547876b7b4f3df4be
|
14
14
|
PNGOUT_LINUX_SHA256 := ac38bba6f0de29033de866538c3afa64341319b695bbe388efbc5fd9e830e928
|
15
15
|
PNGOUT_LINUX_STATIC_SHA256 := 7a78ea475d65a00981bf418e5dfa3b34e42d6460fb992340802873bb14b08597
|
data/image_optim_pack.gemspec
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'image_optim_pack'
|
5
|
-
s.version = '0.
|
6
|
-
s.summary = %q{Precompiled binaries for image_optim: advpng, gifsicle, jhead, jpeg-recompress, jpegoptim, jpegtran, optipng, pngcrush, pngquant}
|
5
|
+
s.version = '0.11.1'
|
6
|
+
s.summary = %q{Precompiled binaries for image_optim: advpng, gifsicle, jhead, jpeg-recompress, jpegoptim, jpegtran, optipng, oxipng, pngcrush, pngout, pngquant}
|
7
7
|
s.homepage = "https://github.com/toy/#{s.name}"
|
8
8
|
s.authors = ['Ivan Kuchin']
|
9
9
|
s.license = 'MIT'
|
data/script/livecheck
CHANGED
@@ -122,8 +122,13 @@ class Livecheck
|
|
122
122
|
def update_changelog
|
123
123
|
changelog = FSPath('CHANGELOG.markdown')
|
124
124
|
lines = changelog.readlines
|
125
|
-
|
126
|
-
lines
|
125
|
+
i = 4
|
126
|
+
if lines[i] =~ /^## /
|
127
|
+
lines.insert(i, "\n")
|
128
|
+
else
|
129
|
+
i += 1 while lines[i] =~ /^\* /
|
130
|
+
end
|
131
|
+
lines.insert(i, changelog_entry)
|
127
132
|
write(changelog, lines.join(''))
|
128
133
|
end
|
129
134
|
|
data/script/platform_downloads
CHANGED
@@ -5,7 +5,10 @@ require 'gems'
|
|
5
5
|
require 'ostruct'
|
6
6
|
require 'terminal-table'
|
7
7
|
|
8
|
-
versions = Gems.versions('image_optim_pack').map
|
8
|
+
versions = Gems.versions('image_optim_pack').map do |attributes|
|
9
|
+
attributes['number'] = Gem::Version.new(attributes['number'])
|
10
|
+
OpenStruct.new(attributes) # rubocop:disable Style/OpenStructUse
|
11
|
+
end
|
9
12
|
|
10
13
|
platforms = versions.map(&:platform).uniq.sort_by do |platform|
|
11
14
|
platform.sub('amd64', 'x86_64').split('-').reverse
|
data/script/run
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
#!/usr/bin/env bash
|
1
|
+
#!/usr/bin/env bash -e
|
2
2
|
|
3
3
|
# Build tools on Mac OS X host and in all vms
|
4
4
|
|
5
|
-
set -e
|
6
|
-
|
7
5
|
MAKE_TASK='all -j'
|
8
6
|
|
9
7
|
filters=()
|
@@ -29,6 +27,8 @@ if [[ $(uname -s) != 'Darwin' ]]; then
|
|
29
27
|
exit 1
|
30
28
|
fi
|
31
29
|
|
30
|
+
make download-dependencies
|
31
|
+
|
32
32
|
for arch in x86_64; do
|
33
33
|
platform="darwin-$arch"
|
34
34
|
passes-filter "$platform" || continue
|
@@ -38,53 +38,85 @@ for arch in x86_64; do
|
|
38
38
|
|
39
39
|
mkdir -p "vendor/$platform"
|
40
40
|
|
41
|
-
|
42
|
-
set -e
|
41
|
+
rsync -aR --del Makefile checksums.mk download patches "$build_dir"
|
43
42
|
|
43
|
+
sudo -u _image_optim --set-home bash -exc "
|
44
44
|
mkdir -p '$build_dir'
|
45
45
|
cd '$build_dir'
|
46
46
|
|
47
|
-
ln -nsf '$PWD/Makefile' '$PWD/checksums.mk' '$PWD/download' '$PWD/patches' .
|
48
|
-
rsync -aR --del '$PWD/./vendor/$platform' .
|
49
|
-
|
50
47
|
make $MAKE_TASK ARCH=$arch
|
51
48
|
"
|
52
49
|
|
53
50
|
rsync -aR --del "$build_dir/./vendor/$platform" .
|
54
51
|
done
|
55
52
|
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
if command -v docker &> /dev/null; then
|
54
|
+
container_tool="docker"
|
55
|
+
elif command -v podman &> /dev/null; then
|
56
|
+
container_tool="podman"
|
57
|
+
else
|
58
|
+
echo "neither docker nor podman found"
|
59
|
+
exit 1
|
60
|
+
fi
|
59
61
|
|
60
|
-
|
61
|
-
|
62
|
-
|
62
|
+
container_build() {
|
63
|
+
vm=$1
|
64
|
+
image=$2
|
65
|
+
|
66
|
+
passes-filter "$vm" || return 0
|
67
|
+
header "$vm"
|
63
68
|
|
64
|
-
|
65
|
-
|
66
|
-
vagrant ssh-config "$vm" > "$ssh_config"
|
69
|
+
container_name="image_optim_pack-build-$vm"
|
70
|
+
workdir=/pack
|
67
71
|
|
68
|
-
|
69
|
-
|
70
|
-
|
72
|
+
if [[ -z "$NO_UP" ]]; then
|
73
|
+
status=$("$container_tool" inspect --format '{{.State.Status}}' "$container_name" 2>/dev/null || true)
|
74
|
+
|
75
|
+
if [[ "$status" == "" ]]; then
|
76
|
+
mount="./_path_:$workdir/_path_"
|
77
|
+
|
78
|
+
"$container_tool" \
|
79
|
+
container create \
|
80
|
+
--name="$container_name" \
|
81
|
+
--stop-signal SIGHUP \
|
82
|
+
-it \
|
83
|
+
-v "${mount//_path_/}:ro" \
|
84
|
+
-v "${mount//_path_/build/$vm}" \
|
85
|
+
-v "${mount//_path_/vendor/$vm}" \
|
86
|
+
--workdir "$workdir" \
|
87
|
+
"$image"
|
88
|
+
|
89
|
+
"$container_tool" container start "$container_name"
|
90
|
+
|
91
|
+
"$container_tool" exec -it "$container_name" bash -exc "
|
92
|
+
apt update
|
93
|
+
apt -y install make gcc g++ chrpath perl pkg-config autoconf automake libtool nasm cmake patch
|
94
|
+
"
|
95
|
+
fi
|
71
96
|
|
72
|
-
|
73
|
-
|
74
|
-
|
97
|
+
if [[ "$status" = @(created|exited) ]]; then
|
98
|
+
"$container_tool" container start "$container_name"
|
99
|
+
fi
|
75
100
|
|
76
|
-
|
101
|
+
if [[ "$status" = @(created|exited|running) ]]; then
|
102
|
+
"$container_tool" exec -it "$container_name" bash -exc "
|
103
|
+
apt update
|
104
|
+
apt -y dist-upgrade
|
105
|
+
rustup update
|
106
|
+
"
|
107
|
+
fi
|
77
108
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
else
|
82
|
-
gmake $MAKE_TASK
|
109
|
+
if ! [[ "$status" = @(|created|exited|running) ]]; then
|
110
|
+
echo "unexpected status $status"
|
111
|
+
exit 1
|
83
112
|
fi
|
113
|
+
fi
|
114
|
+
|
115
|
+
"$container_tool" exec -it "$container_name" bash -exc "
|
116
|
+
make $MAKE_TASK
|
84
117
|
"
|
85
118
|
|
86
|
-
|
87
|
-
|
119
|
+
[[ -n "$NO_HALT" ]] || "$container_tool" container stop "$container_name"
|
120
|
+
}
|
88
121
|
|
89
|
-
|
90
|
-
done
|
122
|
+
container_build linux-x86_64 rust:slim-buster
|
data/vendor/darwin-x86_64/advpng
CHANGED
Binary file
|
Binary file
|
data/vendor/darwin-x86_64/jhead
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/vendor/darwin-x86_64/oxipng
CHANGED
Binary file
|
Binary file
|
Binary file
|
data/vendor/linux-x86_64/advpng
CHANGED
Binary file
|
Binary file
|
data/vendor/linux-x86_64/jhead
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/vendor/linux-x86_64/libz.so
CHANGED
Binary file
|
data/vendor/linux-x86_64/optipng
CHANGED
Binary file
|
data/vendor/linux-x86_64/oxipng
CHANGED
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: image_optim_pack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Kuchin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: image_optim
|
@@ -112,7 +112,6 @@ files:
|
|
112
112
|
- LICENSE.txt
|
113
113
|
- Makefile
|
114
114
|
- README.markdown
|
115
|
-
- Vagrantfile
|
116
115
|
- acknowledgements/7z.txt
|
117
116
|
- acknowledgements/advancecomp.txt
|
118
117
|
- acknowledgements/bmp2png.txt
|
@@ -139,13 +138,6 @@ files:
|
|
139
138
|
- acknowledgements/zlib.txt
|
140
139
|
- acknowledgements/zopfli-contributors.txt
|
141
140
|
- acknowledgements/zopfli.txt
|
142
|
-
- boxes/.gitignore
|
143
|
-
- boxes/.rubocop.yml
|
144
|
-
- boxes/Gemfile
|
145
|
-
- boxes/Rakefile
|
146
|
-
- boxes/definitions/centos-amd64/definition.rb
|
147
|
-
- boxes/definitions/centos-amd64/ks.cfg
|
148
|
-
- boxes/definitions/centos-postinstall.sh
|
149
141
|
- checksums.mk
|
150
142
|
- image_optim_pack-darwin-x86_64.gemspec
|
151
143
|
- image_optim_pack-linux-x86_64.gemspec
|
@@ -196,7 +188,7 @@ licenses:
|
|
196
188
|
metadata:
|
197
189
|
bug_tracker_uri: https://github.com/toy/image_optim_pack/issues
|
198
190
|
changelog_uri: https://github.com/toy/image_optim_pack/blob/master/CHANGELOG.markdown
|
199
|
-
documentation_uri: https://www.rubydoc.info/gems/image_optim_pack/0.
|
191
|
+
documentation_uri: https://www.rubydoc.info/gems/image_optim_pack/0.11.1
|
200
192
|
source_code_uri: https://github.com/toy/image_optim_pack
|
201
193
|
post_install_message:
|
202
194
|
rdoc_options: []
|
@@ -217,7 +209,7 @@ rubygems_version: 3.5.5
|
|
217
209
|
signing_key:
|
218
210
|
specification_version: 4
|
219
211
|
summary: 'Precompiled binaries for image_optim: advpng, gifsicle, jhead, jpeg-recompress,
|
220
|
-
jpegoptim, jpegtran, optipng, pngcrush, pngquant'
|
212
|
+
jpegoptim, jpegtran, optipng, oxipng, pngcrush, pngout, pngquant'
|
221
213
|
test_files:
|
222
214
|
- spec/image_optim/pack_spec.rb
|
223
215
|
- spec/image_optim_spec.rb
|
data/Vagrantfile
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
Vagrant.configure('2') do |config|
|
2
|
-
# don't mess with keys
|
3
|
-
config.ssh.insert_key = false
|
4
|
-
|
5
|
-
# doesn't make sense to check updates for local boxes
|
6
|
-
config.vm.box_check_update = false
|
7
|
-
|
8
|
-
# there are no guest additions
|
9
|
-
config.vm.provider 'virtualbox' do |vb|
|
10
|
-
vb.check_guest_additions = false
|
11
|
-
vb.customize ['modifyvm', :id, '--groups', '/image_optim']
|
12
|
-
vb.customize ['modifyvm', :id, '--uartmode1', 'disconnected'] # override for ubuntu/xenial32
|
13
|
-
end
|
14
|
-
|
15
|
-
# handle manually using rsync
|
16
|
-
config.vm.synced_folder '.', '/vagrant', disabled: true
|
17
|
-
|
18
|
-
{
|
19
|
-
'linux-x86_64' => 'boxes/centos-amd64.box',
|
20
|
-
}.each do |name, location|
|
21
|
-
config.vm.define name do |machine|
|
22
|
-
machine.vm.hostname = name.gsub('_', '-')
|
23
|
-
machine.vm.box = location
|
24
|
-
|
25
|
-
machine.vm.provision :shell, inline: <<-SH
|
26
|
-
if command -v apt-get; then
|
27
|
-
set -ex
|
28
|
-
|
29
|
-
apt-get update
|
30
|
-
apt-get -y install rsync ntpdate make wget gcc g++ chrpath perl pkg-config autoconf automake libtool nasm cmake cargo patch
|
31
|
-
apt-get -y remove unattended-upgrades
|
32
|
-
else
|
33
|
-
set -ex
|
34
|
-
|
35
|
-
yum -y install epel-release
|
36
|
-
yum -y install rsync ntpdate make wget gcc gcc-c++ chrpath perl pkg-config autoconf automake libtool nasm cmake cargo patch
|
37
|
-
fi
|
38
|
-
|
39
|
-
mkdir -p /vagrant
|
40
|
-
chown vagrant:vagrant /vagrant
|
41
|
-
SH
|
42
|
-
|
43
|
-
machine.vm.provision :shell, run: 'always', inline: <<-SH
|
44
|
-
if command -v apt-get; then
|
45
|
-
set -ex
|
46
|
-
|
47
|
-
apt-get update
|
48
|
-
apt-get -y dist-upgrade
|
49
|
-
|
50
|
-
if [ $(lsb_release -r | egrep -o '[0-9]+' | head -1) -lt 18 ]; then
|
51
|
-
do-release-upgrade -f DistUpgradeViewNonInteractive
|
52
|
-
fi
|
53
|
-
else
|
54
|
-
set -ex
|
55
|
-
|
56
|
-
yum -y update
|
57
|
-
fi
|
58
|
-
SH
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
data/boxes/.gitignore
DELETED
data/boxes/.rubocop.yml
DELETED
data/boxes/Gemfile
DELETED
data/boxes/Rakefile
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'pathname'
|
4
|
-
|
5
|
-
class Box # :nodoc:
|
6
|
-
attr_reader :definition_path, :definition_dir, :name, :path, :groups
|
7
|
-
|
8
|
-
def initialize(definition_path)
|
9
|
-
@definition_path = Pathname(definition_path)
|
10
|
-
@definition_dir = @definition_path.dirname
|
11
|
-
@name = @definition_dir.basename.to_s
|
12
|
-
@path = Pathname("#{@name}.box")
|
13
|
-
parts = @name.split('-')
|
14
|
-
@groups = (1...parts.length).map{ |n| parts.take(n).join('-') }
|
15
|
-
end
|
16
|
-
|
17
|
-
def dependencies
|
18
|
-
postinstall_file_paths = Array(definition[:postinstall_files]).map do |path|
|
19
|
-
definition_dir + path
|
20
|
-
end
|
21
|
-
[definition_path] + postinstall_file_paths
|
22
|
-
end
|
23
|
-
|
24
|
-
def build
|
25
|
-
sh(*%W[veewee vbox build --auto --checksum --force --nogui #{name}])
|
26
|
-
sh(*%w[sleep 30])
|
27
|
-
sh(*%W[veewee vbox export --force #{name}])
|
28
|
-
sh(*%W[veewee vbox destroy #{name}])
|
29
|
-
end
|
30
|
-
|
31
|
-
def add
|
32
|
-
assert_box_created
|
33
|
-
|
34
|
-
sh(*%W[vagrant box add --force --name boxes/#{path} #{path}])
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def definition
|
40
|
-
@definition ||= eval definition_path.read.sub('Veewee::Session.declare', '{}.merge')
|
41
|
-
end
|
42
|
-
|
43
|
-
def assert_box_created
|
44
|
-
abort "#{path} doesn't exist" unless path.size?
|
45
|
-
end
|
46
|
-
|
47
|
-
def sh(*args)
|
48
|
-
abort unless system(*args)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
Dir['definitions/*/definition.rb'].each do |definition_path|
|
53
|
-
box = Box.new(definition_path)
|
54
|
-
|
55
|
-
desc "build #{box.name} box"
|
56
|
-
file box.path => box.dependencies do
|
57
|
-
box.build
|
58
|
-
end
|
59
|
-
|
60
|
-
namespace :add do
|
61
|
-
desc "add #{box.name} box to vagrant"
|
62
|
-
task box.name => box.path do
|
63
|
-
box.add
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
box.groups.each do |group|
|
68
|
-
desc "build #{group} boxes"
|
69
|
-
task "build:#{group}" => box.path
|
70
|
-
|
71
|
-
desc "add #{group} boxes to vagrant"
|
72
|
-
task "add:#{group}" => "add:#{box.name}"
|
73
|
-
end
|
74
|
-
|
75
|
-
desc 'build all boxes'
|
76
|
-
task build: box.path
|
77
|
-
|
78
|
-
desc 'add all boxes to vagrant'
|
79
|
-
task add: "add:#{box.name}"
|
80
|
-
end
|
81
|
-
|
82
|
-
desc 'remove *.box and iso dir'
|
83
|
-
task :clean do
|
84
|
-
sh 'rm *.box || true'
|
85
|
-
sh 'rm -r iso || true'
|
86
|
-
end
|
87
|
-
|
88
|
-
task default: :build
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Veewee::Session.declare({
|
4
|
-
cpu_count: '1',
|
5
|
-
memory_size: '512',
|
6
|
-
disk_size: '8192',
|
7
|
-
disk_format: 'VDI',
|
8
|
-
hostiocache: 'off',
|
9
|
-
os_type_id: 'RedHat6_64',
|
10
|
-
iso_file: 'CentOS-7-x86_64-Minimal-2009.iso',
|
11
|
-
iso_src: 'http://linux.darkpenguin.net/distros/CentOS/7.9.2009/isos/x86_64/CentOS-7-x86_64-Minimal-2009.iso',
|
12
|
-
iso_sha256: '07b94e6b1a0b0260b94c83d6bb76b26bf7a310dc78d7a9c7432809fb9bc6194a',
|
13
|
-
iso_download_timeout: '1000',
|
14
|
-
boot_wait: '10',
|
15
|
-
boot_cmd_sequence: [
|
16
|
-
'<Tab> text ks=http://%IP%:%PORT%/ks.cfg<Enter>',
|
17
|
-
],
|
18
|
-
kickstart_port: '7122',
|
19
|
-
kickstart_timeout: '300',
|
20
|
-
kickstart_file: 'ks.cfg',
|
21
|
-
ssh_login_timeout: '10000',
|
22
|
-
ssh_user: 'veewee',
|
23
|
-
ssh_password: 'veewee',
|
24
|
-
ssh_key: '',
|
25
|
-
ssh_host_port: '7222',
|
26
|
-
ssh_guest_port: '22',
|
27
|
-
sudo_cmd: "echo '%p'|sudo -S sh '%f'",
|
28
|
-
shutdown_cmd: '/sbin/halt -h -p',
|
29
|
-
postinstall_files: %w[../centos-postinstall.sh],
|
30
|
-
postinstall_timeout: '10000',
|
31
|
-
skip_iso_transfer: true,
|
32
|
-
})
|
@@ -1,37 +0,0 @@
|
|
1
|
-
install
|
2
|
-
cdrom
|
3
|
-
lang en_US.UTF-8
|
4
|
-
keyboard us
|
5
|
-
network --bootproto=dhcp
|
6
|
-
rootpw --iscrypted $1$damlkd,f$UC/u5pUts5QiU3ow.CSso/
|
7
|
-
firewall --enabled --service=ssh
|
8
|
-
authconfig --enableshadow --passalgo=sha512
|
9
|
-
selinux --disabled
|
10
|
-
timezone UTC
|
11
|
-
bootloader --location=mbr
|
12
|
-
|
13
|
-
text
|
14
|
-
skipx
|
15
|
-
zerombr
|
16
|
-
|
17
|
-
clearpart --all --initlabel
|
18
|
-
autopart
|
19
|
-
|
20
|
-
auth --useshadow --enablemd5
|
21
|
-
firstboot --disabled
|
22
|
-
reboot
|
23
|
-
|
24
|
-
%packages --nobase
|
25
|
-
@core
|
26
|
-
openssh-clients
|
27
|
-
%end
|
28
|
-
|
29
|
-
%post
|
30
|
-
/usr/bin/yum -y install sudo
|
31
|
-
/usr/sbin/groupadd veewee
|
32
|
-
/usr/sbin/useradd veewee -g veewee -G wheel
|
33
|
-
echo "veewee"|passwd --stdin veewee
|
34
|
-
echo "veewee ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/veewee
|
35
|
-
chmod 0440 /etc/sudoers.d/veewee
|
36
|
-
%end
|
37
|
-
|
@@ -1,29 +0,0 @@
|
|
1
|
-
set -ex
|
2
|
-
|
3
|
-
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
|
4
|
-
|
5
|
-
yum -y install wget
|
6
|
-
|
7
|
-
# Make ssh faster by not waiting on DNS
|
8
|
-
echo "UseDNS no" >> /etc/ssh/sshd_config
|
9
|
-
|
10
|
-
# Vagrant specific
|
11
|
-
date > /etc/vagrant_box_build_time
|
12
|
-
|
13
|
-
# Add vagrant user
|
14
|
-
/usr/sbin/groupadd vagrant
|
15
|
-
/usr/sbin/useradd vagrant -g vagrant -G wheel
|
16
|
-
echo "vagrant"|passwd --stdin vagrant
|
17
|
-
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant
|
18
|
-
chmod 0440 /etc/sudoers.d/vagrant
|
19
|
-
|
20
|
-
# Installing vagrant keys
|
21
|
-
mkdir -pm 700 /home/vagrant/.ssh
|
22
|
-
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys
|
23
|
-
chmod 0600 /home/vagrant/.ssh/authorized_keys
|
24
|
-
chown -R vagrant /home/vagrant/.ssh
|
25
|
-
|
26
|
-
yum -y clean all
|
27
|
-
|
28
|
-
# Zero out the free space to save space in the final image
|
29
|
-
dd if=/dev/zero of=/filler bs=1M || rm /filler
|