Skip to content

Instantly share code, notes, and snippets.

@bryanjhv
Last active July 30, 2024 15:59
Show Gist options
  • Save bryanjhv/88badffad27f8c20086b58ed517a035c to your computer and use it in GitHub Desktop.
Save bryanjhv/88badffad27f8c20086b58ed517a035c to your computer and use it in GitHub Desktop.
#!/bin/bash
set -x
DBUS="gdbus call -y"
DEST=org.freedesktop.UDisks2
OBJP=/org/freedesktop/UDisks2/block_devices/sdb
$DBUS -d $DEST -o $OBJP -m $DEST.Block.Format dos {}
$DBUS -d $DEST -o $OBJP -m $DEST.PartitionTable.CreatePartition 4194304 0 0x0e "" {}
$DBUS -d $DEST -o ${OBJP}1 -m $DEST.Block.Format vfat {}
$DBUS -d $DEST -o ${OBJP}1 -m $DEST.Filesystem.Mount {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment