mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-16 14:16:16 -06:00
update make-appimage
This commit is contained in:
parent
c2f982ad9f
commit
e478e576ba
1 changed files with 63 additions and 4 deletions
|
|
@ -1,3 +1,60 @@
|
|||
/*
|
||||
* Copyright (C) 2014-2025 Firejail Authors
|
||||
*
|
||||
* This file is part of firejail project
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/* How to build an appimage type 2 based on this program (Debian 13 stable):
|
||||
|
||||
$ wget https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
||||
$ mv appimagetool-x86_64.AppImage ~/tmp/.
|
||||
$ cd ~/tmp
|
||||
$ sudo apt-get install zsync
|
||||
$ mkdir -p AppDir/usr/bin
|
||||
|
||||
create a hello-world.png in AppDir/.
|
||||
|
||||
$ cat AppDir/AppRun
|
||||
#!/bin/bash
|
||||
exec $APPDIR/usr/bin/hello-world $@
|
||||
$ chmod +x AppDir/AppRun
|
||||
|
||||
$ gcc -o hello-world main.c
|
||||
$ cp hello-world AppDir/usr/bin/.
|
||||
$ ARCH=x86_64 ./appimagetool-x86_64.AppImage AppDir HelloWorld.AppImage
|
||||
$ firejail --appimage HelloWorld.AppImage arg1 arg2 arg3
|
||||
[...]
|
||||
Mounting appimage type 2
|
||||
Base filesystem installed in 32.00 ms
|
||||
Child process initialized in 74.17 ms
|
||||
Hello, Firejail!
|
||||
1 - arg1
|
||||
2 - arg2
|
||||
3 - arg3
|
||||
|
||||
*** container firejail ***
|
||||
*** NoNewPrivs 1 ***
|
||||
*** Seccomp 2 ***
|
||||
|
||||
Parent is shutting down, bye...
|
||||
AppImage detached
|
||||
$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
|
@ -7,12 +64,14 @@
|
|||
|
||||
int main(int argc, char **argv) {
|
||||
printf("Hello, Firejail!\n");
|
||||
|
||||
|
||||
// test args
|
||||
int i;
|
||||
for (i = 1; i < argc; i++)
|
||||
printf("%d - %s\n", i, argv[i]);
|
||||
|
||||
|
||||
|
||||
char *cont = getenv("container");
|
||||
if (cont)
|
||||
printf("\n*** container %s ***\n", cont);
|
||||
|
|
@ -29,7 +88,7 @@ int main(int argc, char **argv) {
|
|||
char *ptr = strchr(buf, '\n');
|
||||
if (ptr)
|
||||
*ptr = '\0';
|
||||
|
||||
|
||||
if (strncmp(buf, "NoNewPrivs:", 11) == 0) {
|
||||
ptr = buf + 11;
|
||||
while (*ptr == ' ' || *ptr == '\t')
|
||||
|
|
@ -37,7 +96,7 @@ int main(int argc, char **argv) {
|
|||
printf("*** NoNewPrivs %s ***\n", ptr);
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
|
||||
if (strncmp(buf, "Seccomp:", 8) == 0) {
|
||||
ptr = buf + 8;
|
||||
while (*ptr == ' ' || *ptr == '\t')
|
||||
|
|
@ -47,6 +106,6 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue