Compare commits
No commits in common. "master" and "v0.3.0" have entirely different histories.
@ -15,8 +15,8 @@ pipeline:
|
|||||||
image: golang:1.16
|
image: golang:1.16
|
||||||
commands:
|
commands:
|
||||||
- go mod vendor
|
- go mod vendor
|
||||||
- GOOS=linux GOARCH=amd64 go build -ldflags "-X git.metaunix.net/BitGoblin/adept/cmd.version=${CI_COMMIT_TAG}" -o "dist/adept-linux-amd64-${CI_COMMIT_TAG}"
|
- GOOS=linux GOARCH=amd64 go build -o "dist/adept-linux-amd64-${CI_COMMIT_TAG}"
|
||||||
- GOOS=windows GOARCH=amd64 go build -ldflags "-X git.metaunix.net/BitGoblin/adept/cmd.version=${CI_COMMIT_TAG}" -o "dist/adept-windows-amd64-${CI_COMMIT_TAG}.exe"
|
- GOOS=windows GOARCH=amd64 go build -o "dist/adept-windows-amd64-${CI_COMMIT_TAG}.exe"
|
||||||
when:
|
when:
|
||||||
event: tag
|
event: tag
|
||||||
|
|
||||||
|
7
Makefile
7
Makefile
@ -2,7 +2,7 @@ BINARY_NAME=adept
|
|||||||
|
|
||||||
all: build test
|
all: build test
|
||||||
|
|
||||||
compile:
|
build:
|
||||||
go build -o ${BINARY_NAME} adept.go
|
go build -o ${BINARY_NAME} adept.go
|
||||||
|
|
||||||
test:
|
test:
|
||||||
@ -31,8 +31,7 @@ uninstall:
|
|||||||
rm /usr/bin/${BINARY_NAME}
|
rm /usr/bin/${BINARY_NAME}
|
||||||
rm /etc/systemd/system/${BINARY_NAME}.service
|
rm /etc/systemd/system/${BINARY_NAME}.service
|
||||||
rm -rf /etc/${BINARY_NAME}
|
rm -rf /etc/${BINARY_NAME}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
go clean
|
go clean
|
||||||
|
rm ${BINARY_NAME}
|
||||||
.PHONY: all test clean
|
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Check that we've been supplied a valid version
|
|
||||||
VERSION="$1"
|
|
||||||
if [ "$VERSION" == "" ]; then
|
|
||||||
echo -e "You must supply a version tag like './build_deb.sh 1.2.3'."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
# Trim the leading 'v' from version number
|
|
||||||
if [[ "${VERSION:0:1}" == "v" ]]; then
|
|
||||||
VERSION="${VERSION:1}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create workspace for our deb package
|
|
||||||
WORKDIR="adept_$VERSION"
|
|
||||||
mkdir "$WORKDIR"
|
|
||||||
|
|
||||||
# Copy build sources into workspace
|
|
||||||
cp -r build/etc "$WORKDIR/"
|
|
||||||
mkdir -p "$WORKDIR/usr/bin/"
|
|
||||||
cp "dist/adept-linux-amd64-v$VERSION" "$WORKDIR/usr/bin/adept"
|
|
||||||
|
|
||||||
# Create debian control file
|
|
||||||
mkdir "$WORKDIR/DEBIAN"
|
|
||||||
cat > "$WORKDIR/DEBIAN/control"<< EOF
|
|
||||||
Package: adept
|
|
||||||
Version: $VERSION
|
|
||||||
Section: video
|
|
||||||
Priority: optional
|
|
||||||
Architecture: amd64
|
|
||||||
Depends: ffmpeg (>= 4), lsof
|
|
||||||
Maintainer: Gregory Ballantine <gballantine@bitgoblin.tech>
|
|
||||||
Description: Bit Goblin video transcoding service.
|
|
||||||
EOF
|
|
||||||
# Copy maintainer scripts
|
|
||||||
cp build/scripts/* "$WORKDIR/DEBIAN/"
|
|
||||||
#chmod +rx "$WORKDIR"/DEBIAN/pre*
|
|
||||||
chmod +rx "$WORKDIR"/DEBIAN/post*
|
|
||||||
|
|
||||||
# Build deb package!
|
|
||||||
dpkg-deb --build "$WORKDIR"
|
|
||||||
|
|
||||||
# Cleanup
|
|
||||||
rm -rf "$WORKDIR"
|
|
@ -1,74 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Check that we've been supplied a valid version
|
|
||||||
VERSION="$1"
|
|
||||||
if [ "$VERSION" == "" ]; then
|
|
||||||
echo -e "You must supply a version tag like './build_rpm.sh 1.2.3'."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
# Trim the leading 'v' from version number
|
|
||||||
if [[ "${VERSION:0:1}" == "v" ]]; then
|
|
||||||
VERSION="${VERSION:1}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Tar up source files
|
|
||||||
mkdir rpm-temp
|
|
||||||
cp -r cmd config transcoder util adept.go go.mod go.sum LICENSE Makefile README.md rpm-temp/
|
|
||||||
tar cvzf "adept-$VERSION.tar.gz" rpm-temp/*
|
|
||||||
mv "adept-$VERSION.tar.gz" ~/rpmbuild/SOURCES/
|
|
||||||
|
|
||||||
# Create debian control file
|
|
||||||
cat > "./adept.spec"<< EOF
|
|
||||||
Name: adept
|
|
||||||
Version: $VERSION
|
|
||||||
Release: 1%{?dist}
|
|
||||||
Summary: Bit Goblin video transcoding service
|
|
||||||
|
|
||||||
License: BSD 2-Clause
|
|
||||||
Source0: %{name}-%{version}.tar.gz
|
|
||||||
|
|
||||||
BuildRequires: golang
|
|
||||||
BuildRequires: systemd-rpm-macros
|
|
||||||
|
|
||||||
Provides: %{name} = %{version}
|
|
||||||
|
|
||||||
%description
|
|
||||||
Bit Goblin video transcoding service
|
|
||||||
|
|
||||||
%global debug_package %{nil}
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%autosetup
|
|
||||||
|
|
||||||
|
|
||||||
%build
|
|
||||||
go build -v -o %{name}
|
|
||||||
|
|
||||||
|
|
||||||
%install
|
|
||||||
install -Dpm 0755 %{name} %{buildroot}%{_bindir}/%{name}
|
|
||||||
install -Dpm 0755 build/etc/%{name}/%{name}.toml %{buildroot}%{_sysconfdir}/%{name}/%{name}.toml
|
|
||||||
install -Dpm 644 build/etc/systemd/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
|
|
||||||
|
|
||||||
%check
|
|
||||||
# go test should be here... :)
|
|
||||||
|
|
||||||
%post
|
|
||||||
%systemd_post %{name}.service
|
|
||||||
|
|
||||||
%preun
|
|
||||||
%systemd_preun %{name}.service
|
|
||||||
|
|
||||||
%files
|
|
||||||
%dir %{_sysconfdir}/%{name}
|
|
||||||
%{_bindir}/%{name}
|
|
||||||
%{_unitdir}/%{name}.service
|
|
||||||
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.toml
|
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
|
||||||
* Thu Nov 17 2022 Gregory Ballantine $VERSION
|
|
||||||
- check git.metaunix.net/BitGoblin/adept for a changelog
|
|
||||||
EOF
|
|
||||||
|
|
||||||
rpmbuild -ba adept.spec
|
|
@ -1,9 +1,9 @@
|
|||||||
log_to_file = true
|
log_to_file = true
|
||||||
log_file = '/var/log/adept/adept.log'
|
log_file = '~/adept/adept.log'
|
||||||
log_level = 'info'
|
log_level = 'info'
|
||||||
|
|
||||||
[transcoder]
|
[transcoder]
|
||||||
repository = '/srv/adept'
|
repository = '~/adept'
|
||||||
interval = 15
|
interval = 15
|
||||||
video_format = 'mov'
|
video_format = 'mov'
|
||||||
video_codec = 'dnxhd'
|
video_codec = 'dnxhd'
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
GETENT_USER=$(getent passwd adept)
|
|
||||||
# Create the adept user if it doesn't already exist
|
|
||||||
if [ "$GETENT_USER" = "" ]; then
|
|
||||||
echo "Creating the 'adept' user."
|
|
||||||
useradd -r adept
|
|
||||||
else
|
|
||||||
echo "The 'adept' user already exists, skipping creation."
|
|
||||||
fi
|
|
||||||
|
|
||||||
GETENT_GROUP=$(getent group adept)
|
|
||||||
# Create the adept group if it doesn't already exist
|
|
||||||
if [ "$GETENT_GROUP" = "" ]; then
|
|
||||||
echo "Creating the 'adept' group."
|
|
||||||
groupadd adept
|
|
||||||
usermod -aG adept adept
|
|
||||||
else
|
|
||||||
echo "The 'adept' group already exists, skipping creation."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Change the directory ownership of /etc
|
|
||||||
chown -R adept:adept /etc/adept
|
|
||||||
|
|
||||||
# Create the log directory under /var/log
|
|
||||||
if [ ! -d /var/log/adept ]; then
|
|
||||||
echo "Creating /var/log/adept to store log files."
|
|
||||||
mkdir /var/log/adept
|
|
||||||
chown adept:adept /var/log/adept
|
|
||||||
else
|
|
||||||
echo "/var/log/adept already exists, skipping creation."
|
|
||||||
fi
|
|
||||||
|
|
||||||
#DEBHELPER#
|
|
||||||
|
|
||||||
exit 0
|
|
@ -1,28 +0,0 @@
|
|||||||
package cmd
|
|
||||||
|
|
||||||
import (
|
|
||||||
"log"
|
|
||||||
"runtime"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
version string
|
|
||||||
)
|
|
||||||
|
|
||||||
// initializes the sub-command
|
|
||||||
func init() {
|
|
||||||
rootCmd.AddCommand(versionCmd)
|
|
||||||
}
|
|
||||||
|
|
||||||
var versionCmd = &cobra.Command{
|
|
||||||
Use: "version",
|
|
||||||
Short: "Display version info.",
|
|
||||||
Long: `In case you're curious, run this command to find out the version info.`,
|
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
|
||||||
log.Printf("Adept version %s", version)
|
|
||||||
log.Printf("Built with Go %s", runtime.Version())
|
|
||||||
log.Printf("View source at https://git.metaunix.net/BitGoblin/adept")
|
|
||||||
},
|
|
||||||
}
|
|
@ -73,8 +73,6 @@ func (r *Repository) ArchiveFile(inFile string) {
|
|||||||
log.Fatalf("Error opening file in ingest: %s.", err)
|
log.Fatalf("Error opening file in ingest: %s.", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
sourceStat, _ := source.Stat()
|
|
||||||
sourceMode := sourceStat.Mode()
|
|
||||||
defer source.Close()
|
defer source.Close()
|
||||||
|
|
||||||
// attempt to create destination file
|
// attempt to create destination file
|
||||||
@ -84,7 +82,7 @@ func (r *Repository) ArchiveFile(inFile string) {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
defer destination.Close()
|
defer destination.Close()
|
||||||
destination.Chmod(sourceMode)
|
destination.Chmod(0755)
|
||||||
|
|
||||||
// perform the file copy
|
// perform the file copy
|
||||||
_, err = io.Copy(destination, source)
|
_, err = io.Copy(destination, source)
|
||||||
|
Loading…
Reference in New Issue
Block a user