manager: add script for randomizing pkg name
Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id> Co-Authored-By: YC酱luyancib <luyancib@qq.com>
This commit is contained in:
20
manager/randomizer
Normal file
20
manager/randomizer
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
|
# Generate 3 random lowercase words (6 letters each)
|
||||||
|
word1=$(tr -dc 'a-z' </dev/urandom | head -c6)
|
||||||
|
word2=$(tr -dc 'a-z' </dev/urandom | head -c6)
|
||||||
|
word3=$(tr -dc 'a-z' </dev/urandom | head -c6)
|
||||||
|
|
||||||
|
# Export variables for use in find -exec
|
||||||
|
export word1 word2 word3
|
||||||
|
|
||||||
|
# Rename directories
|
||||||
|
find . -depth -type d -name 'com' -execdir mv {} "$word1" \;
|
||||||
|
find . -depth -type d -name 'sukisu' -execdir mv {} "$word2" \;
|
||||||
|
find . -depth -type d -name 'ultra' -execdir mv {} "$word3" \;
|
||||||
|
|
||||||
|
# Replace inside files
|
||||||
|
find . -type f -exec sed -i \
|
||||||
|
-e "s/com\.sukisu\.ultra/$word1.$word2.$word3/g" \
|
||||||
|
-e "s/com\/sukisu\/ultra/$word1\/$word2\/$word3/g" \
|
||||||
|
-e "s/com_sukisu_ultra/${word1}_${word2}_${word3}/g" {} +
|
||||||
Reference in New Issue
Block a user