Skip to content

Instantly share code, notes, and snippets.

@vodka2
Created May 14, 2020 11:46
Show Gist options
  • Save vodka2/44e1a40c3bcfb2899b21bdcd555ba8eb to your computer and use it in GitHub Desktop.
Save vodka2/44e1a40c3bcfb2899b21bdcd555ba8eb to your computer and use it in GitHub Desktop.
test appimage and fuse
mkdir -p appdir/usr/optional/ ; wget -c https://github.com/darealshinji/AppImageKit-checkrt/releases/download/continuous/exec-x86_64.so -O ./appdir/usr/optional/exec.so
mkdir -p appdir/usr/optional/libstdc++/ ; cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./appdir/usr/optional/libstdc++/
( cd appdir ; rm AppRun ; wget -c https://github.com/darealshinji/AppImageKit-checkrt/releases/download/continuous/AppRun-patched-x86_64 -O AppRun ; chmod a+x AppRun)
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod a+x linuxdeploy-x86_64.AppImage
OUTPUT="testapp-x86_64.AppImage" ./linuxdeploy-x86_64.AppImage --appimage-extract-and-run -e testapp --appdir appdir -e testapp -i appimage/testapp-icon.svg -d appimage/testapp.desktop --output appimage
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define FUSE_USE_VERSION 28
#include <fuse.h>
// Synopsis:
// gcc main.c -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26 `pkg-config --cflags --libs fuse` -o testapp
int fuse_getattr(const char *path, struct stat *statbuf);
int fuse_opendir(const char *path, struct fuse_file_info *fi);
int fuse_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset,
struct fuse_file_info *fi);
struct fuse_operations fuse_oper = {
.getattr = fuse_getattr,
.opendir = fuse_opendir,
.readdir = fuse_readdir,
};
int fuse_getattr(const char *path, struct stat *statbuf)
{
printf("getattr path=%s\n", path);
memset(statbuf, 0, sizeof(statbuf));
statbuf->st_dev = 2049;
statbuf->st_ino = 14450705;
statbuf->st_mode = 040775;
statbuf->st_nlink = 2;
statbuf->st_uid = 1000;
statbuf->st_gid = 1000;
statbuf->st_rdev = 0;
statbuf->st_size = 4096;
statbuf->st_blksize = 4096;
statbuf->st_blocks = 8;
time(&(statbuf->st_atime));
time(&(statbuf->st_mtime));
time(&(statbuf->st_ctime));
return(0);
}
int fuse_opendir(const char *path, struct fuse_file_info *fi)
{
printf("opendir path=%s\n", path);
return(0);
}
int fuse_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset,
struct fuse_file_info *fi)
{
printf("readdir path=%s\n", path);
filler(buf, "11", NULL, 0);
}
int main(int argc, char *argv[])
{
if(argc < 2) {
printf("Wrong usage\n");
exit(-1);
}
return( fuse_main(argc, argv, &fuse_oper, NULL) );
}
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[Desktop Entry]
Type=Application
Name=testapp
Comment=testapp
Icon=testapp-icon
Exec=testapp
Categories=AudioVideo;
Terminal=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment