Last active
June 1, 2022 04:28
-
-
Save Rajssss/7801d2a0f094c666f81a7392f7d174da to your computer and use it in GitHub Desktop.
script to root anbox with supersu.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -v | |
#some code edited from [email protected] | |
#Modified script by https://github.com/rypz79, taken from https://github.com/anbox/anbox/issues/894#issuecomment-420766769 | |
#Tested with SuperSU-v2.82-201705271822 only!! Check test system details in comments. | |
set -e | |
#get zip file and set workdir | |
mkdir -p ~/temp | |
cd ~/temp | |
# get direct download link to supersu zip from here (or anywhere you want) Tested with SuperSU-v2.82-201705271822 only!! | |
# https://androidfilehost.com/?fid=961840155545568721 | |
# https://download.chainfire.eu/1122/SuperSU/SR3-SuperSU-v2.82-SR3-20170813133244.zip?retrieve_file=1 | |
#wget <your direct download link here> -O SuperSU.zip | |
if [ ! -f *.zip ]; then | |
echo "File not found!" | |
exit 1 | |
fi | |
cd .. | |
mkdir -p "$(pwd)/anbox-work" | |
unzip ~/temp/*.zip -d "$(pwd)/anbox-work/su" | |
WORKDIR="$(pwd)/anbox-work" | |
cd "$WORKDIR" | |
#get image from anbox | |
cp /snap/anbox/current/android.img . | |
sudo unsquashfs android.img | |
sudo mkdir -p ./squashfs-root/system/app/SuperSU | |
sudo mkdir -p ./squashfs-root/system/bin/.ext/ | |
sudo cp ./su/common/Superuser.apk ./squashfs-root/system/app/SuperSU/SuperSU.apk | |
sudo cp ./su/common/install-recovery.sh ./squashfs-root/system/etc/install-recovery.sh | |
sudo cp ./su/common/install-recovery.sh ./squashfs-root/system/bin/install-recovery.sh | |
sudo cp ./su/x64/su ./squashfs-root/system/xbin/su | |
sudo cp ./su/x64/su ./squashfs-root/system/bin/.ext/.su | |
sudo cp ./su/x64/su ./squashfs-root/system/xbin/daemonsu | |
sudo cp ./su/x64/supolicy ./squashfs-root/system/xbin/supolicy | |
sudo cp ./su/x64/libsupol.so ./squashfs-root/system/lib64/libsupol.so | |
sudo cp ./squashfs-root/system/bin/app_process64 ./squashfs-root/system/bin/app_process_init | |
sudo cp ./squashfs-root/system/bin/app_process64 ./squashfs-root/system/bin/app_process64_original | |
sudo cp ./squashfs-root/system/xbin/daemonsu ./squashfs-root/system/bin/app_process | |
sudo cp ./squashfs-root/system/xbin/daemonsu ./squashfs-root/system/bin/app_process64 | |
sudo chmod +x ./squashfs-root/system/app/SuperSU/SuperSU.apk | |
sudo chmod +x ./squashfs-root/system/etc/install-recovery.sh | |
sudo chmod +x ./squashfs-root/system/bin/install-recovery.sh | |
sudo chmod +x ./squashfs-root/system/xbin/su | |
sudo chmod +x ./squashfs-root/system/bin/.ext/.su | |
sudo chmod +x ./squashfs-root/system/xbin/daemonsu | |
sudo chmod +x ./squashfs-root/system/xbin/supolicy | |
sudo chmod +x ./squashfs-root/system/lib64/libsupol.so | |
sudo chmod +x ./squashfs-root/system/bin/app_process_init | |
sudo chmod +x ./squashfs-root/system/bin/app_process64_original | |
sudo chmod +x ./squashfs-root/system/bin/app_process | |
sudo chmod +x ./squashfs-root/system/bin/app_process64 | |
#squash img | |
sudo rm android.img | |
sudo mksquashfs squashfs-root android.img -b 131072 -comp xz -Xbcj ia64 | |
# update anbox snap images | |
cd /var/lib/snapd/snaps | |
until sudo systemctl stop snap.anbox.container-manager.service | |
do | |
sleep 10 | |
done | |
for filename in anbox_*.snap | |
do | |
NUMBER=${filename//[^0-9]/} | |
if [ "$NUMBER" ]; then | |
echo "changing anbox snap $NUMBER" | |
until sudo systemctl stop snap-anbox-$NUMBER.mount | |
do | |
sleep 10 | |
done | |
sudo unsquashfs $filename | |
sudo mv ./squashfs-root/android.img ./android.img-$NUMBER | |
sudo cp "$WORKDIR/android.img" ./squashfs-root | |
sudo rm $filename | |
sudo mksquashfs squashfs-root $filename -b 131072 -comp xz -Xbcj ia64 | |
sudo rm -rf ./squashfs-root | |
sudo systemctl start snap-anbox-$NUMBER.mount | |
else | |
echo "Could not find number for: $filename" | |
fi | |
done | |
sudo systemctl start snap.anbox.container-manager.service | |
#clean up | |
rm -rf ~/temp | |
sudo rm -rf "$WORKDIR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ anbox system-info
version: 4
snap-revision: 186
cpu:
arch: x86
brand: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
features:
- aes
- sse4_1
- sse4_2
- avx
- avx2
os:
name: Ubuntu
version: 20.04.3 LTS (Focal Fossa)
snap-based: true
kernel:
version: Linux version 5.11.0-43-generic (buildd@lcy02-amd64-036) (gcc (Ubuntu 9.3.0-17ubuntu1
20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #4720.04.2-Ubuntu SMP Mon Dec 13 11:06:56 UTC 2021binder: false
ashmem: true
graphics:
egl:
vendor: NVIDIA
version: 1.5
extensions:
- EGL_EXT_buffer_age
- EGL_EXT_client_sync
- EGL_EXT_create_context_robustness
- EGL_EXT_image_dma_buf_import
- EGL_EXT_image_dma_buf_import_modifiers
- EGL_MESA_image_dma_buf_export
- EGL_EXT_output_base
- EGL_EXT_stream_acquire_mode
- EGL_EXT_sync_reuse
- EGL_IMG_context_priority
- EGL_KHR_config_attribs
- EGL_KHR_create_context_no_error
- EGL_KHR_context_flush_control
- EGL_KHR_create_context
- EGL_KHR_fence_sync
- EGL_KHR_get_all_proc_addresses
- EGL_KHR_partial_update
- EGL_KHR_swap_buffers_with_damage
- EGL_KHR_no_config_context
- EGL_KHR_gl_colorspace
- EGL_KHR_gl_renderbuffer_image
- EGL_KHR_gl_texture_2D_image
- EGL_KHR_gl_texture_3D_image
- EGL_KHR_gl_texture_cubemap_image
- EGL_KHR_image
- EGL_KHR_image_base
- EGL_KHR_image_pixmap
- EGL_KHR_reusable_sync
- EGL_KHR_stream
- EGL_KHR_stream_attrib
- EGL_KHR_stream_consumer_gltexture
- EGL_KHR_stream_cross_process_fd
- EGL_KHR_stream_fifo
- EGL_KHR_stream_producer_eglsurface
- EGL_KHR_surfaceless_context
- EGL_KHR_wait_sync
- EGL_NV_nvrm_fence_sync
- EGL_NV_post_sub_buffer
- EGL_NV_quadruple_buffer
- EGL_NV_stream_consumer_eglimage
- EGL_NV_stream_cross_display
- EGL_NV_stream_cross_object
- EGL_NV_stream_cross_process
- EGL_NV_stream_cross_system
- EGL_NV_stream_dma
- EGL_NV_stream_flush
- EGL_NV_stream_metadata
- EGL_NV_stream_remote
- EGL_NV_stream_reset
- EGL_NV_stream_socket
- EGL_NV_stream_socket_inet
- EGL_NV_stream_socket_unix
- EGL_NV_stream_sync
- EGL_NV_stream_fifo_next
- EGL_NV_stream_fifo_synchronous
- EGL_NV_stream_consumer_gltexture_yuv
- EGL_NV_stream_attrib
- EGL_NV_stream_origin
- EGL_NV_system_time
- EGL_NV_output_drm_flip_event
- EGL_NV_triple_buffer
- EGL_NV_robustness_video_memory_purge
gles2:
vendor: NVIDIA Corporation
vendor: OpenGL ES 3.2 NVIDIA 470.86
extensions:
- GL_EXT_base_instance
- GL_EXT_blend_func_extended
- GL_EXT_blend_minmax
- GL_EXT_buffer_storage
- GL_EXT_clear_texture
- GL_EXT_clip_control
- GL_EXT_clip_cull_distance
- GL_EXT_color_buffer_float
- GL_EXT_color_buffer_half_float
- GL_EXT_conservative_depth
- GL_EXT_copy_image
- GL_EXT_depth_clamp
- GL_EXT_debug_label
- GL_EXT_discard_framebuffer
- GL_EXT_disjoint_timer_query
- GL_EXT_draw_buffers_indexed
- GL_EXT_draw_elements_base_vertex
- GL_EXT_EGL_image_array
- GL_EXT_EGL_image_storage
- GL_EXT_EGL_image_external_wrap_modes
- GL_EXT_float_blend
- GL_EXT_frag_depth
- GL_EXT_geometry_point_size
- GL_EXT_geometry_shader
- GL_EXT_gpu_shader5
- GL_EXT_map_buffer_range
- GL_EXT_multi_draw_indirect
- GL_EXT_multisample_compatibility
- GL_EXT_multiview_texture_multisample
- GL_EXT_multiview_timer_query
- GL_EXT_occlusion_query_boolean
- GL_EXT_polygon_offset_clamp
- GL_EXT_primitive_bounding_box
- GL_EXT_render_snorm
- GL_EXT_robustness
- GL_EXT_separate_shader_objects
- GL_EXT_shader_group_vote
- GL_EXT_shader_implicit_conversions
- GL_EXT_shader_integer_mix
- GL_EXT_shader_io_blocks
- GL_EXT_shader_non_constant_global_initializers
- GL_EXT_shader_texture_lod
- GL_EXT_shadow_samplers
- GL_EXT_sparse_texture
- GL_EXT_sRGB
- GL_EXT_sRGB_write_control
- GL_EXT_tessellation_point_size
- GL_EXT_tessellation_shader
- GL_EXT_texture_border_clamp
- GL_EXT_texture_buffer
- GL_EXT_texture_compression_bptc
- GL_EXT_texture_compression_dxt1
- GL_EXT_texture_compression_rgtc
- GL_EXT_texture_compression_s3tc
- GL_EXT_texture_cube_map_array
- GL_EXT_texture_filter_anisotropic
- GL_EXT_texture_format_BGRA8888
- GL_EXT_texture_mirror_clamp_to_edge
- GL_EXT_texture_norm16
- GL_EXT_texture_query_lod
- GL_EXT_texture_rg
- GL_EXT_texture_shadow_lod
- GL_EXT_texture_sRGB_R8
- GL_EXT_texture_sRGB_decode
- GL_EXT_texture_storage
- GL_EXT_texture_view
- GL_EXT_draw_transform_feedback
- GL_EXT_unpack_subimage
- GL_EXT_window_rectangles
- GL_KHR_context_flush_control
- GL_KHR_debug
- GL_EXT_memory_object
- GL_EXT_memory_object_fd
- GL_KHR_parallel_shader_compile
- GL_KHR_no_error
- GL_KHR_robust_buffer_access_behavior
- GL_KHR_robustness
- GL_EXT_semaphore
- GL_EXT_semaphore_fd
- GL_NV_timeline_semaphore
- GL_KHR_shader_subgroup
- GL_KHR_texture_compression_astc_ldr
- GL_KHR_texture_compression_astc_sliced_3d
- GL_KHR_texture_compression_astc_hdr
- GL_NV_bgr
- GL_NV_bindless_texture
- GL_NV_blend_equation_advanced
- GL_NV_blend_equation_advanced_coherent
- GL_NV_blend_minmax_factor
- GL_NV_conditional_render
- GL_NV_copy_buffer
- GL_NV_copy_image
- GL_NV_draw_buffers
- GL_NV_draw_instanced
- GL_NV_draw_texture
- GL_NV_draw_vulkan_image
- GL_NV_EGL_stream_consumer_external
- GL_NV_explicit_attrib_location
- GL_NV_fbo_color_attachments
- GL_NV_framebuffer_blit
- GL_NV_framebuffer_multisample
- GL_NV_generate_mipmap_sRGB
- GL_NV_instanced_arrays
- GL_NV_internalformat_sample_query
- GL_NV_gpu_shader5
- GL_NV_image_formats
- GL_NV_occlusion_query_samples
- GL_NV_non_square_matrices
- GL_NV_pack_subimage
- GL_NV_packed_float
- GL_NV_packed_float_linear
- GL_NV_path_rendering
- GL_NV_pixel_buffer_object
- GL_NV_polygon_mode
- GL_NV_read_buffer
- GL_NV_read_depth
- GL_NV_read_depth_stencil
- GL_NV_read_stencil
- GL_NV_shader_noperspective_interpolation
- GL_NV_shader_subgroup_partitioned
- GL_NV_shadow_samplers_array
- GL_NV_shadow_samplers_cube
- GL_NV_sRGB_formats
- GL_NV_texture_array
- GL_NV_texture_barrier
- GL_NV_texture_border_clamp
- GL_NV_texture_compression_latc
- GL_NV_texture_compression_s3tc
- GL_NV_texture_compression_s3tc_update
- GL_NV_timer_query
- GL_NV_viewport_array
- GL_KHR_blend_equation_advanced
- GL_KHR_blend_equation_advanced_coherent
- GL_OES_compressed_ETC1_RGB8_texture
- GL_EXT_compressed_ETC1_RGB8_sub_texture
- GL_OES_depth24
- GL_OES_depth32
- GL_OES_depth_texture
- GL_OES_depth_texture_cube_map
- GL_OES_copy_image
- GL_OES_draw_buffers_indexed
- GL_OES_draw_elements_base_vertex
- GL_OES_texture_border_clamp
- GL_OES_tessellation_point_size
- GL_OES_tessellation_shader
- GL_OES_texture_buffer
- GL_OES_geometry_point_size
- GL_OES_geometry_shader
- GL_OES_gpu_shader5
- GL_OES_shader_io_blocks
- GL_OES_texture_view
- GL_OES_primitive_bounding_box
- GL_OES_EGL_image
- GL_OES_EGL_image_external
- GL_OES_EGL_image_external_essl3
- GL_OES_EGL_sync
- GL_OES_element_index_uint
- GL_OES_fbo_render_mipmap
- GL_OES_get_program_binary
- GL_OES_mapbuffer
- GL_OES_packed_depth_stencil
- GL_OES_rgb8_rgba8
- GL_OES_sample_shading
- GL_OES_sample_variables
- GL_OES_shader_image_atomic
- GL_OES_shader_multisample_interpolation
- GL_OES_standard_derivatives
- GL_OES_surfaceless_context
- GL_OES_texture_cube_map_array
- GL_OES_texture_npot
- GL_OES_texture_float
- GL_OES_texture_float_linear
- GL_OES_texture_half_float
- GL_OES_texture_half_float_linear
- GL_OES_texture_stencil8
- GL_OES_texture_storage_multisample_2d_array
- GL_OES_vertex_array_object
- GL_OES_vertex_half_float
- GL_OES_viewport_array
- GL_OVR_multiview
- GL_OVR_multiview2
- GL_ANDROID_extension_pack_es31a