Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
0b2209c886 | |||
f1c57a0ae6 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
.vscode
|
||||
shperm
|
||||
build/credentials
|
||||
build/deb/*.deb
|
||||
|
2
build/credentials.example
Normal file
2
build/credentials.example
Normal file
@ -0,0 +1,2 @@
|
||||
GITEA_USER=user
|
||||
GITEA_PASS=pass or token
|
42
build/deb/build_stable.sh
Executable file
42
build/deb/build_stable.sh
Executable file
@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
NAME=shperm
|
||||
VERSION=1.0
|
||||
REVISION=1
|
||||
ARCH=amd64
|
||||
|
||||
if ! git tag -l |fgrep $VERSION; then
|
||||
git tag $VERSION
|
||||
git push origin $VERSION
|
||||
fi
|
||||
|
||||
curdir=`dirname $0`
|
||||
workdir="$curdir/${NAME}_${VERSION}-${REVISION}_${ARCH}"
|
||||
mkdir -p "$workdir"
|
||||
|
||||
mkdir -p "$workdir/usr/bin"
|
||||
gcc -o "$workdir/usr/bin/shperm" ../../shperm.c
|
||||
chmod 0777 "$workdir/usr/bin/shperm"
|
||||
|
||||
mkdir "$workdir/DEBIAN"
|
||||
cat << EOT > "$workdir/DEBIAN/control"
|
||||
Package: $NAME
|
||||
Version: $VERSION
|
||||
Architecture: $ARCH
|
||||
Maintainer: Daniel Buschke <damage@devloop.de>
|
||||
Description: Shows permissions from given path
|
||||
up to the root folder
|
||||
Homepage: https://source.devloop.de/damage/shperm
|
||||
EOT
|
||||
|
||||
dpkg-deb --build --root-owner-group "$workdir"
|
||||
if [[ $? -eq 0 ]]; then
|
||||
source "$curdir/../credentials"
|
||||
curl --user "$GITEA_USER:$GITEA_PASS" \
|
||||
--upload-file "${NAME}_${VERSION}-${REVISION}_${ARCH}.deb" \
|
||||
https://source.devloop.de/api/packages/damage/debian/pool/stable/main/upload
|
||||
|
||||
rm -rf "$workdir"
|
||||
fi
|
13
shperm.c
13
shperm.c
@ -121,15 +121,22 @@ void dumpLines() {
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: %s <file or directory>\n", argv[0]);
|
||||
if (argc > 2) {
|
||||
fprintf(stderr, "Usage: %s [file or directory]\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char* path;
|
||||
char* startpath;
|
||||
path = malloc(PATH_MAX);
|
||||
|
||||
if (realpath(argv[1], path)) {
|
||||
if (argc == 1) {
|
||||
startpath = ".";
|
||||
} else {
|
||||
startpath = argv[1];
|
||||
}
|
||||
|
||||
if (realpath(startpath, path)) {
|
||||
char* base;
|
||||
do {
|
||||
struct stat sb;
|
||||
|
Loading…
x
Reference in New Issue
Block a user