mirror of https://github.com/dirtbags/moth.git
add fizzbuzz
This commit is contained in:
parent
23bd50f9bb
commit
8420f518ab
|
@ -0,0 +1,13 @@
|
|||
#! /bin/sh
|
||||
|
||||
for i in $(seq 100); do
|
||||
if [ $(expr $i % 15) = 0 ]; then
|
||||
echo 'FizzBuzz'
|
||||
elif [ $(expr $i % 3) = 0 ]; then
|
||||
echo 'Fizz'
|
||||
elif [ $(expr $i % 5) = 0 ]; then
|
||||
echo 'Buzz'
|
||||
else
|
||||
echo $i
|
||||
fi
|
||||
done
|
|
@ -0,0 +1,29 @@
|
|||
FIZZBUZZ_PKGDIR = $(TARGET)/fizzbuzz
|
||||
FIZZBUZZ_BUILDDIR = $(BUILD)/fizzbuzz
|
||||
|
||||
$(FIZZBUZZ_BUILDDIR)/token.enc: packages/fizzbuzz/tokens.txt
|
||||
$(FIZZBUZZ_BUILDDIR)/token.enc: packages/fizzbuzz/fizzbuzz-client.sh
|
||||
$(FIZZBUZZ_BUILDDIR)/token.enc: $(FIZZBUZZ_BUILDDIR)/fizzbuzz-native
|
||||
packages/fizzbuzz/fizzbuzz-client.sh | $(FIZZBUZZ_BUILDDIR)/fizzbuzz-native 3< packages/fizzbuzz/tokens.txt > $@
|
||||
|
||||
$(FIZZBUZZ_BUILDDIR)/fizzbuzz-native: packages/fizzbuzz/src/fizzbuzz.c
|
||||
@ mkdir -p $(@D)
|
||||
cc -o $@ $<
|
||||
|
||||
fizzbuzz-install: fizzbuzz-build
|
||||
mkdir -p $(FIZZBUZZ_PKGDIR)/bin/
|
||||
|
||||
$(call COPYTREE, packages/fizzbuzz/service, $(FIZZBUZZ_PKGDIR)/service)
|
||||
|
||||
cp packages/fizzbuzz/tokens.txt $(FIZZBUZZ_PKGDIR)/
|
||||
cp $(FIZZBUZZ_BUILDDIR)/token.enc $(FIZZBUZZ_PKGDIR)/
|
||||
cp packages/fizzbuzz/src/fizzbuzz $(FIZZBUZZ_PKGDIR)/bin/
|
||||
|
||||
fizzbuzz-clean:
|
||||
rm -rf $(FIZZBUZZ_PKGDIR) $(FIZZBUZZ_BUILDDIR)
|
||||
$(MAKE) -C packages/fizzbuzz/src clean
|
||||
|
||||
fizzbuzz-build: $(FIZZBUZZ_BUILDDIR)/token.enc
|
||||
$(MAKE) -C packages/fizzbuzz/src build
|
||||
|
||||
PACKAGES += fizzbuzz
|
|
@ -0,0 +1,11 @@
|
|||
CFLAGS = -Wall -Werror
|
||||
TARGETS = fizzbuzz
|
||||
|
||||
all: build
|
||||
build: $(TARGETS)
|
||||
|
||||
install: $(TARGETS)
|
||||
install -m 0755 $(TARGETS) $(DESTDIR)/bin
|
||||
|
||||
clean:
|
||||
rm -f *.o $(TARGETS)
|
|
@ -1,5 +1,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* How this works:
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
net:xuhen-fizuv-syvex
|
|
@ -4,10 +4,11 @@ exec 2>&1
|
|||
|
||||
install -d /var/lib/ctf
|
||||
|
||||
# Create CTF user
|
||||
# Create CTF and nobody users
|
||||
touch /etc/group /etc/passwd
|
||||
addgroup -g 56634 nogroup || true
|
||||
addgroup -g 65534 nogroup || true
|
||||
adduser -D -S -h /var/lib/ctf -H ctf || true
|
||||
adduser -D -g nogroup -u 65534 -h /tmp -H nobody || true
|
||||
|
||||
# Set up base directories
|
||||
NEWDIR=/var/lib/ctf/points.new
|
||||
|
|
Loading…
Reference in New Issue