3 . /usr/pandora/scripts/op_common.sh
6 if selection=$(grep "/dev/mmcblk" /proc/mounts | cut -f 2 -d " " | sed 's/\\040/ /g' | zenity --title="Create Pandora SD Card" --width="380" --height="250" --list --text="This utility creates the needed Pandora directories on your SD Card.\nYou can also use it to format your SD Card.\n\nPlease select the SD Card to be used (no data will be changed yet):" --column="Select card"); then
7 selection2=$(echo "$selection" | sed 's/ /\\\\040/g')
8 device=$(grep "${selection2}" /proc/mounts | awk '{print $1}')
10 if zenity --question --title="Format SD Card" --text="Do you also want to format your SD Card?\n\nNote: This will delete ALL existing data on the card!" --ok-label="Yes, format the card!" --cancel-label="Don't format it"; then
11 if label=$(zenity --title="Enter label" --entry --text "Please enter a Label for your SD Card.") ; then
18 if fstype=$(zenity --title="Filesystem" --width="350" --height="320" --list --column "fs" --column "Please select" --hide-column=1 --text="The Pandora supports the following file systems.\n\nIt is strongly recommended to use VFAT (FAT32)\nto ensure a maximum compatibility with other devices.\nOnly select a different filesystem if you know what you're doing.\n" "vfat" "VFAT (FAT32), recommended." "ext2" "ext2" "ext3" "ext3" "ext4" "ext4" --ok-label="Select filesystem" ); then
24 if zenity --question --title="Confirm Pandora SD Card Creation" --text="The Pandora will now format your SD Card and create all the needed directories.\n\nALL EXISTING DATA WILL BE DELETED!\n\nPlease confirm the following selection:\nThe card will be formatted with $fstype and labelled $name.\n" --ok-label="Yes, do it" --cancel-label="Don't do it"; then
25 if gksudo umount $device; then
29 gksudo "mkfs.vfat -F 32 -n "$name" $device"
32 gksudo "mkfs.ext2 -L "$name" $device"
35 gksudo "mkfs.ext3 -L "$name" $device"
38 gksudo "mkfs.ext4 -L "$name" $device"
43 if gksudo mount $device /tmp/mnt; then
44 gksudo mkdir /tmp/mnt/pandora
45 gksudo mkdir /tmp/mnt/pandora/menu
46 gksudo mkdir /tmp/mnt/pandora/apps
47 gksudo mkdir /tmp/mnt/pandora/desktop
48 gksudo mkdir /tmp/mnt/pandora/appdata
49 echo -e "Place all PNDs that should appear in the menu into the menu-subfolder.\nPlace all PNDs that should appear on the desktop in the desktop-subfolder.\nPlace all PNDs that should appear both on the desktop AND in the menu into the apps-subfolder.\n\nPNDs will save their configuration into the appdata-subfolder." > /tmp/README.txt
50 gksudo cp /tmp/README.txt /tmp/mnt/pandora
51 gksudo "chown -R $user:users /tmp/mnt"
55 zenity --info --title="Directories created" --text "The needed directories have been created.\n\nPlease put your PNDs into:\n\\\pandora\\\menu\n\\\pandora\\\desktop\n\\\pandora\\\apps\n\nPlease remove and reinsert the card to remount it.\n"
58 zenity --title="Error" --error --text="Error.\nThe card could not be remounted, something probably went wrong formatting it.\n\nPlease remove and reinsert the card and try again." --timeout 10
62 --title="Formatting..." \
63 --text="Creating the SD Card...\nPlease wait a while..." \
67 zenity --title="Error" --error --text="Error.\nThe card could not be unmounted.\n\nPlease make sure to close any programs that currently access the SD Card." --timeout 10
72 if zenity --question --title="Confirm Pandora SD Card Creation" --text="The Pandora will now create all the needed directories on your SD Card.\n\nNo existing data will be deleted.\n\nPlease confirm the creation of the directories.\n" --ok-label="Yes, do it" --cancel-label="Don't do it"; then
73 mkdir $selection2/pandora
74 mkdir $selection2/pandora/menu
75 mkdir $selection2/pandora/apps
76 mkdir $selection2/pandora/desktop
77 mkdir $selection2/pandora/appdata
78 echo -e "Place all PNDs that should appear in the menu into the menu-subfolder.\nPlace all PNDs that should appear on the desktop in the desktop-subfolder.\nPlace all PNDs that should appear both on the desktop AND in the menu into the apps-subfolder.\n\nPNDs will save their configuration into the appdata-subfolder." > /tmp/README.txt
79 gksudo "cp /tmp/README.txt /$selection2/pandora"
80 zenity --info --title="Directories created" --text "The needed directories have been created.\n\nPlease put your PNDs into:\n\\\pandora\\\menu\n\\\pandora\\\desktop\n\\\pandora\\\apps\n"
82 --title="Aborted" --error --text="The directories will not be created." --timeout 10