[Android Themes] Captain_Throwback:
I've come across an issue with trying to change the splash screen. It seems to work if the working directory is on internal storage, but it fails if on external, apparently because it tries to setfilecon but can't, resulting in a failed copy operation. The resulting image is 0 bytes.

When I moved my original recovery.img to internal storage, everything worked fine.

Relevant portion of recovery log is below. I guess the solution would either be to always copy to a location on internal storage, or to only setfilecon if copying the file to internal storage (if that's an option).

I:Set page: 'themecheck'
I:operation_start: 'FileExists'
I:Set page: 'theme_settings'
I:operation_end - status=0
I:operation_start: 'Command'
I:Running command: '
if [ -f "/sdcard/TWRP/flashify/flashify.zip" ];
then cd /;
else
mkdir "/sdcard/TWRP/flashify";
mkdir "/cache/twrp";
unzip -o "/sdcard/TWRP/theme/ui.zip" -d "/cache/twrp";
cp -r /cache/twrp/flashify/* /sdcard/TWRP/flashify;
chmod 777 "/sdcard/TWRP/flashify/flashify.zip";
rm -r /cache/twrp;
fi
'
I:
if [ -f "/sdcard/TWRP/flashify/flashify.zip" ];
then cd /;
else
mkdir "/sdcard/TWRP/flashify";
mkdir "/cache/twrp";
unzip -o "/sdcard/TWRP/theme/ui.zip" -d "/cache/twrp";
cp -r /cache/twrp/flashify/* /sdcard/TWRP/flashify;
chmod 777 "/sdcard/TWRP/flashify/flashify.zip";
rm -r /cache/twrp;
fi
process ended with RC=0
I:operation_end - status=0
I:Set page: 'theme_splash'
I:Set page: 'theme_splash_select_img'
I:Set page: 'theme_splash'
I:Set page: 'theme_splash_select_jpg'
I:Set page: 'theme_splash'
I:operation_start: 'Command'
I:Running command: '
cd "/data/local/AIK-mobile";
cp "/external_sd/M9/recovery/twrp-2.8.7.1-hima.img" "/data/local/AIK-mobile/original.img";
chmod 777 "/data/local/AIK-mobile/original.img";
busybox sh "unpackimg.sh" "original.img";
cp "/external_sd/TWRP/curtains/curtain.jpg" "/data/local/AIK-mobile/ramdisk/twres/images/curtain.jpg";
busybox sh "repackimg.sh";
mv "image-new.img" "/external_sd/M9/recovery/custom_splash_twrp.img";
chown -R media_rw:media_rw "/external_sd/M9/recovery/custom_splash_twrp.img";
busybox sh "cleanup.sh";
rm "original.img";
'
[H[J\nAndroid Image Kitchen - UnpackImg Script
by osm0sis @ xda-developers\n
Supplied image: original.img\n
Setting up work folders...\n
Splitting image to "split_img/"...
BOARD_KERNEL_CMDLINE console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 user_debug=31 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 earlyprintk=msm_hsl_uart,0xf991e000 androidboot.hardware=htc_hima androidusb.pid=0x065d androidkey.dummy=1 androidtouch.htc_event=1 disk_mode_enable=1 androidboot.selinux=permissive
BOARD_KERNEL_BASE 00078000
BOARD_NAME
BOARD_PAGE_SIZE 4096
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 01f88000
BOARD_TAGS_OFFSET 01d88000
BOARD_DT_SIZE 4399104
\nUnpacking ramdisk to "ramdisk/"...\n
Compression used: gzip
30687 blocks
\nDone!
[H[J\nAndroid Image Kitchen - RepackImg Script
by osm0sis @ xda-developers\n
Packing ramdisk...\n
Using compression: gzip
\nGetting build information...
kernel = original.img-zImage
cmdline = console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 user_debug=31 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 earlyprintk=msm_hsl_uart,0xf991e000 androidboot.hardware=htc_hima androidusb.pid=0x065d androidkey.dummy=1 androidtouch.htc_event=1 disk_mode_enable=1 androidboot.selinux=permissive
board =
base = 00078000
pagesize = 4096
kernel_offset = 00008000
ramdisk_offset = 01f88000
tags_offset = 01d88000
dtb = original.img-dtb
\nBuilding image...\n
Done!
mv: setfilecon:/external_sd/M9/recovery/custom_splash_twrp.img,u:object_r:system_data_file:s0: Operation not supported on transport endpoint
Working directory cleaned.
I:
cd "/data/local/AIK-mobile";
cp "/external_sd/M9/recovery/twrp-2.8.7.1-hima.img" "/data/local/AIK-mobile/original.img";
chmod 777 "/data/local/AIK-mobile/original.img";
busybox sh "unpackimg.sh" "original.img";
cp "/external_sd/TWRP/curtains/curtain.jpg" "/data/local/AIK-mobile/ramdisk/twres/images/curtain.jpg";
busybox sh "repackimg.sh";
mv "image-new.img" "/external_sd/M9/recovery/custom_splash_twrp.img";
chown -R media_rw:media_rw "/external_sd/M9/recovery/custom_splash_twrp.img";
busybox sh "cleanup.sh";
rm "original.img";
process ended with RC=0
I:operation_end - status=0
I:Set page: 'flash_image_confirm'
I:Set page: 'flash_image'
I:operation_start: 'Flash Image'

[IMAGE FLASH STARTED]

Image to flash: '/external_sd/M9/recovery/custom_splash_twrp.img'
Calculating restore details...
I:Image filename is: /external_sd/M9/recovery/custom_splash_twrp.img
Flashing Recovery...
I:Flash command: 'dd bs=8388608 if='/external_sd/M9/recovery/custom_splash_twrp.img' of=/dev/block/mmcblk0p64'
0+0 records in
0+0 records out
0 bytes (0B) copied, 0.000106 seconds, 0B/s
I:dd bs=8388608 if='/external_sd/M9/recovery/custom_splash_twrp.img' of=/dev/block/mmcblk0p64 process ended with RC=0
[IMAGE FLASH COMPLETED]

I:Set page: 'flash_image_done'
I:operation_end - status=0
I:Set page: 'clear_vars'
I:Set page: 'install_image'
I:Set page: 'install'
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'themecheck'
I:operation_start: 'FileExists'
I:Set page: 'theme_settings'
I:operation_end - status=0
I:operation_start: 'Command'
I:Running command: '
if [ -f "/sdcard/TWRP/flashify/flashify.zip" ];
then cd /;
else
mkdir "/sdcard/TWRP/flashify";
mkdir "/cache/twrp";
unzip -o "/sdcard/TWRP/theme/ui.zip" -d "/cache/twrp";
cp -r /cache/twrp/flashify/* /sdcard/TWRP/flashify;
chmod 777 "/sdcard/TWRP/flashify/flashify.zip";
rm -r /cache/twrp;
fi
'
I:
if [ -f "/sdcard/TWRP/flashify/flashify.zip" ];
then cd /;
else
mkdir "/sdcard/TWRP/flashify";
mkdir "/cache/twrp";
unzip -o "/sdcard/TWRP/theme/ui.zip" -d "/cache/twrp";
cp -r /cache/twrp/flashify/* /sdcard/TWRP/flashify;
chmod 777 "/sdcard/TWRP/flashify/flashify.zip";
rm -r /cache/twrp;
fi
process ended with RC=0
I:operation_end - status=0
I:Set page: 'theme_splash'
I:Set page: 'theme_splash_select_img'
I:Set overlay: 'dialog_storage'
I:Backup folder set to '/data/media/0/TWRP/BACKUPS/HT123456789C'
I:DataManager::SetBackupFolder zip path was /external_sd/M9/recovery changing to /sdcard, /external_sd
I:Set overlay: ''
I:Set page: 'theme_splash'
I:operation_start: 'Command'
I:Running command: '
cd "/data/local/AIK-mobile";
cp "/sdcard/TWRP/twrp-2.8.7.1-hima.img" "/data/local/AIK-mobile/original.img";
chmod 777 "/data/local/AIK-mobile/original.img";
busybox sh "unpackimg.sh" "original.img";
cp "/external_sd/TWRP/curtains/curtain.jpg" "/data/local/AIK-mobile/ramdisk/twres/images/curtain.jpg";
busybox sh "repackimg.sh";
mv "image-new.img" "/sdcard/TWRP/custom_splash_twrp.img";
chown -R media_rw:media_rw "/sdcard/TWRP/custom_splash_twrp.img";
busybox sh "cleanup.sh";
rm "original.img";
'
[H[J\nAndroid Image Kitchen - UnpackImg Script
by osm0sis @ xda-developers\n
Supplied image: original.img\n
Setting up work folders...\n
Splitting image to "split_img/"...
BOARD_KERNEL_CMDLINE console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 user_debug=31 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 earlyprintk=msm_hsl_uart,0xf991e000 androidboot.hardware=htc_hima androidusb.pid=0x065d androidkey.dummy=1 androidtouch.htc_event=1 disk_mode_enable=1 androidboot.selinux=permissive
BOARD_KERNEL_BASE 00078000
BOARD_NAME
BOARD_PAGE_SIZE 4096
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 01f88000
BOARD_TAGS_OFFSET 01d88000
BOARD_DT_SIZE 4399104
\nUnpacking ramdisk to "ramdisk/"...\n
Compression used: gzip
30687 blocks
\nDone!
[H[J\nAndroid Image Kitchen - RepackImg Script
by osm0sis @ xda-developers\n
Packing ramdisk...\n
Using compression: gzip
\nGetting build information...
kernel = original.img-zImage
cmdline = console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 user_debug=31 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 earlyprintk=msm_hsl_uart,0xf991e000 androidboot.hardware=htc_hima androidusb.pid=0x065d androidkey.dummy=1 androidtouch.htc_event=1 disk_mode_enable=1 androidboot.selinux=permissive
board =
base = 00078000
pagesize = 4096
kernel_offset = 00008000
ramdisk_offset = 01f88000
tags_offset = 01d88000
dtb = original.img-dtb
\nBuilding image...\n
Done!
Working directory cleaned.
I:
cd "/data/local/AIK-mobile";
cp "/sdcard/TWRP/twrp-2.8.7.1-hima.img" "/data/local/AIK-mobile/original.img";
chmod 777 "/data/local/AIK-mobile/original.img";
busybox sh "unpackimg.sh" "original.img";
cp "/external_sd/TWRP/curtains/curtain.jpg" "/data/local/AIK-mobile/ramdisk/twres/images/curtain.jpg";
busybox sh "repackimg.sh";
mv "image-new.img" "/sdcard/TWRP/custom_splash_twrp.img";
chown -R media_rw:media_rw "/sdcard/TWRP/custom_splash_twrp.img";
busybox sh "cleanup.sh";
rm "original.img";
process ended with RC=0
I:operation_end - status=0
I:Set page: 'flash_image_confirm'
I:Set page: 'flash_image'
I:operation_start: 'Flash Image'

[IMAGE FLASH STARTED]

Image to flash: '/sdcard/TWRP/custom_splash_twrp.img'
Calculating restore details...
I:Image filename is: /sdcard/TWRP/custom_splash_twrp.img
Flashing Recovery...
I:Flash command: 'dd bs=8388608 if='/sdcard/TWRP/custom_splash_twrp.img' of=/dev/block/mmcblk0p64'
4+1 records in
4+1 records out
37072896 bytes (35.4MB) copied, 0.376807 seconds, 93.8MB/s
I:dd bs=8388608 if='/sdcard/TWRP/custom_splash_twrp.img' of=/dev/block/mmcblk0p64 process ended with RC=0
[IMAGE FLASH COMPLETED]

I:Set page: 'flash_image_done'
I:operation_end - status=0