summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbionel <ionel.busuioc@gmail.com>2020-08-16 11:01:14 +0300
committerbionel <ionel.busuioc@gmail.com>2020-08-16 11:01:14 +0300
commit907dbe248832e421ce0612192a3241b30d1f4745 (patch)
treea530b55469b24c14f747f3c4975cc4d6ad3fa1f7 /src
parentbd609749b6f14d6a8a86484fddb650b6d453e2dd (diff)
allow search as non-root
Diffstat (limited to 'src')
-rw-r--r--src/backend/dbsearch.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/dbsearch.py b/src/backend/dbsearch.py
index 7467462..6e32b69 100644
--- a/src/backend/dbsearch.py
+++ b/src/backend/dbsearch.py
@@ -2,6 +2,7 @@
import sisyphus
import sqlite3
+import os
def searchDB(filter, cat = '', pn = '', desc = ''):
NOVIRT = "AND cat NOT LIKE 'virtual'"
@@ -100,8 +101,11 @@ def tosql(string):
return '%%' if string == '' else string.replace('*', '%').replace('?', '_')
def showSearch(filter, cat, pn, desc, single = False):
- sisyphus.update.start()
- print(f"Searching for {filter} packages ...\n")
+ if os.getuid() == 0:
+ sisyphus.update.start()
+ else:
+ print('You are not root, cannot fetch updates.\nSearch result may be inaccurate!')
+ print(f"Looking for {filter} matching packages ...\n")
pkglist = searchDB(filter, tosql(cat), tosql(pn), tosql(desc))
if len(pkglist) == 0: