Skip to content

Instantly share code, notes, and snippets.

@MagneFire
Created November 4, 2021 14:49
Show Gist options
  • Save MagneFire/968929530901361543fa5bf15ca4567c to your computer and use it in GitHub Desktop.
Save MagneFire/968929530901361543fa5bf15ca4567c to your computer and use it in GitHub Desktop.
Easily create a new layer for a new smartwatch (AsteroidOS).
#!/bin/bash
SRC="$1"
DST="$2"
echo $PWD
if [ -d "meta-$DST-hybris/" ]; then
echo "Destination layer (meta-$DST-hybris) already exists!"
exit
fi
cp -r meta-$SRC-hybris/ meta-$DST-hybris/
cd meta-$DST-hybris/
FILES=$(find . -name "*$SRC*")
for f in $FILES
do
mv "$f" "${f/$SRC/$DST}"
done
find . -type f -exec sed -i "s/"$SRC"/$DST/g" {} \;
rm -rvf .git/
cp -r ../meta-$SRC-hybris/.git .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment