diff --git a/.gitignore b/.gitignore index e45189d..f849fb7 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ src/Version.h LICENSE_3rdparty core..* hdumpstate* +release/ diff --git a/Makefile b/Makefile index ddf5a20..b6700ec 100644 --- a/Makefile +++ b/Makefile @@ -95,13 +95,33 @@ nw-installer/installer/userdata.tar: LICENSE_3rdparty qr.bmp server: $(MAKE) -C server +uninstaller: + $(MAKE) -C nw-installer prepare + cat LICENSE LICENSE_3rdparty > nw-installer/installer/windows/LICENSE.txt.user + tar -C uninstaller -cf nw-installer/installer/userdata.tar \ + run.sh + release-clean: $(MAKE) -C nw-installer OUTFILE=$(PRODUCT).exe APPNAME=$(PRODUCT) clean + -rm -rf release release: release-clean build-arm server cassetteunpacker/res nw-installer/installer/userdata.tar $(MAKE) -C nw-installer OUTFILE=$(PRODUCT).exe APPNAME=$(PRODUCT) + mkdir -p release/installer/ cd nw-installer/installer/stock/ && tar -czvf stock.tar.gz NW_WM_FW.UPG cd nw-installer/installer/walkmanOne/ && tar -czvf walkmanOne.tar.gz NW_WM_FW.UPG + mv nw-installer/installer/walkmanOne/walkmanOne.tar.gz release/installer + mv nw-installer/installer/stock/stock.tar.gz release/installer + mv nw-installer/installer/windows/${PRODUCT}.exe release/installer + $(MAKE) -C nw-installer OUTFILE=$(PRODUCT).uninstaller.exe APPNAME=$(PRODUCT)-uninstaller clean + $(MAKE) uninstaller + $(MAKE) -C nw-installer OUTFILE=$(PRODUCT).uninstaller.exe APPNAME=$(PRODUCT)-uninstaller build + mkdir -p release/uninstaller + cd nw-installer/installer/stock/ && tar -czvf stock.uninstaller.tar.gz NW_WM_FW.UPG + cd nw-installer/installer/walkmanOne/ && tar -czvf walkmanOne.uninstaller.tar.gz NW_WM_FW.UPG + mv nw-installer/installer/walkmanOne/walkmanOne.uninstaller.tar.gz release/uninstaller + mv nw-installer/installer/stock/stock.uninstaller.tar.gz release/uninstaller + mv nw-installer/installer/windows/${PRODUCT}.uninstaller.exe release/uninstaller # see also: `perf record` && `perf report` profile: @@ -150,4 +170,4 @@ qr.bmp: @convert qr.png -type palette qr.bmp @rm qr.png -.PHONY: build build-arm docker push profile profile-arm valgrind deps release release-clean LICENSE_3rdparty server \ No newline at end of file +.PHONY: build build-arm docker push profile profile-arm valgrind deps release release-clean LICENSE_3rdparty server uninstaller \ No newline at end of file diff --git a/installer/run.sh b/installer/run.sh index d5e4270..79b7de8 100644 --- a/installer/run.sh +++ b/installer/run.sh @@ -53,6 +53,20 @@ install() { busybox chown -h ${user}:${group} /system/vendor/sony/lib/libprotobuf.so.32 log "installing server" + test -f /system/vendor/sony/plugins/platforms/libqeglfs.so_vendor + if test $? -ne 0; then + # make sure this file is from SONY (not linked to libprotobuf) + busybox grep -q protobuf /system/vendor/sony/plugins/platforms/libqeglfs.so + if test $? -eq 1; then + log "backing up libqeglfs" + busybox cp -p /system/vendor/sony/plugins/platforms/libqeglfs.so /system/vendor/sony/plugins/platforms/libqeglfs.so_vendor + else + log "libqeglfs is linked to libprotobuf, not backing up" + fi + else + log "libqeglfs backup already exists" + fi + cp libqeglfs.so /system/vendor/sony/plugins/platforms/ chown root:shell /system/vendor/sony/plugins/platforms/libqeglfs.so chmod 0755 /system/vendor/sony/plugins/platforms/libqeglfs.so diff --git a/uninstaller/run.sh b/uninstaller/run.sh new file mode 100644 index 0000000..60f9761 --- /dev/null +++ b/uninstaller/run.sh @@ -0,0 +1,69 @@ +#!/bin/sh +VENDOR=/system/vendor/unknown321/ +BINARY=wampy +user=system +group=system + +log() +{ + oldIFS=$IFS + IFS=" +" + for line in $(echo "${1}"); do + echo "$(date) ${line}" >> $LOG_FILE + done + IFS=$oldIFS +} + +uninstall() { + log "removing ${BINARY}" + busybox rm -f ${VENDOR}/bin/${BINARY} + + log "uninstalling ${BINARY} service" + grep -q "init.${BINARY}.rc" "${INITRD_UNPACKED}/init.rc" + if test $? -eq 0; then + log "removing service" + busybox sed -i "/import init.${BINARY}.rc/d" ${INITRD_UNPACKED}/init.rc + fi + busybox rm -f ${INITRD_UNPACKED}/init.${BINARY}.rc + + log "removing libraries" + busybox rm -f ${VENDOR}/lib/libMagick++-7.Q8HDRI.so + busybox rm -f ${VENDOR}/lib/libMagickCore-7.Q8HDRI.so + busybox rm -f ${VENDOR}/lib/libMagickWand-7.Q8HDRI.so + + busybox rm -f ${VENDOR}/lib/libjpeg.so.62.4.0 + busybox rm -f ${VENDOR}/lib/libjpeg.so.62 + + log "uninstalling server" + busybox test -f /system/vendor/sony/plugins/platforms/libqeglfs.so_vendor + if busybox test $? -eq 0; then + # make sure backup is from SONY (not linked to libprotobuf) + busybox grep -q protobuf /system/vendor/sony/plugins/platforms/libqeglfs.so_vendor + if busybox test $? -eq 1; then + log "restoring libqeglfs from backup" + busybox cp -f /system/vendor/sony/plugins/platforms/libqeglfs.so_vendor /system/vendor/sony/plugins/platforms/libqeglfs.so + chown root:shell /system/vendor/sony/plugins/platforms/libqeglfs.so + chmod 0755 /system/vendor/sony/plugins/platforms/libqeglfs.so + + log "removing protobuf lib" + busybox rm -f ${VENDOR}/lib/libprotobuf.so.32.0.12 + busybox rm -f ${VENDOR}/lib/libprotobuf.so.32 + busybox rm -f /system/vendor/sony/lib/libprotobuf.so.32 + else + log "backup file is linked to libprotobuf, not restoring" + fi + else + log "no valid libqeglfs backup found, leaving as is" + fi + + log "removing skins, licenses, qr code" + busybox rm -rf ${VENDOR}/usr/share/${BINARY}/ +} + +mount -t ext4 -o rw /emmc@android /system + +uninstall + +sync +umount /system