diff --git a/.gitignore b/.gitignore index cbd3f99..dbdbb26 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,10 @@ -/updates_list.txt \ No newline at end of file +/updates_list.txt +/architecture.txt +/installed +/apps/app_categories +/etc/accent +/etc/editor +/etc/express-updates +/etc/pi-apps-import +/etc/theme +/installscripts* \ No newline at end of file diff --git a/README.md b/README.md index 996823f..021eb00 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,6 @@ Submit a new app
-## ⚠️ SCAM ALERT -Recently, I have been made aware of a repository which is claiming to offer an "updated version" of LinStore but instead provides a download for malicious software. - -If you come across one of these repositories using LinStore's branding to ship malware, please report it. Thanks! - ## Welcome to LinStore!
LinStore is the Linux desktop's best app store, but it's also the lightest and fastest graphical store available, using less RAM than another popular lightweight app store.^
@@ -40,6 +35,21 @@ To install LinStore, run the following command:
curl -s -L https://raw.githubusercontent.com/techguy16/LinStore/main/install | bash
```
+
LinStore has the ability to install non-package apps from Pi-Apps. install_package and remove_package are separate scripts, unlike Pi-Apps which uses a large script (manage) for everything.
### LinStore badges
@@ -97,4 +114,13 @@ If you have an app listed on LinStore, consider adding a badge to your README to
[
](https://github.com/techguy16/LinStore)
```markdown
[
](https://github.com/techguy16/LinStore)
-```
\ No newline at end of file
+```
+
+
+## Contributing
+
+LinStore welcomes contributions, however small or big they are:
+
+* [Submit](https://github.com/techguy16/LinStore/issues/new?template=app-submission.yml) or [suggest](https://github.com/techguy16/LinStore/issues/new?template=app-request.yml) apps to be added to the app library
+* [Reporting bugs](https://github.com/techguy16/LinStore/issues/new?template=bug.yml) with LinStore
+* Or even just starring the repository!
\ No newline at end of file
diff --git a/api b/api
index 6f1dd8e..34e33b5 100755
--- a/api
+++ b/api
@@ -9,8 +9,22 @@ fi
horizontal=$(echo $resolution | cut -d'x' -f1)
vertical=$(echo $resolution | cut -d'x' -f2)
+linstore_directory() {
+ if [ -e "$HOME/.linstore/directory" ]; then
+ cat "$HOME/.linstore/directory"
+ elif [ -e "$(pwd)/gui" ]; then
+ echo "$(pwd)"
+ else
+ echo "$HOME/.linstore"
+ fi
+}
+
+api_script() {
+ echo "$(linstore_directory)/api"
+}
+
theme_get() {
- website_file="etc/theme"
+ website_file="$(linstore_directory)/etc/theme"
if [ -e "$website_file" ]; then
cat "$website_file"
else
@@ -29,30 +43,47 @@ logo() {
╚══════╝╚═╝╚═╝░░╚══╝╚═════╝░░░░╚═╝░░░░╚════╝░╚═╝░░╚═╝╚══════╝"""
}
+generate_command() {
+ if [[ "$(readlink -f $(which x-terminal-emulator 2>/dev/null))" == */ptyxis* ]]; then
+ echo "ptyxis -- $1"
+ elif [[ "$(readlink -f $(which x-terminal-emulator 2>/dev/null))" == */gnome-terminal* ]]; then
+ echo "GNOME_TERMINAL_SCREEN='' gnome-terminal -- $1"
+
+ else
+ echo "x-terminal-emulator -e $1"
+ fi
+}
+
# Function to install an app
install_app() {
- local app_directory="$1"
- local selected_app_name="$2"
- local installed_file="$HOME/.linstore/installed"
+ local app_directory="$(get_app_directory "$1")"
+ local selected_app_name="$1"
+ local installed_file="$(linstore_directory)/installed"
local temp_script=$(mktemp)
+ mkdir -p "$(linstore_directory)/installscripts"
+
+ echo "#!/bin/bash" > "$temp_script"
+ echo "source \"$(api_script)\"" >> "$temp_script"
+
if [ -e "$app_directory/install" ]; then
- echo "cd \"$app_directory\" && chmod +x install && ./install && echo \"$selected_app_name\" >> \"$installed_file\" && echo \"$selected_app_name is installed\" && cat install > \"$HOME/.linstore/installscripts/${selected_app_name}\"" >"$temp_script"
+ echo "cd \"$app_directory\" && chmod +x install && ./install && echo \"$selected_app_name\" >> \"$installed_file\" && echo \"$selected_app_name is installed\" && cat install > \"$(linstore_directory)/installscripts/${selected_app_name}\"" >> "$temp_script"
else
- local architecture=$(cat "$HOME/.linstore/architecture.txt")
+ local architecture=$(cat "$(linstore_directory)/architecture.txt")
local install_script="install-$architecture"
if [ -e "$app_directory/$install_script" ]; then
- echo "cd \"$app_directory\" && chmod +x \"$install_script\" && ./\"$install_script\" && echo \"$selected_app_name\" >> \"$installed_file\" && echo \"$selected_app_name is installed\" && cat \"$install_script\" > \"$HOME/.linstore/installscripts/${selected_app_name}\"" >"$temp_script"
+ echo "cd \"$app_directory\" && chmod +x \"$install_script\" && ./\"$install_script\" && echo \"$selected_app_name\" >> \"$installed_file\" && echo \"$selected_app_name is installed\" && cat \"$install_script\" > \"$(linstore_directory)/installscripts/${selected_app_name}\"" >> "$temp_script"
else
if [ -e "$app_directory/packages" ]; then
- echo "cd \"$app_directory\" && sudo apt update && sudo apt install \$(cat \"$app_directory/packages\") && echo \"$selected_app_name\" >> \"$installed_file\" && echo \"$selected_app_name is installed\" && cat packages > \"$HOME/.linstore/installscripts/${selected_app_name}\"" >"$temp_script"
+ echo "cd \"$app_directory\" && sudo apt update && sudo apt install \$(cat \"$app_directory/packages\") && echo \"$selected_app_name\" >> \"$installed_file\" && echo \"$selected_app_name is installed\" && cat packages > \"$(linstore_directory)/installscripts/${selected_app_name}\"" >> "$temp_script"
else
- echo "./api error 'Installation script not found for this architecture.'"
+ echo "error 'Installation script not found for this architecture.'" >> "$temp_script"
fi
fi
fi
- echo "x-terminal-emulator -e './api logo && ./api info \"Installing ${selected_app_name}\n\n\" && bash -c \"sudo echo && bash $temp_script\"'"
+
+ generate_command "bash -c 'source \"$(api_script)\" && logo && information \"Installing ${selected_app_name}\n\n\" && sudo echo && bash \"$temp_script\"'"
}
get_installed_apps_from_piapps() {
@@ -71,16 +102,14 @@ open_app() {
fi
}
-# Function to install an app
installation_script() {
- local app_directory="$1"
- local selected_app_name="$2"
- local installed_file="$HOME/.linstore/installed"
+ local app_directory="$(get_app_directory "$1")"
+ local selected_app_name="$1"
if [ -e "$app_directory/install" ]; then
echo "install"
else
- local architecture=$(cat "$HOME/.linstore/architecture.txt")
+ local architecture=$(cat "$(linstore_directory)/architecture.txt")
local install_script="install-$architecture"
if [ -e "$app_directory/$install_script" ]; then
@@ -97,29 +126,32 @@ installation_script() {
# Function to uninstall an app
uninstall_app() {
- local app_directory="$1"
- local selected_app_name="$2"
- local uninstalled_file="$HOME/.linstore/uninstalled"
+ local app_directory="$(get_app_directory "$1")"
+ local selected_app_name="$1"
+ local uninstalled_file="$(linstore_directory)/uninstalled"
local temp_script=$(mktemp)
+ echo "#!/bin/bash" > "$temp_script"
+ echo "source \"$(api_script)\"" >> "$temp_script"
+
if [ -e "$app_directory/uninstall" ]; then
- echo "cd \"$app_directory\" && chmod +x uninstall && ./uninstall && echo \"$selected_app_name has been uninstalled\"" >"$temp_script"
+ echo "cd \"$app_directory\" && chmod +x uninstall && ./uninstall && echo \"$selected_app_name has been uninstalled\"" >> "$temp_script"
else
- local architecture=$(cat "$HOME/.linstore/architecture.txt")
+ local architecture=$(cat "$(linstore_directory)/architecture.txt")
local uninstall_script="uninstall-$architecture"
if [ -e "$app_directory/$uninstall_script" ]; then
- echo "cd \"$app_directory\" && chmod +x \"$uninstall_script\" && ./\"$uninstall_script\" && echo \"$selected_app_name has been uninstalled\"" >"$temp_script"
+ echo "cd \"$app_directory\" && chmod +x \"$uninstall_script\" && ./\"$uninstall_script\" && echo \"$selected_app_name has been uninstalled\"" >> "$temp_script"
else
if [ -e "$app_directory/packages" ]; then
- echo "cd \"$app_directory\" && sudo apt update && sudo apt remove \$(cat \"$app_directory/packages\") && echo \"$selected_app_name has been uninstalled\"" >"$temp_script"
+ echo "cd \"$app_directory\" && sudo apt update && sudo apt remove \$(cat \"$app_directory/packages\") && echo \"$selected_app_name has been uninstalled\"" >> "$temp_script"
else
- echo "./api error 'Uninstallation script not found for this architecture.'" >"$temp_script"
+ echo "error 'Uninstallation script not found for this architecture.'" >> "$temp_script"
fi
fi
fi
- echo "x-terminal-emulator -e './api logo && ./api info \"Uninstalling ${selected_app_name}\n\n\" && sudo echo && bash \"$temp_script\"'"
+ generate_command "bash -c 'source \"$(api_script)\" && logo && information \"Uninstalling ${selected_app_name}\n\n\" && sudo echo && bash \"$temp_script\"'"
}
# Function to search for apps
@@ -130,18 +162,19 @@ search_apps() {
query=$(GTK_THEME="${theme}" yad --title="Search Apps" --borders=10 --center --text="Enter query:" --entry \
--button="Cancel!gtk-cancel":1 --button="Search!edit-find":0)
if [ -n "$query" ]; then
- app_list=$(ls -w 1 ./apps | awk 'BEGIN {ORS="\n"} {print}')
+ app_list=$(ls -w 1 ./apps 2>/dev/null | awk 'BEGIN {ORS="\n"} {print}')
num_apps=$(echo "$app_list" | wc -l)
num_apps=$((num_apps))
echo "$num_apps"
apps_found=()
for app in ./apps/*; do
+ [ -e "$app" ] || continue
app_name=$(basename "$app")
if [[ "${app_name,,}" == *"${query,,}"* ]]; then
app_icon="apps/$app_name/icon-24.png"
app_category_file="$app/category"
- app_category=$(head -n 1 "$app_category_file")
+ app_category=$(head -n 1 "$app_category_file" 2>/dev/null)
apps_found+=("$app_icon" "$app_name" "in" "$app_category")
fi
done
@@ -152,7 +185,7 @@ search_apps() {
--column="in" --column="Category" --no-headers "${apps_found[@]}" --button="Exit!gtk-cancel":1 --button="View App!edit-find":0 &)
if [ -n "$selected_category2" ]; then
echo "$(echo ${selected_category2} | awk -F"|" '{print $2}' | sed 's/|//g')" > /tmp/tmpname
- ./gui showdetails &
+ "$(linstore_directory)/gui" showdetails &
fi
else
GTK_THEME="${theme}" yad --center --title="Search Results" --geometry=450x600+${x2}+${y2} \
@@ -160,20 +193,161 @@ search_apps() {
--button="Retry!edit-find":1 --button="Exit!gtk-cancel":0
response=$?
if [ $response -eq 1 ]; then
- ./api search
+ "$(api_script)" search
fi
fi
fi
}
+cache_categories() {
+ # $1 - apps dir
+ # $2 - include Pi-Apps?
+ yad --title="LinStore" \
+ --class="LinStore" \
+ --center --borders=10 \
+ --text "Generating app cache..." \
+ --no-buttons &
+
+ if [ -e "${1}/app_categories" ]; then
+ rm -f "${1}/app_categories"
+ fi
+
+ local architecture=$(cat "$(linstore_directory)/architecture.txt" 2>/dev/null)
+
+ for app_dir in "${1}"/*; do
+ app_name=$(basename "${app_dir}")
+ if [ -e "${1}/$app_name/category" ]; then
+ if [ -e "$app_dir/install" ] || [ -e "$app_dir/install-$architecture" ] \
+ || [ -e "$HOME/pi-apps/apps/$app_name/install-$architecture" ] \
+ || [ -e "$HOME/pi-apps/apps/$app_name/install" ]; then
+ echo "$app_name|$(cat "${1}/$app_name/category")" >> "${1}/app_categories"
+ fi
+ fi
+ done
+
+ if [[ "$2" == "TRUE" ]]; then
+ if [ -e "$HOME/pi-apps/etc/categories" ]; then
+ while IFS= read -r line; do
+ app_name=$(echo "$line" | awk -F'|' '{print $1}')
+ app_dir="$HOME/pi-apps/apps/$app_name"
+ category=$(grep -r "$(echo "$line" | awk -F'|' '{print $2}')" etc/mapping | head -n1 | awk -F'|' '{print $2}')
+ if [ -e "$app_dir/install" ] || [ -e "$app_dir/install-$architecture" ] \
+ || [ -e "$HOME/pi-apps/apps/$app_name/install-$architecture" ] \
+ || [ -e "$HOME/pi-apps/apps/$app_name/install" ]; then
+ echo "$app_name|$category" >> "${1}/app_categories"
+ fi
+ done < "$HOME/pi-apps/etc/categories"
+ fi
+ fi
+
+ sort "${1}/app_categories" > "${1}/app_categories.tmp"
+ mv "${1}/app_categories.tmp" "${1}/app_categories"
+
+ pkill -f "yad*"
+}
+
+get_categories() {
+ cat "$(linstore_directory)/etc/categories"
+}
+
+get_apps_in_category() {
+ local category="$1"
+ grep "|$category$" "$(linstore_directory)/etc/categories" | cut -d'|' -f1
+}
+
+get_app_description() {
+ app_name="$1"
+ description_file="$(linstore_directory)/apps/$app_name/description"
+ if [ -e "$description_file" ]; then
+ cat "$description_file"
+ elif [ -e "$HOME/pi-apps/apps/$app_name/description" ]; then
+ cat "$HOME/pi-apps/apps/$app_name/description"
+ else
+ echo "No description available."
+ fi
+}
+
+get_app_creator() {
+ app_name="$1"
+ creator_file="$(linstore_directory)/apps/$app_name/creator"
+ if [ -e "$creator_file" ]; then
+ cat "$creator_file"
+ elif [ -e "$HOME/pi-apps/apps/$app_name/credits" ]; then
+ cat "$HOME/pi-apps/apps/$app_name/credits"
+ else
+ echo "No creator available."
+ fi
+}
+
+get_app_website() {
+ app_name="$1"
+ website_file="$(linstore_directory)/apps/$app_name/website"
+ if [ -e "$website_file" ]; then
+ cat "$website_file"
+ else
+ echo "No website available."
+ fi
+}
+
+get_app_directory() {
+ local app_name="$1"
+ if [ -d "$(linstore_directory)/apps/$app_name" ]; then
+ echo "$(linstore_directory)/apps/$app_name"
+ elif [ -d "$HOME/pi-apps/apps/$app_name" ]; then
+ echo "$HOME/pi-apps/apps/$app_name"
+ else
+ echo ""
+ fi
+}
+
+install_packages() {
+ packages="$@"
+ sudo apt update > /dev/null 2>&1
+
+ for package in $packages; do
+ if [[ "$package" == http* ]]; then
+ echo "Downloading and installing $package..."
+ wget --no-check-certificate "$package" -O /tmp/package.deb > /dev/null 2>&1
+ sudo dpkg -i /tmp/package.deb > /dev/null 2>&1
+ rm -r /tmp/package.deb
+ elif [[ "$package" == *.deb ]]; then
+ echo "Installing $package using dpkg..."
+ sudo dpkg -i "$package" > /dev/null 2>&1
+ else
+ echo "Installing $package using apt..."
+ sudo apt install "$package" -y > /dev/null 2>&1
+ fi
+ done
+}
+
+# Stub for old package scripts
+install_package(){
+ install_packages "$@"
+}
+
+remove_package(){
+ echo "Removing $1..."
+ sudo apt remove "$1" -y > /dev/null 2>&1
+}
+
+git_clone() {
+ if [ -z "$2" ]; then
+ local directory=$(basename "$1")
+ else
+ local directory="$2"
+ fi
+
+ git clone "$1" "$directory"
+}
+
update() {
pkill -f "yad*"
- ./api info "Updating LinStore..."
+ "$(api_script)" info "Updating LinStore..."
curl -s -L https://raw.githubusercontent.com/techguy16/LinStore/main/install | bash
}
buildinfo() {
- echo "Update/commit $(git rev-parse --short HEAD) (\"$(git log --pretty='format:%Creset%s' --no-merges -1)\" - $(git log -1 --pretty=format:%an))"
+ echo "Update/commit $(git rev-parse --short HEAD 2>/dev/null) (\"$(git log --pretty='format:%Creset%s' --no-merges -1 2>/dev/null)\" - $(git log -1 --pretty=format:%an 2>/dev/null))"
}
error() {
@@ -192,15 +366,43 @@ information() {
printf '\033[1;104;30m INFO:\033[0;104m %s \033[0m\n' "$msg" >&2
}
+export -f linstore_directory
+export -f api_script
+export -f theme_get
+export -f logo
+export -f generate_command
+export -f install_app
+export -f get_installed_apps_from_piapps
+export -f open_app
+export -f installation_script
+export -f uninstall_app
+export -f search_apps
+export -f cache_categories
+export -f get_categories
+export -f get_apps_in_category
+export -f get_app_description
+export -f get_app_creator
+export -f get_app_website
+export -f get_app_directory
+export -f install_packages
+export -f install_package
+export -f remove_package
+export -f git_clone
+export -f update
+export -f buildinfo
+export -f error
+export -f warning
+export -f information
+
# Main logic to handle command line arguments
if [[ $1 == "search" ]]; then
search_apps
elif [[ $1 == "install" ]]; then
- install_app "$2" "$3"
+ install_app "$2"
elif [[ $1 == "whatscript" ]]; then
- installation_script "$2" "$3"
+ installation_script "$2"
elif [[ $1 == "uninstall" ]]; then
- uninstall_app "$2" "$3"
+ uninstall_app "$2"
elif [[ $1 == "logo" ]]; then
logo
elif [[ $1 == "error" ]]; then
diff --git a/createapp b/createapp
index f1349f2..f35bfc4 100755
--- a/createapp
+++ b/createapp
@@ -1,11 +1,11 @@
#!/bin/bash
-APP_STORE_DIRECTORY="apps"
-CATEGORIES_FILE="etc/categories"
+APP_STORE_DIRECTORY="$(linstore_directory)/apps"
+CATEGORIES_FILE="$(linstore_directory)/etc/categories"
get_editor() {
app_name="$1"
- creator_file="etc/editor"
+ creator_file="$(linstore_directory)/etc/editor"
if [ -e "$creator_file" ]; then
cat "$creator_file"
else
@@ -15,15 +15,15 @@ get_editor() {
select_category_pane() {
category_list=()
while read -r category; do
- category_list+=("images/categories/$category.png" "$category" "$(cat "etc/categoryinfo/${category}")")
+ category_list+=("$(linstore_directory)/images/categories/$category.png" "$category" "$(cat "$(linstore_directory)/etc/categoryinfo/${category}")")
done < "$CATEGORIES_FILE"
selected_category=$(yad --title="Select Category" \
- --image="images/logo/logo-64.png" --image-on-top \
- --window-icon="images/logo/logo-64.png" --class="LinStore" \
+ --image="$(linstore_directory)/images/logo/logo-64.png" --image-on-top \
+ --window-icon="$(linstore_directory)/images/logo/logo-64.png" --class="LinStore" \
--text="Choose a category\nLinStore organises apps by category, which allows users to quickly find related apps easier.\nPlease choose a category for your app:" \
--field="Category:" \
- --width="525" --height="550" --center --on-top --borders=10 --columns=1 "${category_list[@]}" \
+ --width="525" --height="550" --center --borders=10 --columns=1 "${category_list[@]}" \
--list --column="Icon:IMG" --column="Categories" --column="Description" --no-headers \
--button="Cancel!gtk-cancel":1 \
--button="Next!go-next":0 | awk -F '|' '{print $2}')
@@ -44,8 +44,8 @@ create_new_app_pane() {
app_directory="$APP_STORE_DIRECTORY"
app_data=$(yad --form \
--title="Create New App" \
- --image="images/logo/logo-64.png" --image-on-top \
- --window-icon="images/logo/logo-64.png" \
+ --image="$(linstore_directory)/images/logo/logo-64.png" --image-on-top \
+ --window-icon="$(linstore_directory)/images/logo/logo-64.png" \
--class="LinStore" \
--text="App Details\nYour app needs information for LinStore to properly display it.\nEnter the following details for the new $(cat ${app_directory}/category) app:" \
--field=":LBL" "" \
@@ -63,7 +63,7 @@ create_new_app_pane() {
--field="ARM 64-bit (aarch64):CHK" "" \
--field=":LBL" "" \
--field="Separate or combined install scripts?:CB" 'Combined (all architectures in one)!Separate' \
- --width="525" --height="550" --center --on-top --borders=10 --separator="|" \
+ --width="525" --height="550" --center --borders=10 --separator="|" \
--button="Cancel!gtk-cancel":1 \
--button="Next!go-next":0)
@@ -99,12 +99,12 @@ create_new_app_pane() {
#icon_file=$(yad --file-selection --title="Select Icon for App" --width="525" --height="550" --center --on-top)
assets_data=$(yad --form \
--title="Create New App" \
- --image="images/logo/logo-64.png" --image-on-top \
- --window-icon="images/logo/logo-64.png" --class="LinStore" \
+ --image="$(linstore_directory)/images/logo/logo-64.png" --image-on-top \
+ --window-icon="$(linstore_directory)/images/logo/logo-64.png" --class="LinStore" \
--text="App Assets\nYour app needs assets in LinStore, which is currently limited to the app's logo/icon.\nSelect these assets here:" \
--field=":LBL" "" \
--field="Icon/logo:SFL" "" \
- --width="525" --height="550" --center --on-top --borders=10 --separator="|" \
+ --width="525" --height="550" --center --borders=10 --separator="|" \
--button="Cancel!gtk-cancel":1 \
--button="Next!go-next":0)
@@ -120,63 +120,78 @@ create_new_app_pane() {
convert "$icon_file" -resize 24x24 "$app_directory/icon-24.png"
convert "$icon_file" -resize 16x16 "$app_directory/icon-16.png"
fi
-
+
+ # Create or update the install scripts based on user preferences
+ if [[ "$separate_scripts" == "Combined (all architectures in one)" ]]; then
+ touch "$app_directory/install" &
+ else
+ if [ "$install_x64" == "TRUE" ]; then
+ touch "$app_directory/install-x64" &
+ fi
+ if [ "$install_x86" == "TRUE" ]; then
+ touch "$app_directory/install-x86" &
+ fi
+ if [ "$install_32" == "TRUE" ]; then
+ touch "$app_directory/install-32" &
+ fi
+ if [ "$install_64" == "TRUE" ]; then
+ touch "$app_directory/install-64" &
+ fi
+ fi
+
+ touch "$app_directory/uninstall" &
+
+ edit_scripts_pane "$app_directory"
+}
+
+edit_scripts_pane() {
+ app_directory="$1"
+ editor=$(get_editor)
+ buttons=()
+ for file in "$app_directory"/*; do
+ [ -f "$file" ] || continue
+ if [[ "$(basename "$file")" == "install"* ]]; then
+ buttons+=("--field= $(basename "$file")!images/button/install.png:BTN" "$editor \"$file\"")
+ elif [[ "$(basename "$file")" == "uninstall"* ]]; then
+ buttons+=("--field= $(basename "$file")!images/button/uninstall.png:BTN" "$editor \"$file\"")
+ fi
+ done
+
yad --form \
--title="Create New App" \
- --image="images/logo/logo-64.png" --image-on-top \
- --window-icon="images/logo/logo-64.png" --class="LinStore" \
- --text="Installer Scripts\nYour app has been created!" \
+ --image="$(linstore_directory)/images/logo/logo-64.png" --image-on-top \
+ --window-icon="$(linstore_directory)/images/logo/logo-64.png" --class="LinStore" \
+ --text="Edit App Scripts\nEdit your app's install and uninstall scripts." \
--field=":LBL" "" \
- --field="You now need to write an Installer and an Uninstaller script. These are the scripts executed when users click \"Install\" and \"Uninstall\" in LinStore.\n\nIf you would like to create these now, press 'Next'. Else, press 'Cancel'.:LBL" "" \
- --width="525" --height="550" --center --on-top --borders=10 --separator="|" \
+ --field="Listed below are the scripts used by LinStore when installing or uninstalling your app. Click on one to create or edit it.:LBL" "" \
+ "${buttons[@]}" \
+ --width="525" --height="550" --center --borders=10 --separator="|" \
--button="Cancel!gtk-cancel":1 \
- --button="Next!go-next":0 > /dev/null 2>&1
+ --button="Next!go-next":0 > /dev/null 2>&1
- # Create or update the install scripts based on user preferences
if [ $? -eq 0 ]; then
- if [[ "$separate_scripts" == "Combined (all architectures in one)" ]]; then
- gedit "$app_directory/install" &
- else
- if [ "$install_x64" == "TRUE" ]; then
- gedit "$app_directory/install-x64" &
- fi
- if [ "$install_x86" == "TRUE" ]; then
- gedit "$app_directory/install-x86" &
- fi
- if [ "$install_32" == "TRUE" ]; then
- gedit "$app_directory/install-32" &
- fi
- if [ "$install_64" == "TRUE" ]; then
- gedit "$app_directory/install-64" &
- fi
- fi
-
- gedit "$app_directory/uninstall"
- wait
- elif [ $? -eq 252 ]; then
- echo $?
+ yad --form \
+ --title="Create New App" \
+ --image="$(linstore_directory)/images/logo/logo-64.png" --image-on-top \
+ --window-icon="$(linstore_directory)/images/logo/logo-64.png" --class="LinStore" \
+ --text="Thank you!\nThank you for using LinStore's app creation wizard." \
+ --field=":LBL" "" \
+ --field="Next Steps:\nSubmit your app for addition to LinStore's app library. You can do this by 'zipping' the new app's directory and uploading it to an issue at our GitHub.\n\nIf you do not wish to do so, you can still distribute your app's zip file by specifying to your users to use LinStore's 'Import App' function.:LBL" "" \
+ --width="525" --height="550" --center --borders=10 --separator="|" \
+ --button="Exit!window-close":0 > /dev/null 2>&1
fi
-
- yad --form \
- --title="Create New App" \
- --image="images/logo/logo-64.png" --image-on-top \
- --window-icon="images/logo/logo-64.png" --class="LinStore" \
- --text="Thank you!\nThank you for using LinStore's app creation wizard." \
- --field=":LBL" "" \
- --field="Next Steps:\nSubmit your app for addition to LinStore's app library. You can do this by 'zipping' the new app's directory and uploading it to an issue at our GitHub.\n\nIf you do not wish to do so, you can still distribute your app's zip file by specifying to your users to use LinStore's 'Import App' function.:LBL" "" \
- --width="525" --height="550" --center --on-top --borders=10 --separator="|" \
- --button="Exit!window-close":0 > /dev/null 2>&1
+
}
welcome() {
yad --form \
--title="Create New App" \
- --image="images/logo/logo-64.png" --image-on-top \
- --window-icon="images/logo/logo-64.png" --class="LinStore" \
+ --image="$(linstore_directory)/images/logo/logo-64.png" --image-on-top \
+ --window-icon="$(linstore_directory)/images/logo/logo-64.png" --class="LinStore" \
--text="App Creator\nWelcome to the LinStore's app creator!" \
--field=":LBL" "" \
--field="What is this?\nThis is a wizard that will guide you through the necessary steps in order to create an app to be displayed in LinStore.\n\nIf you're ready, press 'Next'.\nIf you got here by accident, press 'Cancel'.:LBL" "" \
- --width="525" --height="550" --center --on-top --borders=10 --separator="|" \
+ --width="525" --height="550" --center --borders=10 --separator="|" \
--button="Cancel!gtk-cancel":1 \
--button="Next!go-next":0 > /dev/null 2>&1
if [ $? -eq 0 ]; then
@@ -190,13 +205,13 @@ import_zip_file() {
#import_file=$(yad --file-selection --title="Select Zip File to Import" --height="550" --width="525" --center --on-top)
import_file=$(yad --form \
--title="Import App" \
- --image="images/logo/logo-64.png" --image-on-top \
- --window-icon="images/logo/logo-64.png" --class="LinStore" \
+ --image="$(linstore_directory)/images/logo/logo-64.png" --image-on-top \
+ --window-icon="$(linstore_directory)/images/logo/logo-64.png" --class="LinStore" \
--text="Import an app\nImport an app packaged as a ZIP into LinStore." \
--field=":LBL" "" \
--field="Some app developers distribute ZIP files to let you import into LinStore.\n\nTo import such a ZIP file, select it below and we'll import it for you.:LBL" "" \
--field="ZIP File: :SFL" "" \
- --width="525" --height="550" --center --on-top --borders=10 --separator="|" \
+ --width="525" --height="550" --center --borders=10 --separator="|" \
--button="Cancel!gtk-cancel":1 \
--button="Next!go-next":0 | awk -F '|' '{print $3}')
@@ -210,8 +225,8 @@ import_zip_file() {
yad --form \
--title="Import App" \
- --image="images/logo/logo-64.png" --image-on-top \
- --window-icon="images/logo/logo-64.png" --class="LinStore" \
+ --image="$(linstore_directory)/images/logo/logo-64.png" --image-on-top \
+ --window-icon="$(linstore_directory)/images/logo/logo-64.png" --class="LinStore" \
--text="Success!\nYour app has been successfully imported into LinStore." \
--field=":LBL" "" \
--field="You should now be able to find the app in the list of available apps!:LBL" "" \
diff --git a/etc/tools/LinStore.zip b/etc/tools/LinStore.zip
new file mode 100644
index 0000000..d572adf
Binary files /dev/null and b/etc/tools/LinStore.zip differ
diff --git a/gui b/gui
index 87bc285..bb7ab3a 100755
--- a/gui
+++ b/gui
@@ -9,6 +9,12 @@ YAD_COMMAND="yad"
YAD_FLAGS=""
ACCENT="green"
+export ACCENT
+
+pipe="$(mktemp -u)"
+mkfifo $pipe
+export pipe
+trap "rm -f $pipe" EXIT
#pwd
if ! command -v "$YAD_COMMAND" &>/dev/null; then
@@ -16,12 +22,17 @@ if ! command -v "$YAD_COMMAND" &>/dev/null; then
exit 1
fi
-if [ -f "gui" ] || [ -f "createapp" ] || [ -f "settings" ]; then
+if [ -e "$HOME/.linstore/directory" ]; then
+ cd "$(cat "$HOME/.linstore/directory")"
+elif [ -f "gui" ] || [ -f "api" ]; then
cd .
else
cd ~/.linstore
fi
+source api
+cd "$(linstore_directory)"
+
if [[ $(xrandr --current) =~ "connected primary" ]]; then
#echo "Dual monitor setup, placing on primary monitor"
resolution=$(xrandr --current | grep " connected primary" | awk '{print $4}' | cut -d'+' -f1)
@@ -42,31 +53,31 @@ detect_and_write_architecture() {
mkdir -p ~/.linstore
case "$(uname -m)" in
x86_64)
- echo "x64" >~/.linstore/architecture.txt
+ echo "x64" > "$(linstore_directory)/architecture.txt"
;;
i686)
- echo "x86" >~/.linstore/architecture.txt
+ echo "x86" > "$(linstore_directory)/architecture.txt"
;;
armv7l)
- echo "32" >~/.linstore/architecture.txt
+ echo "32" > "$(linstore_directory)/architecture.txt"
;;
aarch64)
- echo "64" >~/.linstore/architecture.txt
+ echo "64" > "$(linstore_directory)/architecture.txt"
;;
*)
- echo "Unknown architecture" >~/.linstore/architecture.txt
+ echo "Unknown architecture" > "$(linstore_directory)/architecture.txt"
;;
esac
}
-if [ -e "etc/accent" ]; then
- ACCENT="$(cat etc/accent)"
+if [ -e "$(linstore_directory)/etc/accent" ]; then
+ ACCENT="$(cat "$(linstore_directory)/etc/accent")"
if [[ "$ACCENT" == "" ]]; then
ACCENT="green"
fi
fi
list_piapps() {
- piapps_file="etc/pi-apps-import"
+ piapps_file="$(linstore_directory)/etc/pi-apps-import"
if [ -e "$piapps_file" ]; then
cat "$piapps_file"
else
@@ -74,98 +85,6 @@ list_piapps() {
fi
}
-read_categories() {
- while read -r category; do
- categories["$category"]=""
- done