{"id":21388104,"url":"https://github.com/grisp/edifa","last_synced_at":"2025-07-13T15:32:14.418Z","repository":{"id":254354508,"uuid":"846287222","full_name":"grisp/edifa","owner":"grisp","description":"Erlang Disk and Image File Abstraction Library","archived":false,"fork":false,"pushed_at":"2024-08-30T12:46:28.000Z","size":100,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-09-07T14:50:17.555Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grisp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-22T22:35:28.000Z","updated_at":"2024-09-04T21:00:07.000Z","dependencies_parsed_at":"2024-08-27T15:57:41.482Z","dependency_job_id":null,"html_url":"https://github.com/grisp/edifa","commit_stats":null,"previous_names":["grisp/edifa"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grisp%2Fedifa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grisp%2Fedifa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grisp%2Fedifa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grisp%2Fedifa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grisp","download_url":"https://codeload.github.com/grisp/edifa/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225893696,"owners_count":17540918,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T12:15:58.421Z","updated_at":"2024-11-22T12:15:59.018Z","avatar_url":"https://github.com/grisp.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# edifa\n\nErlang Disk and Image File Abstraction Library\n\nLibrary to create system images without root privilege on both Linux and MacOS.\n\n\n## Build\n\n    $ rebar3 compile\n\n\n## Runtime Dependencies\n\n### MacOS\n\nCommands that must be available:\n\n - rm\n - mv\n - mkdir\n - dd\n - mktemp\n - gzip\n - hdiutil\n - fdisk\n - diskutil\n - newfs_msdos\n\n\n### Linux\n\nCommands that must be available:\n\n - rm\n - mv\n - mkdir\n - dd\n - mktemp\n - gzip\n - id\n - sfdisk\n - fusefat\n - fusermount\n - mkfs.vfat\n \nInstall dependencies:\n\n    sudo apt-get install coreutils fdisk fusefat dosfstools gzip\n\n\n## Usage\n\nCreate an image file (64 MiB):\n\n```erlang\n{ok, Img} = edifa:create(\"test.img\", 64 * 1024 * 1024).\n```\n\nWrite some bootloader (2 MiB):\n\n```erlang\nok = edifa:write(Img, \"bootloader.bin\", #{count =\u003e 2 * 1024 * 1024}).\n```\n\nCreate partitions:\n\n```erlang\n{ok, P1, P2} = edifa:partition(Img, mbr, [\n    #{type =\u003e fat32, size =\u003e 31 * 1024 * 1024, start =\u003e 2 * 1024 * 1024},\n    #{type =\u003e fat32, size =\u003e 31 * 1024 * 1024}\n]).\n```\n\nFormat partition 1:\n\n```erlang\nok = edifa:format(Img, P1, fat, #{label =\u003e \"foobar\"}).\n```\n\nMount partition 1:\n\n```erlang\n{ok, MountPoint} = edifa:mount(Img, P1).\n```\n\nCreate some files in partition 1 filesystem:\n\n```erlang\nok = file:write_file(filename:join(MountPoint, \"test.txt\"), \u003c\u003c\"some data\\n\"\u003e\u003e).\n```\n\nUnmount partition 1:\n\n```erlang\nok = edifa:unmount(Img, P1).\n```\n\nExtract partition 1 into its own file:\n\n```erlang\nok = edifa:extract(Img, P1, \"system.fs\").\n```\n\nGenerate a tuncated disk image containing the reserved space before the first\npartition with the bootloader and the partition definition, and partition 1:\n\n```erlang\nok = edifa:extract(Img, reserved, P1, \"disk.img\").\n```\n\nExtract into a gziped file:\n\n\nClose the image:\n\n```erlang\nok = edifa:close(Img).\n```\n\n```erlang\nok = edifa:extract(Img, P2, P2, \"system.fs.gz\").\n```\n\n\n## Limitations\n\n - All partitions involved must be unmounted before extracting data.\n - Only support MBR partition tables for now.\n - Active/Bootable partition flag is not supported yet.\n - Only support FAT filesystem for now.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrisp%2Fedifa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrisp%2Fedifa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrisp%2Fedifa/lists"}